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
bb30958665
+ wrap block nodes with exit in a_block..a_end_block instructions. This fixes
...
'exit' in inlined procedures on the WebAssembly target.
2021-10-20 14:35:51 +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
1ce2fb8a4a
* use WebAssembly asm labels for generating code for the 'exit' statement
2021-10-20 14:35:51 +03:00
Nikolay Nikolov
dc9090e67f
* fixed some more warnings
2021-10-20 10:23:02 +03:00
Nikolay Nikolov
b3a9c36cbb
* fixed some warnings
2021-10-20 10:03:14 +03:00
Nikolay Nikolov
0662a0bd44
+ use WebAssembly asm labels for the code generation of 'break' statements as well
2021-10-20 09:59:54 +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
0da5d57c1e
* replaced the 'if br end_if' sequence with the 'br_if' instruction, when
...
generating WebAssembly code for try..finally blocks (in all exception modes)
2021-10-14 14:19:13 +03:00
Nikolay Nikolov
dcae87bd52
+ support cdecl and stdcall on the WebAssembly target. They are essentially the
...
same, the only difference is that cdecl creates an unmangled alias
2021-10-14 12:29:59 +03:00
Nikolay Nikolov
b91fc3a0d3
* fixed passing of singleton record parameters, containing a float in WebAssembly
2021-10-14 10:53:55 +03:00
Nikolay Nikolov
df92d88f39
+ added support for the handling of singleton record and array types in
...
defToWasmBasic
2021-10-14 10:53:55 +03:00
Nikolay Nikolov
3511b80972
* fixed formatting in defToWasmBasic
2021-10-14 10:53:55 +03:00
Nikolay Nikolov
ee387f7c66
* C ABI fixes for the passing of records in WebAssembly
2021-10-14 10:53:55 +03:00
Nikolay Nikolov
236e10d03a
+ pass 64-bit structures by address in WebAssembly for compatibility with LLVM's C ABI
2021-10-14 10:53:55 +03:00
Nikolay Nikolov
3c58f26e83
* thlcgwasm.g_checkexceptions renamed .g_maybe_checkforexceptions, added also as
...
an empty virtual method in thlcgobj and modified the WebAssembly
implementation, so that it can be called from any exceptions mode (so it
emits no code in exception modes that don't require it, instead of generating
an internal error). This will allow .g_maybe_checkforexceptions to be called
from the generic parts of the code generator, after calls to systemprocs that
could raise an exceptions.
2021-10-05 17:54:35 +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
04a41fa5b0
- removed duplicated assignment
2021-10-05 07:43:47 +03:00
Nikolay Nikolov
99ab6bd56d
+ proper exception object cleanup when using break, continue or exit in try
...
except blocks in WebAssembly native exceptions mode
2021-10-05 07:41:42 +03:00
Nikolay Nikolov
ddbdc529b1
+ proper exception cleanup for try except blocks that use exit, break or
...
continue in WebAssembly branchful exceptions mode
2021-10-05 07:19:24 +03:00
Nikolay Nikolov
023f08d54b
+ exception cleanup when break, continue or exit is used inside a
...
try .. except 'on' block, in WebAssembly native exceptions mode
2021-10-05 06:45:31 +03:00
Nikolay Nikolov
cf7ad98dbf
+ support exception object cleanup, when 'exit', 'break' or 'continue' is used
...
in the except 'on' statements, in branchful WebAssembly exceptions mode
2021-10-05 06:25:32 +03:00
Nikolay Nikolov
7110d1e48e
* use 'br_if' instead of 'if br end_if' sequence in the code, generated by
...
thlcgwasm.g_checkexceptions
2021-10-05 05:29:10 +03:00
Nikolay Nikolov
f7b1ec2435
+ call g_checkexceptions after calls to fpc_reraise and fpc_raise_nested in
...
branchful exceptions mode
2021-10-05 03:38:33 +03:00
Nikolay Nikolov
464b3ebbed
+ implemented the 'on' node code generation (try except 'on' ...) for the
...
branchful exceptions mode
2021-10-05 03:25:03 +03:00
Nikolay Nikolov
a5dcd1c44d
+ initial implementation of try..except in branchful exceptions mode
2021-10-05 03:14:58 +03:00
Nikolay Nikolov
7ce19c1ad7
+ implemented try..finally in branchful exceptions mode
2021-10-05 02:47:49 +03:00
Nikolay Nikolov
7afb665c92
+ insert exception flag check and branch after each function call, when
...
compiling in WebAssembly branchful exceptions mode
2021-10-05 02:26:13 +03:00
Nikolay Nikolov
5be1bfeeca
+ added comment that states that raiseBr is only used in branchful exceptions mode
2021-10-05 01:11:31 +03:00
Nikolay Nikolov
d02921d66b
+ introduced raiseBr, similar to exitBr, but will point to the current
...
innermost exception handler, if there is such a handler in the current
procedure, otherwise it will be the same as exitBr.
2021-10-05 01:07:37 +03:00
Nikolay Nikolov
6599f1d898
- don't generate any WebAssembly native exception handling instructions, nor
...
relocations, when compiling in branchful exceptions mode. This produces a
currently not working, but accepted by wasmtime binary (otherwise, it
complains it doesn't support exceptions and refuses to try to run it).
2021-10-05 01:01:24 +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
41db71c21c
+ implemented the <= operator for smallsets for WebAssembly
2021-10-03 04:37:13 +03:00
Nikolay Nikolov
5adec3ca98
+ workaround for WebAssembly treating the stack parameter of the store and load
...
instructions as unsigned. This caused an 'out of bounds memory access' trap
when accessing arrays with negative offset index, e.g. in test/cg/tvec.pp
2021-10-03 03:16:34 +03:00
Nikolay Nikolov
0a383d8c0f
* fixed WebAssembly method pointer assignment
2021-10-03 02:27:19 +03:00
Nikolay Nikolov
6f88919f37
- don't set casmdata in wasm32/aasmcpu.pas, so that the aasmdef unit can override it
2021-10-03 00:59:11 +03:00
Nikolay Nikolov
c1eeb8beda
+ use the aasmdef unit in wasm32/cpunode.pas
2021-10-03 00:49:53 +03:00
Nikolay Nikolov
cc2fa67dfa
* fixed OS_S8 to OS_16 conversion for WebAssembly. This fixes test/cg/tcnvint6
2021-10-02 22:10:34 +03:00
Nikolay Nikolov
3258937d97
+ implemented move() for WebAssembly via the memory.copy instruction
2021-10-02 21:33:28 +03:00
Nikolay Nikolov
2e3e3edb5f
+ implemented FillChar for WebAssembly via the memory.fill instruction
2021-10-02 20:31:37 +03:00
Nikolay Nikolov
85207e94f8
+ added inline numbers for a memory.copy and a memory.fill intrinsic
2021-10-02 19:40:36 +03:00
Nikolay Nikolov
026d23632a
+ added the memory.copy and memory.fill WebAssembly instructions
2021-10-02 19:35:26 +03:00
Nikolay Nikolov
d2726c2406
* fixed WebAssembly code generation for not(cbool64)
2021-10-01 05:17:12 +03:00
Nikolay Nikolov
4fc763ac50
* fixed WebAssembly cbool support for OP_NOT
2021-10-01 04:54:17 +03:00
Nikolay Nikolov
baf5ff4e05
* another WebAssembly cbool fix in twasmtypeconvnode.second_int_to_bool
2021-10-01 04:40:50 +03:00
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