Commit Graph

383 Commits

Author SHA1 Message Date
Nikolay Nikolov
968e23546c * fixed second_int_to_bool for cbool types for WebAssembly 2021-10-01 04:20:02 +03:00
Nikolay Nikolov
188a21bbfd * fixed 'not(boolean64)' for WebAssembly 2021-10-01 03:01:55 +03:00
Nikolay Nikolov
c6a549eb48 * int64/boolean64 fix in twasmtypeconvnode.second_int_to_bool 2021-10-01 02:57:04 +03:00
Nikolay Nikolov
2e5b895d70 * fixed WebAssembly code generation for 'if boolean64 then ... else ...' 2021-10-01 02:47:08 +03:00
Nikolay Nikolov
4d571a1928 * fixed code generation for 'boolean64 and/or boolean64' for WebAssembly 2021-10-01 02:43:55 +03:00
Nikolay Nikolov
91d8009b53 + implemented round(real) for WebAssembly via the fXX.nearest and i64.trunc_fXX_s instructions 2021-09-29 05:27:27 +03:00
Nikolay Nikolov
835bc62e2a + implemented trunc(real) for WebAssembly via the i64.trunc_f32_s and i64.trunc_f64_s instructions 2021-09-29 05:07:43 +03:00
Nikolay Nikolov
f6b4a54f7d * fixed output of 32-bit floating point constants in the llvm-mc asm output 2021-09-29 04:57:19 +03:00
Nikolay Nikolov
d84a7d1bde + implemented int(real) for WebAssembly via the f32.trunc and f64.trunc instructions 2021-09-29 04:19:10 +03:00
Nikolay Nikolov
8822be8a1f + implemented abs(real) for WebAssembly via the f32.abs and f64.abs instructions 2021-09-29 04:04:03 +03:00
Nikolay Nikolov
f42817d1a2 * fixed opcode generation for the f32.const in the WebAssembly internal asm 2021-09-29 03:56:13 +03:00
Nikolay Nikolov
95243ed6ed + implemented sqrt via the f32.sqrt and f64.sqrt instructions 2021-09-29 03:48:31 +03:00
Nikolay Nikolov
6e6c946e0f * the fpc_Catches result test code was inverted 2021-09-29 00:17:17 +03:00
Nikolay Nikolov
99dbbcadcd + generate functype directives for all functions in all used units, regardless
of whether they have paraloc info created. This fixes linking of WebAssembly
  programs that declare their own classes, because that causes the compiler to
  generate a VMT, containing references to virtual methods, and these don't
  necessarily have paraloc info (if they're not called from within the program)
2021-09-29 00:04:23 +03:00
Nikolay Nikolov
6e7f0744ca + implemented the 'on' node for WebAssembly in native exceptions mode 2021-09-28 23:55:10 +03:00
Nikolay Nikolov
0e647a073e + override the 'on' node for WebAssembly 2021-09-28 21:23:49 +03:00
Nikolay Nikolov
ef738f01cf * fixed warning 2021-09-28 20:39:47 +03:00
Nikolay Nikolov
f2abce7ea5 + initial implementation of try..except..end in wasm native exceptions mode.
The 'on' statements are not implemented yet.
2021-09-28 20:23:27 +03:00
Nikolay Nikolov
99e449eaa1 * decblock moved after end_try, instead of after catch 2021-09-28 04:11:16 +03:00
Nikolay Nikolov
0c3e179652 - get rid of fpc_PushExceptAddr and fpc_PopAddrStack entirely, when compiling in
wasm native exceptions mode - these helper routines aren't necessary in this
  mode
2021-09-28 03:59:38 +03:00
Nikolay Nikolov
c9fd115ec5 * fixes to the try..finally code generation in wasm native exceptions mode 2021-09-28 03:29:45 +03:00
Nikolay Nikolov
cdf1ceca76 * emit a weak symbol for the exception tag, since that's what the LLVM linker
wants to treat them as shared between .o files
2021-09-28 02:52:40 +03:00
Nikolay Nikolov
f701d2f294 + support in_wasm32_throw_fpcexception in twasminlinenode.pass_typecheck_cpu 2021-09-28 01:11:01 +03:00
Nikolay Nikolov
ec0bdfbdd9 * fill exceptstate variables and update flowcontrol in
twasmexceptionstatehandler_nativeexceptions.new_exception
- removed the TODO comment, generated in the asm output by
  twasmexceptionstatehandler_nativeexceptions.free_exception
2021-09-28 00:19:13 +03:00
Nikolay Nikolov
b463f2a141 + added support for exception tags and for the 'throw' and 'catch' instructions
in the wasm internal assembler and object writer
2021-09-27 21:44:09 +03:00
Nikolay Nikolov
82b6450f19 + introduced the AT_WASM_EXCEPTION_TAG asm symbol type, use that for specifying
the parameter to the 'throw' and 'catch' instructions
2021-09-27 17:49:30 +03:00
Nikolay Nikolov
e0ad427b6c + introduced the FPC_EXCEPTION_TAG_SYM string constant 2021-09-27 17:38:28 +03:00
Nikolay Nikolov
b46c010f82 + also support immutable wasm globals in the wasm assembler writer (both internal and external) 2021-09-27 05:40:26 +03:00
Nikolay Nikolov
2bce4d36db + proper support for WASM globals in the internal object writer - emit
relocations, generate a Global section, if they are declared in the object
  file, etc.
2021-09-27 04:24:49 +03:00
Nikolay Nikolov
812732cb6a + introduced the AT_WASM_GLOBAL asm symbol type 2021-09-27 02:52:29 +03:00
Nikolay Nikolov
8226233aa3 * introduced the tai_globaltype asm directive, use that to declare the stack
pointer global symbol
2021-09-27 02:39:43 +03:00
Nikolay Nikolov
a1c8e92904 * emit a tai_tagtype for __FPC_exception instead of hardcoding the asm output
directly when wasm native exceptions are enabled
2021-09-27 00:33:57 +03:00
Nikolay Nikolov
10db5ea5dc + implemented the 'delegate' and the 'rethrow' instructions in the wasm internal assembler 2021-09-26 23:58:21 +03:00
Nikolay Nikolov
6fb4b9b7dd + support the 'try' instruction in the wasm internal assembler 2021-09-26 23:50:02 +03:00
Nikolay Nikolov
db843287a2 + generate funcdef for external procs, that don't have an import dll 2021-09-26 20:37:34 +03:00
Nikolay Nikolov
346b57e238 * tai_impexp renamed tai_export_name
* ait_importexport renamed ait_export_name
2021-09-26 18:35:10 +03:00
Nikolay Nikolov
2940d0f45f - removed unused constructor of tai_impexp, as well as unused member variable extmodule 2021-09-26 18:29:28 +03:00
Nikolay Nikolov
cb3ac37fb3 * fixed i32.const with large unsigned 32-bit const parameter (>2GB) 2021-09-26 09:50:35 +03:00
Nikolay Nikolov
92fb1d2564 * fixed warning 2021-09-26 08:25:22 +03:00
Nikolay Nikolov
9e0c028142 + support load/store with op_const 2021-09-26 08:15:04 +03:00
Nikolay Nikolov
7e9607a62c * fixed warning 2021-09-26 08:07:21 +03:00
Nikolay Nikolov
2e491d1ffa + implemented the br and br_if instructions in the wasm internal asm 2021-09-26 07:58:59 +03:00
Nikolay Nikolov
ca70cb05a7 * fixed warning 2021-09-26 07:54:20 +03:00
Nikolay Nikolov
07b71ac6ce * generate an internal error instead of warning for unsupported opcodes
in the internal asm writer for wasm
2021-09-26 07:48:31 +03:00
Nikolay Nikolov
d7b141d70e + implemented the if, loop and else instructions 2021-09-26 07:45:14 +03:00
Nikolay Nikolov
6133affad6 + implemented the f32.const and f64.const instructions in the wasm
internal asm
2021-09-26 07:19:36 +03:00
Nikolay Nikolov
0486caeb91 * generate an internal error, instead of warning for i32.const and
i64.const instructions with an unknown parameter
2021-09-26 06:58:46 +03:00
Nikolay Nikolov
81b8574bfd + implemented all the load/store instructions in the wasm internal asm
writer (previously, only i32.load and i32.store were implemented)
2021-09-26 06:49:51 +03:00
Nikolay Nikolov
7f5250bf46 + implemented support for R_WASM_TABLE_INDEX_SLEB relocations 2021-09-26 06:22:41 +03:00
Nikolay Nikolov
9fa2e2934b + support the call_indirect instruction and the R_WASM_TYPE_INDEX_LEB
relocation that it requires in the internal wasm object writer
2021-09-26 06:03:18 +03:00