Commit Graph

70330 Commits

Author SHA1 Message Date
Yuri Serebrennikov
73ee25071d Fixed work in ThreadMode := wtmNone mode. 2024-08-12 10:18:36 +00:00
florian
0366df9fbd + Zb* cpu capabilities 2024-08-11 22:47:29 +02:00
Nikolay Nikolov
296a792380 * set MaxIntResource to 1023 for WebAssembly, because that's where the first
data segment starts, after commit 3218f25d13,
  and even before that, when using the external linker
2024-08-11 04:19:36 +03:00
Nikolay Nikolov
3218f25d13 * WebAssembly internal linker: reduced exe section alignment to 16 bytes 2024-08-11 03:57:05 +03:00
Nikolay Nikolov
7b05051fc1 * WebAssembly internal linker: add the .tbss section size to the result of GetBssSize 2024-08-11 03:29:39 +03:00
Nikolay Nikolov
8833fabb4b + enable the WebAssembly internal linker with multithreading 2024-08-11 02:58:25 +03:00
Nikolay Nikolov
f81485a9b1 * WebAssembly threads internal linker: use signed LEB when needed in TWasmExeOutput.GenerateCode_InitTls and TWasmExeOutput.GenerateCode_InitSharedMemory 2024-08-11 02:55:15 +03:00
Nikolay Nikolov
2e2281387c * WebAssembly threads internal linker: micro optimization in
TWasmExeOutput.GenerateCode_InitTls - skip generating instructions that add
  zero
2024-08-11 02:44:23 +03:00
Nikolay Nikolov
4adb6b2bee * WebAssembly threads internal linker: use WriteUleb instead of WriteUleb5 in
TWasmExeOutput.GenerateCode_InitTls and TWasmExeOutput.GenerateCode_InitSharedMemory.
  This generates equivalent, but shorter code.
2024-08-11 02:37:18 +03:00
Nikolay Nikolov
dfe60b53d1 * WebAssembly threads internal linker: generate data.drop instructions in
TWasmExeOutput.GenerateCode_InitSharedMemory. This drops the passive memory
  segments, after the memory has been initialized.
2024-08-11 02:30:39 +03:00
Nikolay Nikolov
b985cd0ea5 * WebAssembly threads internal linker: implement memory initialization in TWasmExeOutput.GenerateCode_InitSharedMemory 2024-08-11 02:24:02 +03:00
Nikolay Nikolov
cfa7d6a0c6 * WebAssembly internal linker: moved the DataSections const array from local to
the method writeData to local to the class. No functional changes.
2024-08-11 02:14:13 +03:00
Nikolay Nikolov
4d48e7e4d3 * WebAssembly threads internal linker: generate passive data segments, when multithreading is on 2024-08-11 02:12:31 +03:00
Nikolay Nikolov
8648c0353a + WebAssembly threads internal linker: partial implementation of TWasmExeOutput.GenerateCode_InitSharedMemory 2024-08-11 02:07:50 +03:00
Nikolay Nikolov
914b1feceb * WebAssembly threads internal linker: create a startup function for
initializing shared memory (dummy for now)
2024-08-11 01:37:50 +03:00
Nikolay Nikolov
b6f60e33ca * WebAssembly threads internal linker: use imported and shared memory if multithreading is enabled 2024-08-11 01:18:38 +03:00
Nikolay Nikolov
3a473f9148 * WebAssembly threads internal linker: set initial values for __tls_size, __tls_align and __tls_base 2024-08-11 00:56:16 +03:00
Nikolay Nikolov
07b4ceac49 * WebAssembly threads internal linker: set threadvar globals as mutable 2024-08-11 00:44:32 +03:00
Nikolay Nikolov
c9f6b93d22 * WebAssembly threads internal linker: implemented the actual code generation in TWasmExeOutput.GenerateCode_InitTls 2024-08-11 00:41:56 +03:00
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