porffor 0.47.5 → 0.47.6

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/README.md CHANGED
@@ -82,107 +82,6 @@ Rhemyn is Porffor's own regex engine; it compiles literal regex to Wasm bytecode
82
82
  ### 2c
83
83
  2c is Porffor's own Wasm -> C compiler, using generated Wasm bytecode and internal info to generate specific and efficient/fast C code. Little boilerplate/preluded code or required external files, just for CLI binaries (not like wasm2c very much).
84
84
 
85
- ## Supported
86
- See [optimizations](#optimizations) for opts implemented/supported.
87
-
88
- ### Proposals
89
- These include some early (stage 1/0) and/or dead (last commit years ago) proposals but *I* think they are pretty neat, so.
90
-
91
- #### `Math` proposals (stage 1/0)
92
-
93
- - [`Math.clamp` Proposal](https://github.com/Richienb/proposal-math-clamp): `Math.clamp` (stage 0 - last commit april 2023)
94
- - [`Math` Extensions Proposal](https://github.com/rwaldron/proposal-math-extensions): `Math.scale`, `Math.radians`, `Math.degrees`, `Math.RAD_PER_DEG`, `Math.DEG_PER_RAD` (stage 1 - last commit september 2020)
95
- - [`Math.signbit` Proposal](https://github.com/tc39/proposal-Math.signbit): `Math.signbit` (stage 1 - last commit february 2020)
96
-
97
- ### Language
98
-
99
- - Number literals
100
- - Declaring functions
101
- - Calling functions
102
- - `return`
103
- - Basic declarations (`let`/`const`/`var`)
104
- - Some basic integer operators (`+-/*%`)
105
- - Some basic integer bitwise operators (`&|`)
106
- - Equality operators (`==`, `!=`, etc)
107
- - GT/LT operators (`>`, `<`, `>=`, etc)
108
- - Some unary operators (`!`, `+`, `-`)
109
- - Logical operators (`&&`, `||`)
110
- - Declaring multiple variables in one (`let a, b = 0`)
111
- - Array destructuring (`let [a, ...b] = foo`)
112
- - Global variables (`var`/none in top scope)
113
- - Booleans
114
- - `if` and `if ... else`
115
- - Anonymous functions
116
- - Setting functions using vars (`const foo = function() { ... }`)
117
- - Arrow functions
118
- - `undefined`/`null`
119
- - Update expressions (`a++`, `++b`, `c--`, etc)
120
- - `for` loops (`for (let i = 0; i < N; i++)`, etc)
121
- - Basic objects (no prototypes)
122
- - `console.log`
123
- - `while` loops
124
- - `break` and `continue`
125
- - Named export funcs
126
- - IIFE support
127
- - Assignment operators (`+=`, `-=`, `>>=`, `&&=`, etc)
128
- - Conditional/ternary operator (`cond ? a : b`)
129
- - Recursive functions
130
- - Bare returns (`return`)
131
- - `throw` (literals only, hack for `new Error`)
132
- - Basic `try { ... } catch { ... }` (no error given)
133
- - Calling functions with non-matching arguments (eg `f(a, b); f(0); f(1, 2, 3);`)
134
- - `typeof`
135
- - Runtime errors for undeclared variables (`ReferenceError`), not functions (`TypeError`)
136
- - Array creation via `[]` (eg `let arr = [ 1, 2, 3 ]`)
137
- - Array member access via `arr[ind]` (eg `arr[0]`)
138
- - String literals (`'hello world'`)
139
- - String member (char) access via `str[ind]` (eg `str[0]`)
140
- - String concat (`+`) (eg `'a' + 'b'`)
141
- - Truthy/falsy (eg `!'' == true`)
142
- - String comparison (eg `'a' == 'a'`, `'a' != 'b'`)
143
- - Nullish coalescing operator (`??`)
144
- - `for...of` (arrays and strings)
145
- - `for...in`
146
- - Array member setting (`arr[0] = 2`, `arr[0] += 2`, etc)
147
- - Array constructor (`Array(5)`, `new Array(1, 2, 3)`)
148
- - Labelled statements (`foo: while (...)`)
149
- - `do...while` loops
150
- - Optional parameters (`(foo = 'bar') => { ... }`)
151
- - Rest parameters (`(...foo) => { ... }`)
152
- - `this`
153
- - Constructors (`new Foo`)
154
- - Classes (`class A {}`)
155
- - Await (`await promise`)
156
-
157
- ### Built-ins
158
-
159
- - `NaN` and `Infinity`
160
- - `isNaN()` and `isFinite()`
161
- - Most of `Number` (`MAX_VALUE`, `MIN_VALUE`, `MAX_SAFE_INTEGER`, `MIN_SAFE_INTEGER`, `POSITIVE_INFINITY`, `NEGATIVE_INFINITY`, `EPSILON`, `NaN`, `isNaN`, `isFinite`, `isInteger`, `isSafeInteger`)
162
- - Most `Math` funcs (`sqrt`, `abs`, `floor`, `sign`, `round`, `trunc`, `clz32`, `fround`, `random`, `exp`, `log`, `log2`, `log10`, `pow`, `expm1`, `log1p`, `sqrt`, `cbrt`, `hypot`, `sin`, `cos`, `tan`, `sinh`, `cosh`, `tanh`, `asinh`, `acosh`, `atanh`, `asin`, `acos`, `atan`, `atan2`)
163
- - Basic `globalThis` support
164
- - Basic `Boolean` and `Number`
165
- - Basic `eval` for literals
166
- - `Math.random()` using self-made xorshift128+ PRNG
167
- - Some of `performance` (`now()`, `timeOrigin`)
168
- - Most of `Array.prototype` (`at`, `push`, `pop`, `shift`, `fill`, `slice`, `indexOf`, `lastIndexOf`, `includes`, `with`, `reverse`, `toReversed`, `forEach`, `filter`, `map`, `find`, `findLast`, `findIndex`, `findLastIndex`, `every`, `some`, `reduce`, `reduceRight`, `join`, `toString`)
169
- - Most of `Array` (`of`, `isArray`)
170
- - Most of `String.prototype` (`at`, `charAt`, `charCodeAt`, `toUpperCase`, `toLowerCase`, `startsWith`, `endsWith`, `indexOf`, `lastIndexOf`, `includes`, `padStart`, `padEnd`, `substring`, `substr`, `slice`, `trimStart`, `trimEnd`, `trim`, `toString`, `big`, `blink`, `bold`, `fixed`, `italics`, `small`, `strike`, `sub`, `sup`, `trimLeft`, `trimRight`, `trim`)
171
- - Some of `crypto` (`randomUUID`)
172
- - `escape`
173
- - `btoa`
174
- - Most of `Number.prototype` (`toString`, `toFixed`, `toExponential`)
175
- - `parseInt`
176
- - Spec-compliant `Date`
177
- - WIP typed arrays (`Uint8Array`, `Int32Array`, etc)
178
- - Synchronous `Promise`
179
-
180
- ### Custom
181
-
182
- - Supports i32, i64, and f64 for valtypes
183
- - Intrinsic functions (see below)
184
- - Inlining wasm via ``asm`...``\` "macro"
185
-
186
85
  ## Versioning
187
86
  Porffor uses a unique versioning system, here's an example: `0.18.2+2aa3f0589`. Let's break it down:
188
87
  1. `0` - major, always `0` as Porffor is not ready yet
@@ -193,33 +92,6 @@ Porffor uses a unique versioning system, here's an example: `0.18.2+2aa3f0589`.
193
92
  ## Performance
194
93
  *For the features it supports most of the time*, Porffor is *blazingly fast* compared to most interpreters and common engines running without JIT. For those with JIT, it is usually slower by default, but can catch up with compiler arguments and typed input, even more so when compiling to native binaries.
195
94
 
196
- ## Optimizations
197
- Mostly for reducing size. I do not really care about compiler perf/time as long as it is reasonable. We do not use/rely on external opt tools (`wasm-opt`, etc), instead doing optimization inside the compiler itself creating even smaller code sizes than `wasm-opt` itself can produce as we have more internal information.
198
-
199
- ### Traditional opts
200
- - Inlining functions (WIP, limited)
201
- - Inline const math ops
202
- - Tail calls (behind flag `--tail-call`)
203
-
204
- ### Wasm transforms
205
- - `local.set`, `local.get` -> `local.tee`
206
- - `i32.const 0`, `i32.eq` -> `i32.eqz`
207
- - `i64.extend_i32_s`, `i32.wrap_i64` -> ``
208
- - `f64.convert_i32_u`, `i32.trunc_sat_f64_s` -> ``
209
- - `return`, `end` -> `end`
210
- - Change const, convert to const of converted valtype (eg `f64.const`, `i32.trunc_sat_f64_s` -> `i32.const`)
211
- - Remove some redundant sets/gets
212
- - Remove unneeded single just used vars
213
- - Remove unneeded blocks (no `br`s inside)
214
- - Remove unused imports
215
- - Use data segments for initing arrays/strings
216
- - (Likely more not documented yet, todo)
217
-
218
- ### Wasm module
219
- - Type cache/index (no repeated types)
220
- - No main func if empty (and other exports)
221
- - No tags if unused/optimized out
222
-
223
95
  ## Test262
224
96
  Porffor can run Test262 via some hacks/transforms which remove unsupported features whilst still doing the same asserts (eg simpler error messages using literals only). It currently passes >14% (see latest commit desc for latest and details). Use `node test262` to test, it will also show a difference of overall results between the last commit and current results.
225
97
 
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.47.5",
4
+ "version": "0.47.6",
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.47.5';
3
+ globalThis.version = '0.47.6';
4
4
 
5
5
  // deno compat
6
6
  if (typeof process === 'undefined' && typeof Deno !== 'undefined') {