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
florian
d4816d12f7
* Risc-V 32 has also a GC variant
2024-08-08 22:58:47 +02:00
florian
1ecc880fc8
+ cpu type RV64GC
2024-08-07 22:53:10 +02: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
Nikolay Nikolov
8bbb28ace8
+ WASI: enable the generic stack checking
2024-08-06 05:00:14 +03:00
florian
23dec631f5
+ Risc-V: apply OptPass1OP to more operations
2024-08-05 22:37:59 +02:00
florian
3e6cd16bb5
+ Risc-V 32: tcpuparamanager.get_saved_registers_int
2024-08-05 22:37:18 +02:00
Nikolay Nikolov
3c027b0ba0
* WebAssembly threads: use the stack size, specified for the main thread (via
...
the $M directive, or the '-Cs' compiler option) as the default stack size for
other spawned threads
2024-08-05 01:59:13 +03:00
florian
4afb07cc5e
+ Risc-V 32: tcpuparamanager.get_saved_registers_fpu
2024-08-04 23:03:44 +02:00
Nikolay Nikolov
aaf536ae10
* WebAssembly: allow specifying the initial and max memory size via the $M
...
directive
2024-08-04 04:11:10 +03:00
Nikolay Nikolov
9cf31e2bb3
+ show a message and automatically switch to external linking if WebAssembly multithreading is enabled
2024-08-04 02:55:34 +03:00
florian
cc2406ad74
* factor out TRVCpuAsmOptimizer.OptPass1Add
2024-08-03 21:55:41 +02:00
florian
8708144c50
+ RiscV: AndiAndi2Andi
2024-08-02 22:15:37 +02:00
florian
80febbd8cf
* Risc-V: use OptPass1OP more
2024-08-01 22:24:07 +02:00
florian
a4242e60b2
+ Risc-V 32: apply OptPass1OP also on ADD
2024-07-28 22:56:52 +02:00
florian
657e4bf838
* more use of OptPass1OP
2024-07-28 21:39:06 +02:00
florian
6d157b5bf0
+ Risc-V 32: optimize QWord(1) shl ...
2024-07-28 21:17:25 +02:00
florian
9c81c4a5fa
* apply OptPass1OP to more instructions
2024-07-28 16:58:49 +02:00
florian
d270c2ccdd
* better zero extension for Risc-V32
2024-07-28 16:42:32 +02:00
florian
1c96bf5d30
+ S*LI x,x,0 to nop optimization
2024-07-27 21:06:49 +02:00
florian
c81f10bfbd
+ apply OptPass1OP also to SRL/SLL
...
* fix commit
2024-07-27 21:00:03 +02:00
florian
1737035501
+ riscv32: trv32shlshrnode.second_64bit
2024-07-27 19:48:16 +02:00
Michaël Van Canneyt
87137a4aaa
* Do not include class and array properties in RTTI
2024-07-27 08:21:44 +02:00
J. Gareth "Curious Kit" Moreton
a06a20f9c0
* x86: Fixed an issue where invalid typecast errors would be raised in the peephole optimizer under -CriotR
2024-07-25 20:35:06 +00:00
florian
28704b2976
* distclean removes msgtxt.inc and msgidx.inc, resolves #40861
2024-07-24 22:25:00 +02:00
Michaël Van Canneyt
478a227aa4
* like as -> as
2024-07-24 11:15:51 +02:00
Michaël Van Canneyt
6a067b55d1
* Some minor rewordings as per 39349
2024-07-24 08:56:33 +02: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
Rika Ichinose
1030f67fb4
Use IndexQWord_SSE41 directly if -Cp RTL compiled with supports SSE 4.1.
2024-07-21 08:40:12 +00: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
Michaël Van Canneyt
258ad62c4d
* Do not try to export symbol if an error occurred, avoid internal error. Fixes issue #40858
2024-07-20 17:51:45 +02: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
6277c21261
+ support OPR_FLOATCONSTANT in TInstruction.ConcatInstruction
2024-07-20 17:07:21 +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
Michaël Van Canneyt
9059ac067c
* write dependent rtti for non-published in case of extended RTTI
2024-07-20 09:52:38 +02:00
florian
9f6a3eebb7
* handle adress registers properly in tcg64f68k.a_op64_reg_ref
2024-07-19 20:00:21 +02:00
florian
b71b5b771f
* fixes building for ARM
2024-07-19 18:34:40 +02:00
Michaël Van Canneyt
b0a82993e6
* Inherit extended RTTI settings from parent object
2024-07-19 16:05:14 +02:00
Michaël Van Canneyt
de1b3a982b
* Do not generate RTTI for generic methods (delphi compatible)
2024-07-19 10:42:41 +02:00
florian
437e7fa75a
* make warning on unsupported esp-idf version a warning string so it can be translated
2024-07-18 22:40:05 +02:00
Michael Ring
f6651f8855
Add -Ff to firstpass options
2024-07-18 20:16:04 +00:00
Michael Ring
e0229632fb
Make idfpath and idf_version macros available as replacement vars in fpc.cfg
2024-07-18 20:16:04 +00:00
Michael Ring
14b3c11c0d
Initial support for esp32-c6-s2-s3. Support for idf versions 5.0.6 and 5.2.1
2024-07-18 20:16:04 +00:00
J. Gareth "Curious Kit" Moreton
0fadf3515e
* x86-64: Workaround to permit CPU types in command line with dashes in names (e.g. X86-64-V3)
2024-07-18 20:05:13 +00: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
Michaël Van Canneyt
02e90adfe1
* Need IFDEF, compiler stops "with unreachable code"
2024-07-15 17:19:52 +02: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
Michaël Van Canneyt
e86882580d
* Do not free used units during reset, they can be in use during load cycle. Fixes issue #40852
2024-07-15 14:09:49 +02: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
Nikolay Nikolov
c6e715a54e
+ WebAssembly inline assembler instruction parsing work in progress
2024-07-12 23:35:38 +03:00
Michaël Van Canneyt
1743df7b80
* Patch by Evgenii Savin to avoid IE 2010021502 when calling generic from other generic. Fixes issue #40770
2024-07-12 18:04:57 +02:00
Nikolay Nikolov
0c61c7057a
* fixed some WebAssembly instruction names in the wasm_op2str array
2024-07-12 16:09:07 +03:00
Nikolay Nikolov
4c787b4b9f
+ started working on a WebAssembly inline assembler reader. Not ready, yet, just
...
includes a basic tokenizer for now.
2024-07-12 16:02:19 +03:00
florian
a816fc2114
* update project file
2024-07-11 22:12:38 +02:00
florian
f6002d8078
* ensure make_simple_ref is called, resolves #40851
2024-07-10 22:26:09 +02:00
Alligator-1
b64701da1b
Partial revert "Immediately set the capacity"
...
(capacity assignments of type TFPHashObjectList)
2024-07-09 08:30:34 +05:00
Alligator-1
9caabdc4e7
Immediately set the capacity
2024-07-08 20:17:11 +00:00
florian
47d2395110
* set operand size properly for STX*
2024-07-08 21:54:05 +02:00
Alligator-1
ffaeec243a
Immediately set the capacity
2024-07-08 14:51:39 +05:00
Alligator-1
e87982e925
const array - reducing unnecessary data copying
2024-07-07 19:48:42 +05:00
florian
b974e4a25f
* fix extension to 64 bit on aarch64, resolves #40576
2024-07-07 16:36:29 +02:00
Nikolay Nikolov
35701f8fa2
* fail with an internal compiler error in case an atomic WebAssembly instruction
...
is generated, while WebAssembly multithreading is disabled
2024-07-07 16:43:41 +03:00
florian
fd74c26707
* TARMAsmOptimizer.USxtOp2Op sets register size if needed
2024-07-07 15:41:39 +02:00
Nikolay Nikolov
26c69d564f
+ introduced WebAssembly helper is_atomic_op
2024-07-07 10:42:28 +03:00
florian
5b03123bd4
* ensure register size is set properly by AndSxt2And
2024-07-06 22:12:52 +02:00
florian
8cafafc3e6
+ add missing instructions
2024-07-05 21:06:21 +02:00
Michaël Van Canneyt
adc66b233d
* Properly release procdefs. Patch by Evgenij Savin, fixes issue #40844
2024-07-05 14:35:05 +02:00
florian
db5e821ead
* more change information updates
2024-07-02 22:21:24 +02:00
florian
9ce7fbeef0
* change information updates
2024-06-28 22:45:00 +02:00
Nikolay Nikolov
c88037b8a7
* fixed another crash in the wasi internal linker, caused by missing resource section
2024-06-28 00:30:12 +03:00
Nikolay Nikolov
a71995a521
* wasi internal linker: fixed crashes introduced by previous commit in
...
GetDataSize and GetBssSize
2024-06-28 00:30:12 +03:00
Nikolay Nikolov
6f8655ecc9
* split the sections strings into groups and add comments about the importance
...
of the section order and grouping. No functional changes.
2024-06-28 00:30:12 +03:00
Nikolay Nikolov
924d4b9b53
+ wasm internal linker: count the 'fpc.reshandles' section towards the bss size
...
of the binary
2024-06-28 00:30:12 +03:00
Nikolay Nikolov
2828752587
+ wasm internal linker: count the 'fpc.resources' section towards the binary
...
data size
2024-06-28 00:30:12 +03:00
Nikolay Nikolov
07da0058e3
+ wasm internal linker optimization: write only the non-empty data sections to
...
the resulting .wasm file (the 'fpc.resources' section specifically can be
empty, if the binary doesn't use resources)
2024-06-28 00:30:12 +03:00
Nikolay Nikolov
c4f046f1b8
+ wasi internal linker: also write the fpc.resources section to the file
2024-06-28 00:30:12 +03:00
Nikolay Nikolov
e17b6291f5
+ WASI internal linker: add the 'fpc.resources' and 'fpc.reshandles' sections as well
2024-06-28 00:30:12 +03:00
Nikolay Nikolov
c491856533
* changed the resource object extension for the WASI platform to .or (similar to Linux)
2024-06-27 04:15:44 +03:00
Nikolay Nikolov
440a635bce
+ initial compiler support for WebAssembly resources. Requires WebAssembly
...
support in the fpcres utility, which is not implemented, yet.
2024-06-25 03:07:55 +03:00
J. Gareth "Curious Kit" Moreton
fb66369a3b
* x86: CheckJumpMovTransferOpt now also copies over register deallocations to allow better optimisations
2024-06-24 20:05:39 +00:00
florian
abcced55af
* (lsighly, added safety check) patch by Евгений Савин, resolves #40784
2024-06-23 22:07:51 +02:00
florian
9ea7aa74b5
* get rid of unneeded -dGDB
2024-06-20 20:57:44 +02:00
Michaël Van Canneyt
9e8f09b93f
* Properly reset state when (re)compiling, by Artem Izmaylov. Fixes issue #40825
2024-06-20 11:52:02 +02:00
florian
6c50c02f7c
* bail out early in tcgaarch64.make_simple_ref if possible
2024-06-17 22:54:06 +02:00
florian
13de117b8e
* give better error message for #40821
2024-06-16 10:51:45 +02:00
florian
f8da65f8e9
* cosmetics
2024-06-14 22:58:29 +02:00
florian
8b2ebd07bf
* don't throw an internal error if a procedure is passed to a const formal parameter, resolves #40817
2024-06-13 22:32:54 +02:00
Pierre Muller
83d3a39417
Avoid unnecessary call when length(s) is zero, which avoids range check error
2024-06-13 06:50:11 +00:00
florian
2fe3955be9
+ more change information
2024-06-11 23:22:21 +02:00
Pierre Muller
f7eaa6f3d6
Regenerate Makefile's after setting ALLPPUDIRS variable
2024-06-11 07:45:53 +00:00
Pierre Muller
35510bd0cd
Rename ALLPPUDIR to ALLPPUDIRS to use same make variable as in packages and utils directories
2024-06-11 07:45:53 +00:00
Pierre Muller
5fc78b223c
Respect alphabetical order in -T listing for aarch64 compiler
2024-06-11 09:45:40 +02:00
Pierre Muller
a38effb29b
Add missing information about -T option for embedded and iphonesim target OS for aarch64 compiler help using -h option
2024-06-11 09:43:09 +02:00
Pierre Muller
d44a1c4100
Remove compiler/msgtxt.inc and compiler/msgidx.inc from tracked file list
2024-06-11 09:25:56 +02:00
Pierre Muller
2d8a50556c
Fix exclusion of ogelf unit using $ifndef NOOGELF
2024-06-11 01:05:51 +02:00
Pierre Muller
010127a622
Add ogmacho unit loading unless NOOGMACHO macro is defined
2024-06-11 01:05:51 +02:00
Pierre Muller
ce702df526
Take care about endianess in arm instruction binary code generator
2024-06-11 01:05:51 +02:00
Pierre Muller
318e31487a
Take care about endianess in arm eabi attribute section
2024-06-11 01:05:51 +02:00
florian
bdb611c925
* small fix of change information
2024-06-10 23:10:48 +02:00
Sven/Sarah Barth
5bf93d220f
* exact-match COMDAT sections are already supported since tdynamicarray.equal() has been implemented a couple of yours ago, so allow them
2024-06-07 15:34:02 +02:00