34 Commits

Author SHA1 Message Date
Daniel Wirtz
252b843c4b
General cleanup (#525)
* Cleans up and trims the overly large builtins file by ~1600 lines
* Properly propagate inline assembler-like argument types
* Use https in examples
* Reformat README
2019-03-08 14:24:48 +01:00
Daniel Wirtz
4e1bba3a24
Use Binaryen's function signature naming scheme (#522) 2019-03-01 00:01:23 +01:00
Max Graey
aad263e670 Add isArrayLike builtin (#453) 2019-02-27 21:47:52 +01:00
Daniel Wirtz
e8b0767143
Infer function expressions in matching contexts (#514)
* legalizes omitting types on function expressions within function type contexts
* legalizes omitting any number of arguments
2019-02-27 21:45:36 +01:00
Daniel Wirtz
f318d68383
Add isFunction and isNullable builtins (#504) 2019-02-22 01:11:05 +01:00
Daniel Wirtz
0c64f21250
Rework resolver (#489)
* Rework IR and resolver to use nested lookup tables
* Integrate types into IR
* Make components prefer IR, slimmed down AST
* Implement `export *`
* Add `@lazy` annotation and remove `--noTreeShaking`
* Add `@start` annotation and remove magic `main`
* Related refactoring, cleanup and docs
2019-02-21 00:11:22 +01:00
Daniel Wirtz
2f1a6c44ce
Add SIMD prerequisites (#469) 2019-02-07 15:26:26 +01:00
dcode
cd1cfe6957 Update Binaryen to latest and rebuild dist files 2019-02-05 17:12:10 +01:00
Daniel Wirtz
2bdc2a72f1
Use stack IR when emitting text format (#312) 2018-11-08 08:04:24 +01:00
Daniel Wirtz
f7c734789e
Update Binaryen to latest; Various fixes 2018-10-11 08:49:08 +02:00
dcodeIO
16d1a833dd Always add a null function at table index zero
This allows function references (a table index internally) to be nullable
2018-09-17 01:48:35 +02:00
dcodeIO
631478c7c9 Rework static memory segment creation; Fix stdlib gc hooks not marking own fields; Align everything to 8 bytes that might be touched by GC 2018-08-04 00:36:59 +02:00
Daniel Wirtz
dc0f271fc2
Initial GC integration (#196) 2018-08-02 18:23:02 +02:00
dcodeIO
34839353fd Inline isNaN and isFinite
Looking at our existing tests it seems that inlining these can be performed by reusing locals most of the time, and sometimes enables erasing quite a bit of unnecessary code when optimizing.
2018-07-19 04:12:40 +02:00
dcodeIO
26e46f6f86 Reintroduce builtin decorator so these can appear anywhere in stdlib again
Avoids wrapping an undocumented function within 'memory.size' for example.
2018-07-19 02:10:04 +02:00
dcodeIO
a1b75b69b7 Rename memory instructions; Rework constant handling 2018-07-18 23:49:32 +02:00
dcodeIO
3b0fd9aac2 Implement isDefined and isConstant builtins 2018-07-14 16:42:00 +02:00
dcodeIO
c6ec5e2832 Utilize Binaryen's -O4
When specifying -O3 or -Oz, asc now automatically increases the optimize level to 4, then including costly non-LLVM optimizations for blocky code, in turn achieving similar results as an LLVM-based generator.
2018-06-09 14:05:33 +02:00
dcodeIO
cea69a6de1 Unify operator overloading and reuse arguments where possible; Update Binaryen; Update dist files 2018-06-05 23:09:08 +02:00
dcodeIO
7ad13f9d65 Add a 'call_indirect' builtin to emit arbitrary calls (might trap at runtime); Optimize 'for' loop compilation a bit 2018-05-25 15:59:17 +02:00
dcodeIO
73417a9a06 Move 'abort' out of builtins and make it overridable
Now defaults to 'env.abort' as imported in lib/env.ts, but can be overridden through '--use abort=someThingElseOrNothingAtAll'
2018-05-21 18:48:29 +02:00
dcodeIO
6c0a5c47d9 Update Binaryen and take care of WebAssembly/binaryen#1547 2018-05-14 16:55:55 +02:00
dcodeIO
2aea14b518 Add more inline-assembler-ish builtins; Update Binaryen 2018-04-27 19:12:25 +02:00
dcodeIO
06f99406be Experimenting with inline-assembler-ish explicit builtins
Starting with explicit loads and stores as part of the respective type namespaces. Might become handy for use with portable code, because these can be polyfilled, while load<T> and store<T> can't.
2018-04-27 00:08:41 +02:00
Max Graey
a15457d8b9 Simplify isFinite & isNaN (#78) 2018-04-18 15:14:24 +02:00
dcodeIO
4929fca363 Move some numeric builtins to stdlib; Minor refactoring 2018-04-17 02:50:38 +02:00
dcodeIO
748e811137 Proper isNaN/isFinite without a temp. local 2018-04-12 20:40:00 +02:00
dcodeIO
dcc0e284fb Make type checking builtins also accept just a type argument 2018-04-07 23:31:36 +02:00
Daniel Wirtz
164f134053
Even more math (#56)
Remaining implementations of JavaScript's Math functions (except sin/cos/tan), both double (Math) and single (Mathf) precision, ported from musl incl. tests from libc-test, plus some changes to match JS semantics. Also binds fmod to `%` and pow to `**`.
2018-03-30 17:25:54 +02:00
dcodeIO
c80bf35747 Move fmod/fmodf to builtins and bind them to the '%' operator 2018-03-24 18:39:20 +01:00
dcodeIO
664f2a1c0d Add offsetof<T> builtin; Put a function's trampoline into the function table if a it has optional parameters; TypedArray scaffolding 2018-03-24 00:38:49 +01:00
dcodeIO
83e96892f2 Statically eliminate unnecessary branches in generic contexts
In order to use the new compile time type checks in generics, untaken branches must be skipped because these might be invalid.
2018-03-17 14:40:58 +01:00
dcodeIO
2ed9fac171 Initial compile time type check builtins 2018-03-17 12:54:37 +01:00
dcodeIO
e50a23bf75 Rename wast to wat 2018-02-17 11:09:22 +01:00