Commit Graph

64 Commits

Author SHA1 Message Date
7a8995b18b Properly inline getters; Simplify blocks when last statement returns 2018-06-22 15:26:59 +02:00
c74eed2bd8 Add initial std Symbol; Fix some type inference issues 2018-06-21 19:42:18 +02:00
dd4be7b693 Fix some map issues; Simplify internal ArrayBuffer API a bit 2018-06-20 15:51:47 +02:00
f69bccfe09 Add @operator.binary, @operator.prefix, @operator.postfix decorators for #124 2018-06-01 14:17:27 +02:00
113925fa7e Add a mechanism to hook into the compilation process with custom transforms, see #20
A custom transform is a node module that exports hooks called by the compiler on specific occasions, then being able to modify the intermediate results. Starting with 'afterParse' to modify the AST before compilation is performed.
2018-05-26 13:13:39 +02:00
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
ea0eb7f1a5 Add a simple UTF8 converter, i.e. for calling C++ APIs; Fix disabling 'abort' entirely 2018-05-21 23:14:47 +02:00
2aea14b518 Add more inline-assembler-ish builtins; Update Binaryen 2018-04-27 19:12:25 +02:00
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
6d6d1dddcf Improve inlining where locals can be aliased; Add a crude mechanism for explicit unchecked array accesses
The `unchecked` builtin should be handled with ultimate care and it would be a lot better if there'd be a mechanism doing this automatically.
2018-04-25 05:04:35 +02:00
391db28fe2 Always try to eliminate branches if tree-shaking is enabled 2018-04-24 23:11:11 +02:00
fac0fc59b5 Implement Array#map, Array#forEach, Array#filter, Array#reduceRight (#81) 2018-04-22 22:15:38 +02:00
9579086699 Add what we have for GC so far
Not functional yet, but might be good to have for discussing it.
2018-04-18 16:32:07 +02:00
623597c23a Make the transition to ArrayBuffer backed Arrays (#70)
* Traverse base classes when resolving overloads
* Implement preliminary TypedArray accessors
* Extract decorator flags from common flags to make space
* Add '**' overload
* Implement basic explicit inlining
* Support inlining of instance methods
* Reduce number of required locals when inlining
* Implement inlining of operator overloads
* Fix issues when inlining generic functions
2018-04-11 23:35:19 +02:00
dcc0e284fb Make type checking builtins also accept just a type argument 2018-04-07 23:31:36 +02:00
b7ef21950b Add String#repeat method (#67) 2018-04-07 18:59:26 +02:00
8770f7b548 New ArrayBuffer/TypedArray; Stdlib restructure; Fix importing stdlib in stdlib; Traverse constructors; Allow initialization of readonly instance fields in constructors 2018-04-07 03:27:22 +02:00
c45a35b1c1 Implement Array#sort (#57) 2018-04-04 00:42:23 +02:00
06198a3723 Rename lib prefix to '~lib' (parens aren't valid); Add built-in alignof<T>; Prepare for ArrayBufferView 2018-04-02 19:05:26 +02:00
3d1f181961 Add Mathf missed defs (#60) 2018-03-31 17:15:59 +02:00
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
e47a130771 More math 2018-03-26 23:46:41 +02:00
792202ac5a Add an option to alias global objects
This for example allows to switch the default 'Math' implementation a program will use. Uses 'NativeMath' by default.
2018-03-26 16:54:25 +02:00
e75d006d26 Implement Math/Mathf.pow 2018-03-26 03:50:06 +02:00
e26734ef90 Implement Math/Mathf.exp; Initial math test suite 2018-03-25 17:42:56 +02:00
710fcefd72 Add array methods: findIndex, reduce, some, every (#49) 2018-03-25 13:13:53 +02:00
c80bf35747 Move fmod/fmodf to builtins and bind them to the '%' operator 2018-03-24 18:39:20 +01:00
721d77012b Math scaffolding 2018-03-24 17:18:15 +01:00
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
4adb69f73a Binary expression operator overloads for +/==; Check allocation flow in ternary expressions; Cache empty array buffers; Sealed decorator for non-derivable internals 2018-03-23 12:45:29 +01:00
9cc0fcd611 Initial ArrayBuffer implementation; Conditional allocation within constructors; Explicit constructor return values 2018-03-23 01:47:01 +01:00
49f4d3dff1 Eliminate @builtin decorator for compatibility with TS 2018-03-21 16:29:08 +01:00
8c1847b316 Properly handle 'void' return type when checking signature compatibility 2018-03-21 01:16:46 +01:00
477669d7a3 Add min. normalized positive value (MIN_POSITIVE_VALUE) for floats (#50) 2018-03-21 01:06:56 +01:00
0fef69e445 Set up documentation generation 2018-03-19 01:12:18 +01:00
5eb10d404f Document the purpose of most files 2018-03-17 23:41:48 +01:00
162096bcd6 Add Array#includes and improve compatibility of Array#indexOf (#41) 2018-03-17 17:02:15 +01:00
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
2ed9fac171 Initial compile time type check builtins 2018-03-17 12:54:37 +01:00
9ef8b162a9 Also lint stdlib 2018-02-25 23:21:32 +01:00
de1c4b3da5 Add bswap/bswap16 post MVP polyfills (#34) 2018-02-19 12:35:28 +01:00
ad92d91f01 Move built-in declarations to actual sources; Remove declaration is null checks; Resolve calls 2018-02-09 02:31:48 +01:00
3924aa96ae Fun fact: Can even implement parseInt/I32/I64 using generics, see #19 2018-01-30 06:05:35 +01:00
ab5a938ea0 parseInt compatibility layer around parseI64, see #19 2018-01-30 01:26:38 +01:00
1b0ed61072 Field initializers and constructors 2018-01-28 15:13:31 +01:00
de066fc128 Preliminary strings
While not well-wrought, it's at least possible now to log some stuff when debugging
2018-01-27 05:35:14 +01:00
2fa7fc7885 Take advantage of smaller integer load and store ops 2018-01-23 15:44:25 +01:00
a257b6e529 Load/store constant offset utility 2018-01-21 16:34:50 +01:00
f2ba4b4a76 Filler implementation for std Set 2018-01-15 00:08:06 +01:00
49d29fc9f2 More std array 2018-01-14 21:17:43 +01:00