porffor 0.16.0-8107e135a → 0.16.0-97bb4f33b

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 CHANGED
@@ -26,7 +26,7 @@ You can also swap out `node` in the alias to use another runtime like Deno (`den
26
26
 
27
27
  ### Precompile
28
28
 
29
- **If you update any file inside `compiler/builtins` you will need to do this for it to update inside Porffor otherwise your changes will have no effect.** Run `./porf precompile` to precompile. It may error during this, if so, you might have an error in your code or there could be a compiler error with Porffor (feel free to ask for help as soon as you encounter any errors with it).
29
+ **If you update any file inside `compiler/builtins` you will need to do this for it to update inside Porffor otherwise your changes will have no effect.** Run `node compiler/precompile.js` to precompile. It may error during this, if so, you might have an error in your code or there could be a compiler error with Porffor (feel free to ask for help as soon as you encounter any errors with it).
30
30
 
31
31
  <br>
32
32
 
@@ -240,13 +240,7 @@ export default (funcs, globals, tags, pages, data, flags, noTreeshake = false) =
240
240
 
241
241
  const dataSection = data.length === 0 ? [] : createSection(
242
242
  Section.data,
243
- encodeVector(data.map(x => {
244
- // type: active
245
- if (x.offset != null) return [ 0x00, Opcodes.i32_const, ...signedLEB128(x.offset), Opcodes.end, ...encodeVector(x.bytes) ];
246
-
247
- // type: passive
248
- return [ 0x01, ...encodeVector(x.bytes) ];
249
- }))
243
+ encodeVector(data.map(x => [ 0x00, Opcodes.i32_const, ...signedLEB128(x.offset), Opcodes.end, ...encodeVector(x.bytes) ]))
250
244
  );
251
245
 
252
246
  const dataCountSection = data.length === 0 ? [] : createSection(
@@ -722,10 +722,12 @@ export const __Porffor_date_allocate = (): Date => {
722
722
  const hack: bytestring = '';
723
723
 
724
724
  if (hack.length == 0) {
725
- hack.length = Porffor.wasm`memory.size 0
726
- i32.const 1
725
+ hack.length = Porffor.wasm`i32.const 1
727
726
  memory.grow 0
728
727
  drop
728
+ memory.size 0
729
+ i32.const 1
730
+ i32.sub
729
731
  i32.const 65536
730
732
  i32.mul
731
733
  i32.from_u`;
@@ -2,10 +2,12 @@ import type {} from './porffor.d.ts';
2
2
 
3
3
  // dark wasm magic for dealing with memory, sorry.
4
4
  export const __Porffor_allocate = (): number => {
5
- Porffor.wasm`memory.size 0
6
- i32.const 1
5
+ Porffor.wasm`i32.const 1
7
6
  memory.grow 0
8
7
  drop
8
+ memory.size 0
9
+ i32.const 1
10
+ i32.sub
9
11
  i32.const 65536
10
12
  i32.mul
11
13
  i32.from_u