Commit Graph

31 Commits

Author SHA1 Message Date
Nikolay Nikolov
e74797d411 * replaced several internal errors, related to the WebAssembly labels
resolution with more meaningful error messages, in order to ease the
  debugging of the compiler. Based on patch by Pierre.
2022-05-24 11:44:15 +03:00
Nikolay Nikolov
7f1050464a + added 'else' tracking for the if..end_if blocks 2021-10-23 11:56:25 +03:00
Nikolay Nikolov
7bef4d827d * keep track of the block stack, when resolving labels and check whether the
blocks match (i.e. block..end_block, if..end_if, loop..end_loop, try..end_try)
2021-10-23 11:25:44 +03:00
Nikolay Nikolov
12a2c56461 - removed thlcgwasm.incblock, .decblock and br_blocks, as branching is now done
entirely with labels
2021-10-22 17:42:29 +03:00
Nikolay Nikolov
6fe647ee3d * moved the default procedure CurrRaiseLabel to the end of the procedure, not
at the exit label. This fixes problems when using units with finalization
  code that contain classes with class destructors in branchful WebAssembly
  exceptions mode.
2021-10-22 13:54:55 +03:00
Nikolay Nikolov
470e77a572 + added sanity check when resolving labels to ensure we don't get any jumps with
negative nesting depth
2021-10-22 13:54:55 +03:00
Nikolay Nikolov
5a0956d805 * use WebAssembly asm labels for the raise branch instruction in branchful
exceptions mode
2021-10-22 13:54:55 +03:00
Nikolay Nikolov
4e3a6aa5a8 * match the label to the wider block, if it is adjacent to both the brevious
and the next instruction
2021-10-20 14:35:52 +03:00
Nikolay Nikolov
c96e203780 * moved the 'end_block' WebAssembly instruction before the 'exit' label right
before the procedure finalization code. This fixes compilation errors in
  procedures with implicit finalization code (e.g. for ansistring local vars,
  etc).
2021-10-20 14:35:52 +03:00
Nikolay Nikolov
703ae75ba6 * if a label cannot be associated with the previous block instruction, try
matching it with the next instruction
2021-10-20 14:35:51 +03:00
Nikolay Nikolov
9f077d4ac0 * leave unresolved branches in the asm output, when the compiler is compiled with -dEXTDEBUG 2021-10-20 14:35:51 +03:00
Nikolay Nikolov
b3a9c36cbb * fixed some warnings 2021-10-20 10:03:14 +03:00
Nikolay Nikolov
01dc62b127 + introduced the use of asm labels for WebAssembly. Resolve them in
tcpuprocinfo.postprocess_code. Use them when generating code for the
  'continue' label jumps.
2021-10-20 09:39:44 +03:00
Nikolay Nikolov
fab4ca449b * twasmexceptionstatehandler_nativeexceptions.handle_nested_exception and
twasmexceptionstatehandler_bfexceptions.handle_nested_exception should not be
  called, so now they cause an internal error
2021-10-05 07:54:57 +03:00
Nikolay Nikolov
5124ab2521 * cloned the WebAssembly native exceptions code generation and rtl support into
the branchful exceptions (which will be modified later, but we're using this
  as their starting point, because we can get a snapshot built, without compiler
  internal errors)
2021-10-05 00:37:20 +03:00
Nikolay Nikolov
6e6c946e0f * the fpc_Catches result test code was inverted 2021-09-29 00:17:17 +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
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
45e53ddc16 * cloned the WASM no exceptions mode code generation for try..finally blocks
for the native WASM exceptions mode. Eventually, it is going to be changed
  to support exceptions fully, and it's going to evolve separately, so this
  code is only used as a starting point
2021-09-17 21:01:00 +03:00
Nikolay Nikolov
848098c63b * improvements to the handling of try..finally in WebAssembly no exceptions
mode - even though exceptions aren't supported in this mode, the finally
  section is now executed in case of exit, break or continue
2021-09-17 15:54:03 +03:00
Nikolay Nikolov
2bcc8d65ff + introduced twasmexceptionstatehandler_nativeexceptions and
twasmexceptionstatehandler_jsexceptions
2021-09-17 13:12:34 +03:00
Nikolay Nikolov
3ca9475bde * twasmexceptionstatehandler renamed twasmexceptionstatehandler_noexceptions 2021-09-17 12:33:34 +03:00
nickysn
340a71d2bc * always keep the WebAssembly stack frame aligned on 16 bytes
git-svn-id: trunk@49179 -
2021-04-11 14:02:40 +00:00
nickysn
4d99fb3352 * allocate locals in a better way, so that we don't get 2 extra wasted locals per function
git-svn-id: branches/wasm@48330 -
2021-01-22 16:22:49 +00:00
nickysn
f99e74866d + dummy override of WebAssembly handle_nested_exception
git-svn-id: branches/wasm@48215 -
2021-01-19 19:20:02 +00:00
nickysn
2150d935cf + dummy override for WebAssembly free_exception
git-svn-id: branches/wasm@48214 -
2021-01-19 19:18:15 +00:00
nickysn
67909adcc3 + override tcgexceptionstatehandler for WASM and create a dummy new_exception
git-svn-id: branches/wasm@48196 -
2021-01-19 13:54:26 +00:00
nickysn
dc151465c5 * replace NR_LOCAL_FRAME_POINTER_REG with tcpuprocdef(current_procinfo.procdef).frame_pointer_ref in tcpuprocinfo.postprocess_code instead of inside the register allocator
git-svn-id: branches/wasm@47887 -
2020-12-29 05:52:36 +00:00
nickysn
35e83d5524 * group tai_local directives, so that they are output as a single directive with comma separated types
git-svn-id: branches/wasm@46714 -
2020-08-26 23:36:28 +00:00
nickysn
b3a4f160bc + insert tai_locals as a continuous block, next to each other
git-svn-id: branches/wasm@46713 -
2020-08-26 23:19:11 +00:00
nickysn
c9ee72b05a * the compiler/wasm directory renamed compiler/wasm32
git-svn-id: branches/wasm@46251 -
2020-08-05 14:19:18 +00:00