Commit Graph

70261 Commits

Author SHA1 Message Date
Nikolay Nikolov
90a756931e * WebAssembly threads internal linker: set initial values for threadvar globals 2024-08-11 00:19:53 +03:00
Nikolay Nikolov
a441d8ff28 * WebAssembly threads internal linker: introduced TWasmObjSymbol.TlsDataSym 2024-08-11 00:15:20 +03:00
Nikolay Nikolov
0d5dd4196f * WebAssembly threads: don't do anything in TWasmExeOutput.SetThreadVarGlobalsInitValues
and TWasmExeOutput.GenerateCode_InitTls if threads are disabled
2024-08-11 00:12:37 +03:00
Nikolay Nikolov
334ef633a8 * WebAssembly threads internal linker: starting working on TWasmExeOutput.SetThreadVarGlobalsInitValues 2024-08-11 00:11:29 +03:00
Nikolay Nikolov
39ab212642 * WebAssembly threads internal linker: set MainFuncSymbol of the section of threadvar globals 2024-08-11 00:06:36 +03:00
Nikolay Nikolov
f38b12240d * WebAssembly threads internal linker: set the global type of threadvar globals to wbt_i32 2024-08-11 00:05:14 +03:00
Nikolay Nikolov
afbc36897d + WebAssembly threads internal linker: introduced TWasmExeOutput.GenerateCode_InitTls (not ready, yet, just writes some dummy data) 2024-08-11 00:01:52 +03:00
Nikolay Nikolov
df4ef39762 * WebAssembly threads internal linker: ignore RELOC_GLOBAL_INDEX_LEB
relocations, pointing to AT_TLS entries, because the actual relocation is done
  by another relocation, overlaid on top of this one, pointing to a WebAssembly
  global. The reason we use two relocations, is to cause the smartlinker to keep
  both the AT_TLS symbol, thus reserving data space in linear memory for the
  threadvar, as well as the WebAssembly global variable, used for holding the
  address of the threadvar.
2024-08-10 23:52:35 +03:00
Nikolay Nikolov
cd8fda1c28 * WebAssembly threads internal linker: create double relocation entries for
AT_TLS entries: one points to the AT_TLS entry (the data segment), the other
  points to the WebAssembly global, holding that address. This causes the
  smartlinking optimization to keep both the AT_TLS entry in the data segment,
  as well as the WebAssembly global.
2024-08-10 23:48:55 +03:00
Nikolay Nikolov
605ca8144f * WebAssembly threads internal linker: set objsection properly for global
symbols, created for AT_TLS entries
2024-08-10 23:48:55 +03:00
florian
f1a173bdf6 * improve Risv-V optimizer 2024-08-10 21:57:55 +02:00
Nikolay Nikolov
d1348d17bf + WebAssembly threads internal linker: create a global symbol for all AT_TLS data symbols 2024-08-10 22:37:47 +03:00
Nikolay Nikolov
7e938ffafc * WebAssembly threads internal linker: set MemPos for data sections correctly
when threads are enabled (take into account that the first data section with
  threads enabled is .tbss, instead of .rodata)
2024-08-10 22:04:53 +03:00
Nikolay Nikolov
99b7b19f17 * WebAssembly threads internal linker: import WASM_SYM_TLS symbols as AT_TLS, instead of AT_DATA 2024-08-10 21:35:13 +03:00
Nikolay Nikolov
db86dd07fb * WebAssembly threads internal linker: mark the __tls_base, __tls_size and __tls_align symbols as WebAssembly globals 2024-08-10 21:18:19 +03:00
Nikolay Nikolov
6ec1b7e1b5 + WebAssembly threads internal linker: debug print threadvar relocations,
instead of stopping with an internal error
2024-08-10 21:06:09 +03:00
Nikolay Nikolov
44a5f6623b + WebAssembly threads internal linker: create the __wasm_init_tls symbol's
special WebAssembly properties, such as FuncType
2024-08-10 20:30:26 +03:00
Nikolay Nikolov
70ca28701b * WebAssembly threads internal linker: add the .tbss section to the linker
script in case threads are enabled
2024-08-10 20:10:19 +03:00
Nikolay Nikolov
0642f14552 * WebAssembly threads internal linker: declare the symbol __wasm_init_tls in the
.text section (function will be generated later by the linker)
2024-08-10 19:59:11 +03:00
Nikolay Nikolov
a87481cfa4 * WebAssembly threads internal linker: declare the __tls_base, __tls_size and
__tls_align symbols in the internal linker script if threads are enabled
2024-08-10 19:50:48 +03:00
Nikolay Nikolov
961042356c * WebAssembly threads internal linker: fix validation of R_WASM_GLOBAL_INDEX_LEB relocations in modules that support threads 2024-08-10 19:43:52 +03:00
Nikolay Nikolov
610f2bb3c9 + enable FPC_WASM_THREADS_INTERNAL_LINKER (not stable, yet) in ppcwasm32.lpi 2024-08-10 19:24:49 +03:00
Nikolay Nikolov
34025aecac + enable WebAssembly threads with the internal linker (which still doesn't work
with threads) if FPC is compiled with the FPC_WASM_THREADS_INTERNAL_LINKER
  define
