porffor 0.14.0-c6f2015a7 → 0.14.0-cb572e8d4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +4 -3
- package/compiler/2c.js +1 -3
- package/compiler/generated_builtins.js +0 -10
- package/package.json +1 -1
- package/compiler/builtins/console.ts +0 -4
package/CONTRIBUTING.md
CHANGED
@@ -98,7 +98,7 @@ Loads the character code at the pointer `pointer` **for a String**.[^1]
|
|
98
98
|
Porffor.wasm.i32.store(pointer, length, 0, 0)
|
99
99
|
```
|
100
100
|
|
101
|
-
Stores the length `length` at pointer `pointer`, setting the length of an object. This is mostly unneeded today as you can just do `obj.length = length`.
|
101
|
+
Stores the length `length` at pointer `pointer`, setting the length of an object. This is mostly unneeded today as you can just do `obj.length = length`. [^2]
|
102
102
|
|
103
103
|
<br>
|
104
104
|
|
@@ -205,7 +205,6 @@ Store the character code into the `out` pointer variable, and increment it.
|
|
205
205
|
- Do not set a return type for prototype methods, it can cause errors/unexpected results.
|
206
206
|
- You cannot use other functions in the file not exported, or variables not inside the current function.
|
207
207
|
- `if (...)` uses a fast truthy implementation which is not spec-compliant as most conditions should be strictly checked. To use spec-compliant behavior, use `if (Boolean(...))`.
|
208
|
-
- For object (string/array/etc) literals, you must use a variable eg `const out: bytestring = 'foobar'; console.log(out);` instead of `console.log('foobar')` due to precompile's allocator constraints.
|
209
208
|
|
210
209
|
<br>
|
211
210
|
|
@@ -258,4 +257,6 @@ It will also log new passes/fails. Be careful as sometimes the overall passes ca
|
|
258
257
|
|
259
258
|
<br>
|
260
259
|
|
261
|
-
[^1]: The `0, 4` args are necessary for the Wasm instruction, but you don't need to worry about them (`0` alignment, `4` byte offset for length).
|
260
|
+
[^1]: The `0, 4` args are necessary for the Wasm instruction, but you don't need to worry about them (`0` alignment, `4` byte offset for length).
|
261
|
+
|
262
|
+
[^2]: The `0, 4` args are necessary for the Wasm instruction, but you don't need to worry about them (`0` alignment, `0` byte offset).
|
package/compiler/2c.js
CHANGED
@@ -207,8 +207,6 @@ export default ({ funcs, globals, tags, data, exceptions, pages }) => {
|
|
207
207
|
depth = 1;
|
208
208
|
brDepth = 0;
|
209
209
|
|
210
|
-
let retTmpId = 0;
|
211
|
-
|
212
210
|
const invLocals = inv(f.locals, x => x.idx);
|
213
211
|
|
214
212
|
for (const x in invLocals) {
|
@@ -539,7 +537,7 @@ _time_out = _time.tv_nsec / 1000000. + _time.tv_sec * 1000.;`);
|
|
539
537
|
if (func.internal) {
|
540
538
|
vals.push(`${sanitize(func.name)}(${args.join(', ')})`);
|
541
539
|
} else {
|
542
|
-
line(`const struct ReturnValue _
|
540
|
+
line(`const struct ReturnValue _ = ${sanitize(func.name)}(${args.join(', ')})`);
|
543
541
|
vals.push(`_.value`);
|
544
542
|
vals.push(`_.type`);
|
545
543
|
}
|
@@ -407,16 +407,6 @@ export const BuiltinFuncs = function() {
|
|
407
407
|
locals: [],
|
408
408
|
localNames: ["_this","_this#type"],
|
409
409
|
};
|
410
|
-
this.__console_clear = {
|
411
|
-
wasm: (scope, {allocPage,builtin,}) => [...number(allocPage(scope, 'bytestring: __console_clear/clear', 'i8') * pageSize, 124),[34,0],[65,18],[16, builtin('__Porffor_print')],[68,0,0,0,0,0,0,36,64],[16,1],[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
412
|
-
params: [],
|
413
|
-
typedParams: true,
|
414
|
-
returns: [124,127],
|
415
|
-
typedReturns: true,
|
416
|
-
locals: [124],
|
417
|
-
localNames: ["clear"],
|
418
|
-
data: [{"offset":0,"bytes":[4,0,0,0,27,91,50,74]}],
|
419
|
-
};
|
420
410
|
this.__crypto_randomUUID = {
|
421
411
|
wasm: (scope, {allocPage,builtin,}) => [...number(allocPage(scope, 'bytestring: __crypto_randomUUID/bytes', 'i8') * pageSize, 127),[34,0],[34,1],[34,2],[65,16],[106],[33,3],[3,64],[32,2],[32,3],[72],[4,64],[32,2],[32,2],[65,1],[106],[33,2],[16, builtin('__Porffor_randomByte')],[58,0,4],[12,1],[11],[11],[32,1],[32,1],[45,0,10],[65,15],[113],[65,192,0],[114],[58,0,10],[32,1],[32,1],[45,0,12],[65,63],[113],[65,128,1],[114],[58,0,12],...number(allocPage(scope, 'bytestring: __crypto_randomUUID/output', 'i8') * pageSize, 127),[34,4],[33,5],[32,1],[33,6],[32,5],[65,8],[106],[33,7],[3,64],[32,5],[32,7],[72],[4,64],[32,6],[32,6],[65,1],[106],[33,6],[45,0,4],[34,8],[65,15],[113],[65,48],[106],[34,9],[65,57],[74],[4,64],[32,9],[65,39],[106],[33,9],[11],[32,8],[65,4],[117],[65,48],[106],[34,10],[65,57],[74],[4,64],[32,10],[65,39],[106],[33,10],[11],[32,5],[32,5],[65,1],[106],[33,5],[32,10],[58,0,4],[32,5],[32,5],[65,1],[106],[33,5],[32,9],[58,0,4],[12,1],[11],[11],[32,5],[65,1],[106],[34,5],[65,4],[106],[33,7],[3,64],[32,5],[32,7],[72],[4,64],[32,6],[32,6],[65,1],[106],[33,6],[45,0,4],[34,8],[65,15],[113],[65,48],[106],[34,9],[65,57],[74],[4,64],[32,9],[65,39],[106],[33,9],[11],[32,8],[65,4],[117],[65,48],[106],[34,10],[65,57],[74],[4,64],[32,10],[65,39],[106],[33,10],[11],[32,5],[32,5],[65,1],[106],[33,5],[32,10],[58,0,4],[32,5],[32,5],[65,1],[106],[33,5],[32,9],[58,0,4],[12,1],[11],[11],[32,5],[65,1],[106],[34,5],[65,4],[106],[33,7],[3,64],[32,5],[32,7],[72],[4,64],[32,6],[32,6],[65,1],[106],[33,6],[45,0,4],[34,8],[65,15],[113],[65,48],[106],[34,9],[65,57],[74],[4,64],[32,9],[65,39],[106],[33,9],[11],[32,8],[65,4],[117],[65,48],[106],[34,10],[65,57],[74],[4,64],[32,10],[65,39],[106],[33,10],[11],[32,5],[32,5],[65,1],[106],[33,5],[32,10],[58,0,4],[32,5],[32,5],[65,1],[106],[33,5],[32,9],[58,0,4],[12,1],[11],[11],[32,5],[65,1],[106],[34,5],[65,4],[106],[33,7],[3,64],[32,5],[32,7],[72],[4,64],[32,6],[32,6],[65,1],[106],[33,6],[45,0,4],[34,8],[65,15],[113],[65,48],[106],[34,9],[65,57],[74],[4,64],[32,9],[65,39],[106],[33,9],[11],[32,8],[65,4],[117],[65,48],[106],[34,10],[65,57],[74],[4,64],[32,10],[65,39],[106],[33,10],[11],[32,5],[32,5],[65,1],[106],[33,5],[32,10],[58,0,4],[32,5],[32,5],[65,1],[106],[33,5],[32,9],[58,0,4],[12,1],[11],[11],[32,5],[65,1],[106],[34,5],[65,12],[106],[33,7],[3,64],[32,5],[32,7],[72],[4,64],[32,6],[32,6],[65,1],[106],[33,6],[45,0,4],[34,8],[65,15],[113],[65,48],[106],[34,9],[65,57],[74],[4,64],[32,9],[65,39],[106],[33,9],[11],[32,8],[65,4],[117],[65,48],[106],[34,10],[65,57],[74],[4,64],[32,10],[65,39],[106],[33,10],[11],[32,5],[32,5],[65,1],[106],[33,5],[32,10],[58,0,4],[32,5],[32,5],[65,1],[106],[33,5],[32,9],[58,0,4],[12,1],[11],[11],[32,5],[65,1],[106],[33,5],[32,4],[15]],
|
422
412
|
params: [],
|
package/package.json
CHANGED