porffor 0.55.15 → 0.55.16
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/compiler/builtins/bigint.ts +233 -0
- package/compiler/builtins_precompiled.js +485 -398
- package/compiler/precompile.js +1 -1
- package/compiler/wrap.js +14 -0
- package/package.json +1 -1
- package/r.cjs +0 -4
- package/runner/index.js +1 -1
package/compiler/precompile.js
CHANGED
@@ -230,7 +230,7 @@ ${funcs.map(x => {
|
|
230
230
|
.replace(/\"local","(.*?)",(.*?)\]/g, (_, name, valtype) => `loc('${name}',${valtype})]`)
|
231
231
|
.replace(/\[16,"(.*?)"]/g, (_, name) => `[16,builtin('${name}')]`)
|
232
232
|
.replace(/\[(68|65),"funcref","(.*?)"]/g, (_1, op, name) => op === '65' ? `...i32ify(funcRef('${name}'))` : `...funcRef('${name}')`)
|
233
|
-
.replace(/\[(68|65),"str","(.*?)",(.*?)]/g, (_1, op, str, forceBytestring) => op === '65' ? `...i32ify(makeString(_
|
233
|
+
.replace(/\[(68|65),"str","(.*?)",(.*?)]/g, (_1, op, str, forceBytestring) => op === '65' ? `...i32ify(makeString(_,"${str}",${forceBytestring ? 1 : 0}))` : `...makeString(_,"${str}",${forceBytestring ? 1 : 0})`)
|
234
234
|
.replace(/\["throw","(.*?)","(.*?)"\]/g, (_, constructor, message) => `...internalThrow(_,'${constructor}',\`${message}\`)`)
|
235
235
|
.replace(/\["get object","(.*?)"\]/g, (_, objName) => `...generateIdent(_,{name:'${objName}'})`)
|
236
236
|
.replace(/\[null,"typeswitch case start",\[(.*?)\]\],/g, (_, types) => `...t([${types}],()=>[`)
|
package/compiler/wrap.js
CHANGED
@@ -335,6 +335,20 @@ ${flags & 0b0001 ? ` get func idx: ${get}
|
|
335
335
|
return out;
|
336
336
|
}
|
337
337
|
|
338
|
+
case TYPES.bigint: {
|
339
|
+
const negative = read(Uint8Array, memory, value, 1)[0] !== 0;
|
340
|
+
const len = read(Uint16Array, memory, value + 2, 1)[0];
|
341
|
+
const digits = read(Uint32Array, memory, value + 4, len);
|
342
|
+
|
343
|
+
console.log(digits);
|
344
|
+
|
345
|
+
let result = 0n;
|
346
|
+
for (let i = 0; i < digits.length; i++) {
|
347
|
+
result = result * 0x100000000n + BigInt(digits[i]);
|
348
|
+
}
|
349
|
+
return negative ? -result : result;
|
350
|
+
}
|
351
|
+
|
338
352
|
default: return value;
|
339
353
|
}
|
340
354
|
};
|
package/package.json
CHANGED
package/r.cjs
CHANGED