Nikolay Nikolov
3ae64e5e17
+ include unit aoptcpu in wasm32/cputarg.pas
2024-09-21 15:41:26 +03:00
Nikolay Nikolov
a7be888255
+ add optimizer units (empty for now) for the WebAssembly target
2024-09-21 14:50:16 +03:00
Nikolay Nikolov
29ee863e8f
- WebAssembly code generator: removed the g_fingerprint hack, that added 4
...
useless i64 constants on the stack with random numbers and then drop them. It
was used for primitive debugging, since previously it wasn't possible to
identify the function name. Now we can produce DWARF debug info, as well as a
"names" custom section to give each function a name and most WebAssembly
environments support at least one of the two mechanisms. Therefore the
g_fingerprint hack is no longer necessary.
2024-09-17 06:14:03 +03:00
Nikolay Nikolov
1a08d76ccb
+ WebAssembly: insert a tai_local directive also for assembler functions
2024-09-15 02:12:48 +03:00
Nikolay Nikolov
b9ca30165c
* WebAssembly: refactored tai_local, so that it is a single directive,
...
containing multiple locals, instead of creating multiple tai_local directives,
each containing a single local. No functional changes.
2024-09-15 00:49:05 +03:00
Nikolay Nikolov
05b67c7408
- WebAssembly: removed tai_local.name, because we don't use it
2024-09-15 00:09:39 +03:00
Nikolay Nikolov
99943610cb
* WebAssembly: generate the final bashB opcode of a function via the
...
end_function instruction, instead of adding it magically in the object writer.
This makes the WebAssembly debug line info more accurate, covering the
end_function instruction as well.
2024-09-11 07:46:23 +03:00
Nikolay Nikolov
c8e4a52428
+ WebAssembly internal object writer: added safety check for catching bugs,
...
caused by instruction size changes between Pass1 and Pass2
2024-09-11 04:44:50 +03:00
Nikolay Nikolov
d41d98b70b
* WebAssembly internal object writer: fixed helper function SlebSize()
2024-09-11 04:44:05 +03:00
Nikolay Nikolov
964aa8b71b
+ added an optional nil pointer checking for WebAssembly (similar to
...
PowerPC-AIX), that can be activated via the -CN option
2024-09-03 18:05:52 +03:00
Nikolay Nikolov
6149fe394e
* unit agwat renamed agwasa
2024-09-02 02:09:34 +03:00
Nikolay Nikolov
3d204dd0da
* TWabtTextAssembler class renamed TWasaTextAssembler
2024-09-02 02:07:48 +03:00
Nikolay Nikolov
75e061e06f
* as_wasm_wabt_info renamed as_wasm_wasa_info
2024-09-02 02:07:09 +03:00
Nikolay Nikolov
3e036e4ff8
* WebAssembly WABT assembler ID changed to WASA
2024-09-02 02:06:40 +03:00
Nikolay Nikolov
d786b639c0
* WebAssembly wabt assembler id as_wasm32_wabt renamed as_wasm32_wasa
2024-09-02 02:06:16 +03:00
Nikolay Nikolov
293ddffebd
+ disable the WebAssembly type checker for all LLVM-MC versions since version 13
2024-09-01 21:20:43 +03:00
Nikolay Nikolov
342ede81ee
* WebAssembly code generator: don't emit a return instruction at the end of the
...
function, because it's redundant
2024-09-01 20:28:42 +03:00
Nikolay Nikolov
6ab6d613e0
+ add explicit support for LLVM-MC versions 15..18
2024-09-01 20:10:54 +03:00
Nikolay Nikolov
a76ca8f60e
+ pass '--no-type-check' to llvm-mc-13, because its type checking is broken
2024-09-01 20:03:29 +03:00
Nikolay Nikolov
5e327453a8
+ WebAssembly external asm writer: workaround for the 'missing functype' error,
...
produced by LLVM-MC versions 13 and above
2024-09-01 19:52:50 +03:00
Nikolay Nikolov
54d65ff75c
* WebAssembly: fixed crash when attempting to generate a functype directive for
...
a generic function
2024-08-25 20:49:55 +03:00
Nikolay Nikolov
b6527c6c03
+ WebAssembly: check for exceptions after call of fpc_rangeerror in branchful
...
exceptions mode. This fixes catching of ERangeError exceptions when using
SysUtils and runtime errors are converted to exceptions.
2024-08-25 13:43:50 +03:00
Nikolay Nikolov
58a3f2ef64
* WebAssembly: changed the generated code in a_op_reg_reg_reg_checkoverflow to
...
avoid using a label
2024-08-25 13:23:45 +03:00
Nikolay Nikolov
7a1c50ff87
* fix warning
2024-08-25 12:20:55 +03:00
Nikolay Nikolov
d2785117df
* WebAssembly: fixed overflow checking for unsigned subtraction
2024-08-25 11:48:53 +03:00
Nikolay Nikolov
4f42553cb3
* fix bug in thlcgwasm.a_op_reg_reg_reg_checkoverflow when either src1 or src2
...
is the same as dst
2024-08-25 11:33:33 +03:00
Nikolay Nikolov
8bbb28ace8
+ WASI: enable the generic stack checking
2024-08-06 05:00:14 +03:00
Nikolay Nikolov
ee3ff19312
+ allow referencing TLS_SIZE_SYM, TLS_ALIGN_SYM and TLS_BASE_SYM from WebAssembly inline asm
2024-07-22 16:45:26 +03:00
Nikolay Nikolov
43229cdf2e
+ support the atomic instructions in the WebAssembly inline asm reader
2024-07-22 02:02:25 +03:00
Nikolay Nikolov
fcfcdc2ccd
- removed debug printing from the WebAssembly inline assembler reader
2024-07-21 21:05:53 +03:00
Nikolay Nikolov
5cfd214b68
* fixed WebAssembly inline asm parsing bug for the global.get/global.set ID instruction
2024-07-21 18:13:42 +03:00
Nikolay Nikolov
b08b5bf136
* fixed the WebAssembly inline asm call instruction with the internal assembler writer
2024-07-20 21:53:24 +03:00
Nikolay Nikolov
d8340641cc
+ support the call instruction in the WebAssembly inline asm
2024-07-20 21:30:00 +03:00
Nikolay Nikolov
0a9169eb67
+ allow referencing '$__stack_pointer' in WebAssembly inline asm as argument to
...
the global.get and global.set instructions. This will be used in the future to
implement the thread start routine in inline asm.
2024-07-20 17:38:10 +03:00
Nikolay Nikolov
e67094ec28
* WebAssembly temp gen: introduced localsfirsttemp and localslasttemp, use these
...
for the locals temps indices, instead of firsttemp and lasttemp, which refer
to the temps on the linear stack
2024-07-20 16:38:03 +03:00
Nikolay Nikolov
7cbf18c6f3
* don't create block..end_block around WebAssembly inline asm routines
2024-07-16 16:53:55 +03:00
Nikolay Nikolov
65d4319dc2
* don't do anything in postprocess_code for WebAssembly inline asm routines
2024-07-16 16:28:32 +03:00
Nikolay Nikolov
4adac78f85
+ respect the nostackframe directive in WebAssembly inline asm routines
2024-07-16 15:25:12 +03:00
Nikolay Nikolov
83a8d584e0
+ set result.ops in twasmreader.HandlePlainInstruction
2024-07-16 15:13:56 +03:00
Nikolay Nikolov
d9e3afcb1d
+ actually enable the parsing of WebAssembly inline asm instructions
2024-07-16 14:53:56 +03:00
Nikolay Nikolov
fd1fb255a6
* started implementing twasmreader.HandleBlockInstruction
2024-07-16 14:48:55 +03:00
Nikolay Nikolov
152bb316c3
+ call ConcatInstruction for plain instructions in twasmreader.HandleInstruction
2024-07-16 12:58:47 +03:00
Nikolay Nikolov
8ec86ad053
+ insert plain instructions and parse nested instructions in twasmreader.HandleFoldedInstruction
2024-07-16 02:04:58 +03:00
Nikolay Nikolov
95593f15dd
+ handle the local and global variable instructions with a constant integer
...
parameter in twasmreader.HandlePlainInstruction
2024-07-16 01:38:57 +03:00
Nikolay Nikolov
ea988e0b92
+ recognize the memory access instructions with an optional memarg operand (not
...
parsed, yet) in twasmreader.HandlePlainInstruction
2024-07-15 20:27:32 +03:00
Nikolay Nikolov
09f2fa0daf
+ support the f32.const and f64.const instructions in twasmreader.HandlePlainInstruction
2024-07-15 20:20:13 +03:00
Nikolay Nikolov
8e79108e51
* changed twasmreader.HandlePlainInstruction to return an instruction
2024-07-15 16:49:06 +03:00
Nikolay Nikolov
c1c1d46c15
+ parse the instructions with integer parameter i32.const and i64.const in twasmreader.HandlePlainInstruction
2024-07-15 16:49:06 +03:00
Nikolay Nikolov
748dbbcb20
* fixed another warning
2024-07-14 00:09:18 +03:00
Nikolay Nikolov
4c3d8d016e
+ added else clause to silence warning, treated as error in CI
2024-07-13 12:21:36 +03:00