porffor 0.18.11 → 0.18.12

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.
@@ -694,25 +694,6 @@ export const __Date_parse = (string: bytestring): number => {
694
694
  };
695
695
 
696
696
 
697
- // dark wasm magic for a basic allocator, sorry.
698
- export const __Porffor_date_allocate = (): Date => {
699
- const hack: bytestring = '';
700
-
701
- if (hack.length == 0) {
702
- hack.length = Porffor.wasm`
703
- i32.const 1
704
- memory.grow 0
705
- i32.const 65536
706
- i32.mul
707
- i32.from_u`;
708
- }
709
-
710
- const ptr: number = hack.length;
711
- hack.length = ptr + 8;
712
-
713
- return ptr;
714
- };
715
-
716
697
  export const __Porffor_date_read = (ptr: Date): number => Porffor.wasm.f64.load(ptr, 0, 0);
717
698
  export const __Porffor_date_write = (ptr: Date, val: number) => {
718
699
  Porffor.wasm.f64.store(ptr, val, 0, 0);
@@ -2030,7 +2011,7 @@ export const Date = function (v0: unknown, v1: unknown, v2: unknown, v3: unknown
2030
2011
  }
2031
2012
 
2032
2013
  // 6. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%Date.prototype%", « [[DateValue]] »).
2033
- const O: Date = __Porffor_date_allocate();
2014
+ const O: Date = Porffor.allocateBytes(8);
2034
2015
 
2035
2016
  // 7. Set O.[[DateValue]] to dv.
2036
2017
  __Porffor_date_write(O, dv);
@@ -23,6 +23,8 @@ type PorfforGlobal = {
23
23
  }
24
24
 
25
25
  allocate(): any;
26
+ allocateBytes(bytes: i32): any;
27
+
26
28
  set: {
27
29
  read(_this: any, index: number): i32;
28
30
  write(_this: any, index: number, value: any): boolean;
@@ -1177,7 +1177,7 @@ export const BuiltinFuncs = function() {
1177
1177
  [ Opcodes.global_get, 0 ],
1178
1178
  [ Opcodes.local_get, 0 ],
1179
1179
  [ Opcodes.i32_add ],
1180
- [ Opcodes.global_set, 0 ]
1180
+ [ Opcodes.global_set, 0 ],
1181
1181
  [ Opcodes.end ],
1182
1182
 
1183
1183
  // return currentPtr
@@ -796,15 +796,6 @@ export const BuiltinFuncs = function() {
796
796
  locals: [124,127],
797
797
  localNames: ["string","string#type","chr","#last_type"],
798
798
  };
799
- this.__Porffor_date_allocate = {
800
- wasm: (scope, {allocPage,}) => [...number(allocPage(scope, 'bytestring: __Porffor_date_allocate/hack', 'i8') * pageSize, 124),[34,0],[252,3],[40,1,0],[184],[68,0,0,0,0,0,0,0,0],[97],[4,64],[32,0],[252,3],[65,1],[64,0],[65,128,128,4],[108],[184],[34,1],[252,3],[54,1,0],[11],[32,0],[252,3],[40,1,0],[184],[33,2],[32,0],[252,3],[32,2],[68,0,0,0,0,0,0,32,64],[160],[34,1],[252,3],[54,1,0],[32,2],[65,0],[15]],
801
- params: [],
802
- typedParams: true,
803
- returns: [124,127],
804
- typedReturns: true,
805
- locals: [124,124,124],
806
- localNames: ["hack","__length_setter_tmp","ptr"],
807
- };
808
799
  this.__Porffor_date_read = {
809
800
  wasm: (scope, {}) => [[32,0],[252,2],[43,0,0],[65,0],[15]],
810
801
  params: [124,127],
@@ -1284,7 +1275,7 @@ export const BuiltinFuncs = function() {
1284
1275
  localNames: ["_this","_this#type","#last_type"],
1285
1276
  };
1286
1277
  this.Date = {
1287
- wasm: (scope, {builtin,}) => [[32,-1],[184],[65,1],[33,14],[33,15],[32,14],[33,16],[2,124],[32,16],[65,194,0],[70],[4,64,"TYPESWITCH|undefined"],[32,15],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,16],[65,210,0],[70],[4,64,"TYPESWITCH|ByteString"],[32,15],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,15],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],[16, builtin('__Date_now')],[34,14],[16, builtin('__ecma262_ToDateString')],[34,14],[15],[11],[32,0],[32,1],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[32,2],[32,3],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,4],[32,5],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,6],[32,7],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,8],[32,9],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,10],[32,11],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,12],[32,13],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[33,17],[68,0,0,0,0,0,0,0,0],[33,18],[32,17],[68,0,0,0,0,0,0,0,0],[97],[4,64],[16, builtin('__Date_now')],[33,14],[33,18],[5],[32,17],[68,0,0,0,0,0,0,240,63],[97],[4,64],[32,0],[33,19],[32,1],[33,20],[32,0],[32,1],[16, builtin('__Porffor_rawType')],[33,21],[68,0,0,0,0,0,0,0,0],[33,22],[32,21],[68,0,0,0,0,0,0,51,64],[97],[4,64],[32,19],[32,20],[16, builtin('__Porffor_date_read')],[33,14],[33,22],[5],[32,21],[68,0,0,0,0,0,128,80,64],[97],[32,21],[68,0,0,0,0,0,128,84,64],[97],[114],[4,64],[32,19],[32,20],[16, builtin('__Date_parse')],[33,14],[33,22],[5],[65,0],[32,19],[16, builtin('Number')],[33,22],[11],[11],[32,22],[65,0],[16, builtin('__ecma262_TimeClip')],[33,14],[33,18],[5],[65,0],[32,0],[16, builtin('Number')],[33,23],[65,0],[32,2],[16, builtin('Number')],[33,24],[68,0,0,0,0,0,0,240,63],[33,25],[32,17],[68,0,0,0,0,0,0,0,64],[100],[4,64],[65,0],[32,4],[16, builtin('Number')],[33,25],[11],[68,0,0,0,0,0,0,0,0],[33,26],[32,17],[68,0,0,0,0,0,0,8,64],[100],[4,64],[65,0],[32,6],[16, builtin('Number')],[33,26],[11],[68,0,0,0,0,0,0,0,0],[33,27],[32,17],[68,0,0,0,0,0,0,16,64],[100],[4,64],[65,0],[32,8],[16, builtin('Number')],[33,27],[11],[68,0,0,0,0,0,0,0,0],[33,28],[32,17],[68,0,0,0,0,0,0,20,64],[100],[4,64],[65,0],[32,10],[16, builtin('Number')],[33,28],[11],[68,0,0,0,0,0,0,0,0],[33,29],[32,17],[68,0,0,0,0,0,0,24,64],[100],[4,64],[65,0],[32,12],[16, builtin('Number')],[33,29],[11],[32,23],[65,0],[16, builtin('__ecma262_MakeFullYear')],[33,14],[34,30],[65,0],[32,24],[65,0],[32,25],[65,0],[16, builtin('__ecma262_MakeDay')],[34,14],[32,26],[65,0],[32,27],[65,0],[32,28],[65,0],[32,29],[65,0],[16, builtin('__ecma262_MakeTime')],[34,14],[16, builtin('__ecma262_MakeDate')],[33,14],[34,31],[65,0],[16, builtin('__ecma262_UTC')],[34,14],[16, builtin('__ecma262_TimeClip')],[33,14],[33,18],[11],[11],[16, builtin('__Porffor_date_allocate')],[33,14],[34,32],[65,19],[32,18],[65,0],[16, builtin('__Porffor_date_write')],[33,14],[26],[32,32],[65,19],[15]],
1278
+ wasm: (scope, {builtin,}) => [[32,-1],[184],[65,1],[33,14],[33,15],[32,14],[33,16],[2,124],[32,16],[65,194,0],[70],[4,64,"TYPESWITCH|undefined"],[32,15],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,16],[65,210,0],[70],[4,64,"TYPESWITCH|ByteString"],[32,15],[252,3],[40,1,0],[69],[184],[12,1],[11],[32,15],[68,0,0,0,0,0,0,0,0],[97],[184],[11,"TYPESWITCH_end"],[252,3],[4,64],[16, builtin('__Date_now')],[34,14],[16, builtin('__ecma262_ToDateString')],[34,14],[15],[11],[32,0],[32,1],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[32,2],[32,3],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,4],[32,5],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,6],[32,7],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,8],[32,9],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,10],[32,11],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[32,12],[32,13],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,8,64],[98],[184],[160],[33,17],[68,0,0,0,0,0,0,0,0],[33,18],[32,17],[68,0,0,0,0,0,0,0,0],[97],[4,64],[16, builtin('__Date_now')],[33,14],[33,18],[5],[32,17],[68,0,0,0,0,0,0,240,63],[97],[4,64],[32,0],[33,19],[32,1],[33,20],[32,0],[32,1],[16, builtin('__Porffor_rawType')],[33,21],[68,0,0,0,0,0,0,0,0],[33,22],[32,21],[68,0,0,0,0,0,0,51,64],[97],[4,64],[32,19],[32,20],[16, builtin('__Porffor_date_read')],[33,14],[33,22],[5],[32,21],[68,0,0,0,0,0,128,80,64],[97],[32,21],[68,0,0,0,0,0,128,84,64],[97],[114],[4,64],[32,19],[32,20],[16, builtin('__Date_parse')],[33,14],[33,22],[5],[65,0],[32,19],[16, builtin('Number')],[33,22],[11],[11],[32,22],[65,0],[16, builtin('__ecma262_TimeClip')],[33,14],[33,18],[5],[65,0],[32,0],[16, builtin('Number')],[33,23],[65,0],[32,2],[16, builtin('Number')],[33,24],[68,0,0,0,0,0,0,240,63],[33,25],[32,17],[68,0,0,0,0,0,0,0,64],[100],[4,64],[65,0],[32,4],[16, builtin('Number')],[33,25],[11],[68,0,0,0,0,0,0,0,0],[33,26],[32,17],[68,0,0,0,0,0,0,8,64],[100],[4,64],[65,0],[32,6],[16, builtin('Number')],[33,26],[11],[68,0,0,0,0,0,0,0,0],[33,27],[32,17],[68,0,0,0,0,0,0,16,64],[100],[4,64],[65,0],[32,8],[16, builtin('Number')],[33,27],[11],[68,0,0,0,0,0,0,0,0],[33,28],[32,17],[68,0,0,0,0,0,0,20,64],[100],[4,64],[65,0],[32,10],[16, builtin('Number')],[33,28],[11],[68,0,0,0,0,0,0,0,0],[33,29],[32,17],[68,0,0,0,0,0,0,24,64],[100],[4,64],[65,0],[32,12],[16, builtin('Number')],[33,29],[11],[32,23],[65,0],[16, builtin('__ecma262_MakeFullYear')],[33,14],[34,30],[65,0],[32,24],[65,0],[32,25],[65,0],[16, builtin('__ecma262_MakeDay')],[34,14],[32,26],[65,0],[32,27],[65,0],[32,28],[65,0],[32,29],[65,0],[16, builtin('__ecma262_MakeTime')],[34,14],[16, builtin('__ecma262_MakeDate')],[33,14],[34,31],[65,0],[16, builtin('__ecma262_UTC')],[34,14],[16, builtin('__ecma262_TimeClip')],[33,14],[33,18],[11],[11],[65,8],[16, builtin('__Porffor_allocateBytes')],[183],[34,32],[65,19],[32,18],[65,0],[16, builtin('__Porffor_date_write')],[33,14],[26],[32,32],[65,19],[15]],
1288
1279
  params: [124,127,124,127,124,127,124,127,124,127,124,127,124,127],
1289
1280
  typedParams: true,
1290
1281
  returns: [124,127],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "porffor",
3
3
  "description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
4
- "version": "0.18.11+3744bea72",
4
+ "version": "0.18.12+a6989c4b7",
5
5
  "author": "CanadaHonk",
6
6
  "license": "MIT",
7
7
  "scripts": {},
package/runner/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from 'node:fs';
3
- globalThis.version = '0.18.11+3744bea72';
3
+ globalThis.version = '0.18.12+a6989c4b7';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {