Commit Graph

63471 Commits

Author SHA1 Message Date
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
florian
7ce1a7c6a0 * x86_64-linux doesn't need .data.rel.ro either 2021-09-28 23:13:35 +02: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
Michaël Van Canneyt
93b3315691 * Parse cookies also when setting variable based on name 2021-09-28 10:15:58 +02:00
Michaël Van Canneyt
bfe3afbc62 * Add error check 2021-09-28 10:14:18 +02:00
Nikolay Nikolov
99e449eaa1 * decblock moved after end_try, instead of after catch 2021-09-28 04:11:16 +03:00
Nikolay Nikolov
3836b0be04 * longjmp in fpc_reraise changed to a throw instruction intrinsic in wasm native exceptions mode 2021-09-28 04:02:52 +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
91f0f1a86c * don't include except.inc if wasm32 native exception is turned on, instead
replace it with except_native.inc
2021-09-28 03:46:30 +03:00
Nikolay Nikolov
73bc8edef3 + RTL support for raising exceptions in native wasm exceptions mode 2021-09-28 03:31:04 +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
21fd8cd5d3 * updated ppudump with the new asm symbol types and binding types 2021-09-28 03:01:09 +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
J. Gareth "Curious Kit" Moreton
15b2f9a7b1 Changed get_volatile_registers_mm to not return XMM16 to XMM31 when not under AVX512 2021-09-27 18:47:03 +00: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
7b31549119 * the data section is now only written by the internal wasm object writer, when
there are data segments in the module
2021-09-27 05:17:20 +03:00
Nikolay Nikolov
e85aff2b96 * combined TWasmObjSymbol.ImportIndex and .FuncIndex into just .FuncIndex,
because there's no point in having them separate, and the name ImportIndex
  is misleading, as there are multiple import indices (they are separate for
  functions, globals, tables, memories, etc.)
2021-09-27 04:53:35 +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
5ad2d47e23 * track wasm global types in the internal object writer 2021-09-27 03:03:57 +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
0bb781c928 * omit writing the export section if there are no exported functions from
the module. This reduces object file size slightly for modules without
  exports.
2021-09-26 23:14:52 +03:00
Nikolay Nikolov
d37117c460 * use an incrementing counter variable to determine the numbers for the code
and data section, so they can be used in the relocation section, without
  hardcoding them as constants. This will automatically adjust the numbers
  when we add more sections, or when we make writing some of the sections
  optional.
2021-09-26 23:10:55 +03:00
Nikolay Nikolov
77b898fe45 * use objsym.size to determine the code size of the function (instead of
writing until the end of the section) in the wasm internal object writer.
  This removes the extra padding of 'unreachable' instructions at the end of
  each function (which are zeroes, added for alignment - they are harmless,
  but are unnecessary and cause a slight increase of the size of the
  resulting binaries), after the final 'return' instruction of the function.
2021-09-26 22:21:34 +03:00
Nikolay Nikolov
bc76487b87 + enable the WebAssembly internal assembler and object writer 2021-09-26 20:46:47 +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
2102fbdc97 - removed debug writelns from the wasm internal object writer 2021-09-26 20:13:35 +03:00
Nikolay Nikolov
99c84da071 + generate the export section in the wasm internal obj writer 2021-09-26 20:02:48 +03:00
Nikolay Nikolov
1c8579da2e * simplified and integrated the WriteImportExport procedure into the case
statement. Use similar statements to write the asm code for the export_name,
  like we use for the import_name directive.
2021-09-26 18:40:49 +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
J. Gareth "Kit" Moreton
79f60923ba Bug fix to XMM block move optimisation 2021-09-26 14:09:29 +00:00
Nikolay Nikolov
abf831c430 + fixed the addend in the relocations that point to data 2021-09-26 11:12:08 +03:00
florian
2d1ebe4cb3 + re-added accidently removed internal error 2021-09-26 09:50:30 +02:00
Nikolay Nikolov
c881d05793 * fixed bug in the code, generated for the RELOC_FUNCTION_INDEX_LEB
relocation
2021-09-26 10:29:17 +03:00