Skip to content

Commit c97c86f

Browse files
Merge pull request #393 from gpujs/392-cpu-type-management
fix: CPU transpilation issue for type management
2 parents 4351a70 + b577c1a commit c97c86f

File tree

10 files changed

+513
-153
lines changed

10 files changed

+513
-153
lines changed

bin/gpu-core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*
55
* GPU Accelerated JavaScript
66
*
7-
* @version 1.10.1
8-
* @date Thu Nov 01 2018 10:01:30 GMT-0400 (EDT)
7+
* @version 1.10.2
8+
* @date Thu Nov 01 2018 14:15:00 GMT-0400 (EDT)
99
*
1010
* @license MIT
1111
* The MIT License

bin/gpu-core.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/gpu.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*
55
* GPU Accelerated JavaScript
66
*
7-
* @version 1.10.1
8-
* @date Thu Nov 01 2018 10:01:30 GMT-0400 (EDT)
7+
* @version 1.10.2
8+
* @date Thu Nov 01 2018 14:15:00 GMT-0400 (EDT)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -125,8 +125,6 @@ module.exports = function (_BaseFunctionNode) {
125125
if (i > 0) {
126126
retArr.push(', ');
127127
}
128-
retArr.push(this.paramTypes[i]);
129-
retArr.push(' ');
130128
retArr.push('user_');
131129
retArr.push(this.paramNames[i]);
132130
}
@@ -143,7 +141,6 @@ module.exports = function (_BaseFunctionNode) {
143141

144142
if (!this.isRootKernel) {
145143
retArr.push('function');
146-
this.kernalAst = ast;
147144
retArr.push(' ');
148145
retArr.push(this.functionName);
149146
retArr.push('(');
@@ -154,8 +151,6 @@ module.exports = function (_BaseFunctionNode) {
154151
if (i > 0) {
155152
retArr.push(', ');
156153
}
157-
158-
retArr.push(' ');
159154
retArr.push('user_');
160155
retArr.push(paramName);
161156
}
@@ -773,15 +768,15 @@ module.exports = function (_BaseFunctionNode) {
773768
value: function astArrayExpression(arrNode, retArr) {
774769
var arrLen = arrNode.elements.length;
775770

776-
retArr.push('new Float32Array(');
771+
retArr.push('[');
777772
for (var i = 0; i < arrLen; ++i) {
778773
if (i > 0) {
779774
retArr.push(', ');
780775
}
781776
var subNode = arrNode.elements[i];
782777
this.astGeneric(subNode, retArr);
783778
}
784-
retArr.push(')');
779+
retArr.push(']');
785780

786781
return retArr;
787782

@@ -2528,7 +2523,6 @@ module.exports = function (_FunctionNodeBase) {
25282523

25292524
if (this.isRootKernel) {
25302525
retArr.push('void');
2531-
this.kernalAst = ast;
25322526
} else {
25332527
var returnType = this.returnType;
25342528
var type = typeMap[returnType];

bin/gpu.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/backend/cpu/function-node.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ module.exports = function (_BaseFunctionNode) {
143143
if (i > 0) {
144144
retArr.push(', ');
145145
}
146-
retArr.push(this.paramTypes[i]);
147-
retArr.push(' ');
148146
retArr.push('user_');
149147
retArr.push(this.paramNames[i]);
150148
}
@@ -174,7 +172,6 @@ module.exports = function (_BaseFunctionNode) {
174172
// Setup function return type and name
175173
if (!this.isRootKernel) {
176174
retArr.push('function');
177-
this.kernalAst = ast;
178175
retArr.push(' ');
179176
retArr.push(this.functionName);
180177
retArr.push('(');
@@ -186,8 +183,6 @@ module.exports = function (_BaseFunctionNode) {
186183
if (i > 0) {
187184
retArr.push(', ');
188185
}
189-
190-
retArr.push(' ');
191186
retArr.push('user_');
192187
retArr.push(paramName);
193188
}
@@ -1101,15 +1096,15 @@ module.exports = function (_BaseFunctionNode) {
11011096
value: function astArrayExpression(arrNode, retArr) {
11021097
var arrLen = arrNode.elements.length;
11031098

1104-
retArr.push('new Float32Array(');
1099+
retArr.push('[');
11051100
for (var i = 0; i < arrLen; ++i) {
11061101
if (i > 0) {
11071102
retArr.push(', ');
11081103
}
11091104
var subNode = arrNode.elements[i];
11101105
this.astGeneric(subNode, retArr);
11111106
}
1112-
retArr.push(')');
1107+
retArr.push(']');
11131108

11141109
return retArr;
11151110

dist/backend/web-gl/function-node.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ module.exports = function (_FunctionNodeBase) {
148148
// Setup function return type and name
149149
if (this.isRootKernel) {
150150
retArr.push('void');
151-
this.kernalAst = ast;
152151
} else {
153152
var returnType = this.returnType;
154153
var type = typeMap[returnType];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gpu.js",
3-
"version": "1.10.1",
3+
"version": "1.10.2",
44
"description": "GPU Accelerated JavaScript",
55
"main": "./dist/index.js",
66
"files": ["dist", "bin"],

src/backend/cpu/function-node.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ module.exports = class CPUFunctionNode extends BaseFunctionNode {
120120
if (i > 0) {
121121
retArr.push(', ');
122122
}
123-
retArr.push(this.paramTypes[i]);
124-
retArr.push(' ');
125123
retArr.push('user_');
126124
retArr.push(this.paramNames[i]);
127125
}
@@ -148,7 +146,6 @@ module.exports = class CPUFunctionNode extends BaseFunctionNode {
148146
// Setup function return type and name
149147
if (!this.isRootKernel) {
150148
retArr.push('function');
151-
this.kernalAst = ast;
152149
retArr.push(' ');
153150
retArr.push(this.functionName);
154151
retArr.push('(');
@@ -160,8 +157,6 @@ module.exports = class CPUFunctionNode extends BaseFunctionNode {
160157
if (i > 0) {
161158
retArr.push(', ');
162159
}
163-
164-
retArr.push(' ');
165160
retArr.push('user_');
166161
retArr.push(paramName);
167162
}
@@ -1041,15 +1036,15 @@ module.exports = class CPUFunctionNode extends BaseFunctionNode {
10411036
astArrayExpression(arrNode, retArr) {
10421037
const arrLen = arrNode.elements.length;
10431038

1044-
retArr.push('new Float32Array(');
1039+
retArr.push('[');
10451040
for (let i = 0; i < arrLen; ++i) {
10461041
if (i > 0) {
10471042
retArr.push(', ');
10481043
}
10491044
const subNode = arrNode.elements[i];
10501045
this.astGeneric(subNode, retArr)
10511046
}
1052-
retArr.push(')');
1047+
retArr.push(']');
10531048

10541049
return retArr;
10551050

src/backend/web-gl/function-node.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ module.exports = class WebGLFunctionNode extends FunctionNodeBase {
123123
// Setup function return type and name
124124
if (this.isRootKernel) {
125125
retArr.push('void');
126-
this.kernalAst = ast;
127126
} else {
128127
const returnType = this.returnType;
129128
const type = typeMap[returnType];

0 commit comments

Comments
 (0)