2024-08-10 19:23:10 +03:00
Michaël Van Canneyt
780c1f9c49 * Reduce number of warnings and hints 2024-08-09 17:59:45 +02:00
Michaël Van Canneyt
92f937c40e * Implement DropContext/KeepContext for Delphi compatibility. Patch by Artem Izmaylov. Fixes issue #40884 2024-08-09 10:46:38 +02:00
Michaël Van Canneyt
c53e1b20d7 * Make sure sentences end on point when needed. 2024-08-09 10:38:53 +02:00
Michaël Van Canneyt
8702fc416b * Do not load font config if it is already loaded 2024-08-09 10:33:05 +02:00
Michaël Van Canneyt
abf04f1086 * Use correct class to construct dictionary in callback helper 2024-08-09 10:24:13 +02:00
Michaël Van Canneyt
258211e038 * Fix wrong raise statement 2024-08-09 09:55:02 +02:00
florian
d4816d12f7 * Risc-V 32 has also a GC variant 2024-08-08 22:58:47 +02:00
Michaël Van Canneyt
594b96e305 * Add CopyToMemory 2024-08-08 17:36:16 +02:00
Michaël Van Canneyt
025ad39ef0 * Do not raise exception 2024-08-08 10:15:45 +02:00
Michaël Van Canneyt
a81eac2483 * Correct dictionary construction 2024-08-08 09:59:40 +02:00
Michaël Van Canneyt
37c32a9eb7 * Explicitly specify path to include files 2024-08-08 09:59:40 +02:00
Michaël Van Canneyt
22c978c33f * Print clickable URL with start location 2024-08-08 09:59:40 +02:00
florian
1ecc880fc8 + cpu type RV64GC 2024-08-07 22:53:10 +02:00
Nikolay Nikolov
af5c2d66c2 * removed TODO comment from WasiThreadSwitch 2024-08-07 18:26:19 +03:00
Nikolay Nikolov
5d058258fc + added some more comments in wasi_thread_start 2024-08-07 18:19:35 +03:00
Nikolay Nikolov
a0e1dce1fd * WebAssembly threads: call fpc_wasm32_init_tls from inline asm code to avoid
race condition in branchful exceptions mode
2024-08-07 18:17:38 +03:00
Nikolay Nikolov
fcfce9f2d5 * WebAssembly threads: implement WasiEndThread using exceptions. There's no
other way to end a thread in WebAssembly, except by ending the thread
  procedure. Therefore, the only way to implement WasiEndThread is to have it
  raise an exception and handle it at the outermost level. This, of course,
  requires one of the WebAssembly exception modes to be turned on, in order for
  this to work.
2024-08-07 17:58:11 +03:00
Nikolay Nikolov
e03389c6a8 * WebAssembly threads: destroy the event and mutex in WasiBeginThread in case wasi_thread_spawn fails 2024-08-07 17:06:03 +03:00
Nikolay Nikolov
77d592221a * WebAssembly threads: use New and Dispose instead of GetMem/FreeMem for allocating/freeing TWasmThread 2024-08-07 16:46:13 +03:00
Nikolay Nikolov
f23cc9ec6d * WebAssembly threads: free the stack block and TLS block in case wasi_thread_spawn fails 2024-08-07 16:44:44 +03:00
florian
e6ba09aedd + Risc-V 64: tcpuparamanager.get_saved_registers_int and tcpuparamanager.get_saved_registers_fpu 2024-08-06 22:56:35 +02:00
Michaël Van Canneyt
d0b03c9c71 * Correct callback handler for object tree 2024-08-06 09:32:00 +02:00
Michaël Van Canneyt
25af7a4281 * Export get_object_tree 2024-08-06 09:32:00 +02:00
Michaël Van Canneyt
45ec51dc1f * Install error handler to examine exceptions during callback 2024-08-06 09:00:11 +02:00
Nikolay Nikolov
9e0b2869a3 * WebAssembly threads: disable stack checking for the FPCWasmThreadStartPascal procedure 2024-08-06 07:07:41 +03:00
Nikolay Nikolov
9d771396ff + WebAssembly threads: init StackBottom (used for stack checking) more precisely
when starting a new thread. Precision is not that important for the stack
  checking itself, because it uses a stack margin of 16kb, so the previous
  value, set by InitThread is good enough, however it's easy to do it precisely,
  since we allocate the stack and pass a pointer to it in TWasmThread, so why
  not?
2024-08-06 07:01:28 +03:00
Nikolay Nikolov
da59711442 * WebAssembly threads: pass the stack size to InitThread when starting a new thread 2024-08-06 06:40:33 +03:00