Commit Graph

28004 Commits

Author SHA1 Message Date
Michaël Van Canneyt
564597a573 * Fix access violation: module can be reset while loading dependent units. Fixes issue #40705 2024-03-26 16:06:27 +01:00
J. Gareth "Curious Kit" Moreton
ee1916e919 * i8086: Local variables unused in "second_AndOrXorShiftRot_assign" on i8086 are now not defined on this platform 2024-03-26 14:18:31 +00:00
J. Gareth "Curious Kit" Moreton
11b341cc97 * x86: Added new OptPass1CMOVcc peephole optimisation routine to dust up min/max code 2024-03-26 14:18:31 +00:00
J. Gareth "Curious Kit" Moreton
c79361c010 * Min/max intrinsics now simplify deterministic results 2024-03-26 14:18:31 +00:00
J. Gareth "Curious Kit" Moreton
e4a0ce2fb5 * x86: Min/max intrinsic support 2024-03-26 14:18:31 +00:00
J. Gareth "Curious Kit" Moreton
77c86cafd0 * a64: Fixed bug where unsigned min/max inlines used a signed comparison 2024-03-26 14:18:31 +00:00
J. Gareth "Curious Kit" Moreton
81b7b80749 * Added support for 64-bit min/max intrinsics 2024-03-26 14:18:31 +00:00
florian
8971103a00 * use bit_set_reg_reg also to clear single bits in thlcgobj.a_load_regconst_subsetref_intern 2024-03-26 14:46:01 +01:00
J. Gareth "Curious Kit" Moreton
4378319f87 * Added missing "override" directive for XML node dump routine on TDerefNode 2024-03-26 13:25:46 +00:00
Pierre Muller
afea558fbe Add -32/-64 for sparc GNU assembler calls 2024-03-25 23:48:14 +01:00
Pierre Muller
c68ddc5360 Add $EMUL also for sparc CPU GNU linker call on solaris OS 2024-03-25 23:48:14 +01:00
J. Gareth "Curious Kit" Moreton
948766a37a * x86: New Op/TEST optimisation that rearranges register usage for the most efficient execution 2024-03-25 22:25:29 +00:00
florian
7c609ee7c4 * proper fix for 9056ab8025 2024-03-25 22:33:30 +01:00
Pierre Muller
9056ab8025 Fix generation of i8086 CPU code, as BTR/BTS instructions require at least 386 CPU 2024-03-25 14:29:08 +00:00
florian
ac150e58c8 * thlcgobj.a_load_regconst_subsetref_intern uses a_bit_set_reg_reg if applicable 2024-03-25 00:01:24 +01:00
florian
12176d3683 * avoid to generate bts/r with memory operand
+ thlcgx86.a_bit_set_reg_reg
2024-03-24 23:03:33 +01:00
J. Gareth "Curious Kit" Moreton
2b7df4237b * nf_pass1_done, nf_error, nf_processing and nf_do_not_execute
have been moved to a new "transientflags" node field that
    isn't stored in PPU files
2024-03-24 18:14:49 +00:00
ccrause
dd858f37aa Ensure register to be eliminated is de-allocated before applying optimization LdsMov2Lds. 2024-03-24 13:54:31 +00:00
J. Gareth "Curious Kit" Moreton
99851f22f5 * a64: New B -> RET peephole optimisation 2024-03-24 13:31:52 +00:00
florian
20f9b82543 * AArch64: overflow checking for abs
* tabs adapted: also abs(longint) must overflow check on 64 bit platforms
2024-03-24 12:47:16 +01:00
florian
1fccfd3ee1 * AArch64: avoid false overflow error in case of -2^63+0 2024-03-24 12:36:02 +01:00
florian
b7322ae4c3 * write correct type name in error message 2024-03-23 22:24:55 +01:00
florian
4100f75056 + optimize s:=s+[e] into include(s,e) 2024-03-23 21:02:15 +01:00
florian
06fc6f1e6b * use destination location instead of a temp when constructing sets, resolves #40384 2024-03-22 21:50:42 +01:00
J. Gareth "Curious Kit" Moreton
e1297e0859 * Adjustment to "(v>=x) and (v<=y)" so it also optimises its inverse: "(v<x) or (v>y)" 2024-03-20 21:01:35 +00:00
Pierre Muller
36b511f057 FFix compilation of compiler with -dTest_Double_checksum 2024-03-20 17:30:12 +00:00
Michaël Van Canneyt
c52794f943 * Fix build of nativent 2024-03-19 10:27:30 +01:00
J. Gareth "Curious Kit" Moreton
f77b9fa4ef * arm/a64: Fixed bug where shifter operand was not preserved in AND/CMP -> TST optimisation 2024-03-18 21:21:54 +00:00
florian
316e127948 * overflow checking for ti386inlinenode.second_abs_long 2024-03-17 10:24:20 +01:00
florian
c3b8b51cb5 * more overflow checking for abs(...) 2024-03-16 21:54:12 +01:00
J. Gareth "Curious Kit" Moreton
a907eb49c9 * a64: Several secondary peephole optimizations that clean up CSEL instructions 2024-03-15 18:08:37 +00:00
J. Gareth "Curious Kit" Moreton
ef1cb852a8 * a64: New CSEL block optimisations ported over from x86 CMOV block optimisations 2024-03-15 18:08:37 +00:00
florian
2a46596edd * overflow check abs(...) for x86 2024-03-14 23:14:47 +01:00
Pierre Muller
f88622a799 Be sure not to consume semicolon after _USES twice 2024-03-11 11:07:02 +00:00
J. Gareth "Curious Kit" Moreton
755d221230 * x86: Additional optimisation in OptPass2MOV to help with sub-optimal MOV/CMP/MOV triplets (and a minor refactor). 2024-03-10 21:09:59 +00:00
J. Gareth "Curious Kit" Moreton
f4e955d04f * x86: Improvement to CMOVcc/Jcc optimisation that attempts to remove temporary registers storing constants 2024-03-10 21:09:59 +00:00
J. Gareth "Curious Kit" Moreton
a7fe49f38f * x86: CMOVcc/Jcc pairs are now changed to MOV/Jcc if the register is not used if the jump doesn't branch 2024-03-10 21:09:59 +00:00
florian
e35403c3b8 * optimize additions of empty sets away if possible, part of #40384 2024-03-10 10:47:24 +01:00
florian
594d4cc4f9 * transform -1-x into not(x) 2024-03-08 22:42:26 +01:00
florian
5086cf7e72 * set packenum and setalloc to defined values when changing mode, resolves #40056 2024-03-08 20:12:55 +01:00
J. Gareth "Curious Kit" Moreton
1dbcba4796 * arm/a64: Bug fix where instructions optimised into "mov r0,r0"
could leave registers undefined in some circumstances
2024-03-08 18:24:52 +00:00
Michaël Van Canneyt
4c434ceb08 * Only consume semicolon after uses clause when units have been connected. Fixes remaining failing tests 2024-03-08 11:31:49 +01:00
Michaël Van Canneyt
22de07446d * Fix tgeneric91, need to postpone some additional generic procedures 2024-03-07 16:12:24 +01:00
Michaël Van Canneyt
b2bc020fd7 * Handle rename of module during parsing, rebuild hash list. Fixes broken test tb0406.pas 2024-03-07 10:26:22 +01:00
florian
f41025f5dd * optimize also -(x+1) and -(1+x) into not(x) 2024-03-06 22:56:37 +01:00
Michaël Van Canneyt
2e6c3b060d * Initialize firstwaiting, after remark by Pierre 2024-03-06 21:55:47 +01:00
Michaël Van Canneyt
76687a04e5 * Fix TW22160B1 2024-03-06 17:08:52 +01:00
Pierre Muller
821f3e326f Fix compilation with -dDEBUG_DEVIRT 2024-03-06 14:40:22 +00:00
Pierre Muller
cc552c0815 Fix compilation with -dEXTDEBUG 2024-03-06 14:34:53 +00:00
Pierre Muller
9db42f5e67 Fix post_load_or_compile tppumodule method for SHORT_ON_FILE_HANDLES code by adding from_module parameter
Fixes compilation of text mode IDE for go32v2 target.
2024-03-06 14:16:37 +00:00
florian
0fb4fca957 * fix building of llvm compiler after node flag refactoring 2024-03-05 22:23:39 +01:00
florian
59c77a48b5 * transform -x-1 into not(x), resolves #40313 2024-03-05 22:11:32 +01:00
florian
1f2203c304 * fix compilation with 3.2.2 rtl 2024-03-05 22:11:32 +01:00
Michaël Van Canneyt
a15dfba971 * Fix compilation 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
325d29307f * Indentation and casing changes 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
91946b78d5 * Fix xtensa compilation 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
4e8b1cb97a * Fixed signature of insert_init_final_table 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
64e7dcbc81 * Log continue result 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
6ac14de986 * Properly handle finish state 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
42c9eb4096 * Add Logging of tasks under define 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
c96ef4902b * Handle finish state separately 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
2ba04dbd13 * generate init_final table from actual uses clauses 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
0bf0f26dd5 * Introduce m_processed 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
546de9f7e7 * Return first waiting in usedunitsloaded 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
c98e160c19 * Introduce state variables, used to construct list of used units 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
462c201ce6 * Introduce m_processed 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
5298e25c84 * Introduce task (Single main-level task at the moment, no change in behaviour). 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
881eb0fab5 * Check whether call to deref(impl) is needed during re-resolve (indexes may be -1 if not yet built) 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
a5caf91f74 * Split load_ppu for clarity 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
8aa9ac99a6 * Remove loaded_from in tmodule. The same unit can be loaded from different places 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
9cc30829fa * Restore messages state 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
1351746a46 * Make tglobalstat a class 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
6f7481fd24 * Remove freeold from set_current_scanner 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
7cd044eae7 save/restore state when loading other modules. 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
d9317e5df5 * Remove use of current_module 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
a81715d6ea * Pass loaded from 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
3ce07ef6fa * use set_current_scanner, add mainscanner 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
93ae6261cc * Make current_scanner a function/procedure to better control lifetime 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
4443e83b75 * replace/restore_scanner use var in state to make sure the correct scanner is freed 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
8fa3c57c1b * split module creation from parsing start 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
5b27fa9375 * Remove commented variables 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
83b5047931 * Move program/library header parsing to separate routines 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
b45aee980f * Split parsing from post-processing, code generation and linking 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
122251f71d * Move interface parsing part to separate routine so we can split tasks later 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
560d597c85 * Move implementation part to separate routine so we can split tasks later 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
97f159e4b2 * Refactory: remove current_module use from top-level parsing 2024-03-05 07:56:14 +00:00
Michaël Van Canneyt
277a3be9b0 * DRY Refactoring: introduce discardppu 2024-03-05 07:56:14 +00:00
florian
bf2a3566fa * patch by Sergey Larin: Compile dynarr := nil (and, preferably, SetLength(dynarr, 0)) as fpc_dynarray_clear, resolves #40309 2024-03-04 22:44:23 +01:00
florian
bcf320a76e * patch by Rika: Don’t pretend optinfo^.index can be aword(−1), resolves #40405 2024-03-03 22:49:28 +01:00
J. Gareth "Curious Kit" Moreton
1ab46c909a * Reduced the number of expensive calls to "GetUserCode" in DFA 2024-03-03 00:10:41 +00:00
florian
64141c8bdd * increase ppu long version as the format changed 2024-03-02 21:31:21 +01:00
florian
4103b3d180 * formatting 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
dba69917a9 * Flags specific to TInlineNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
4736cc2360 * Flags specific to TDerefNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
179fc5848b * Flags specific to TArrayConstructorNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
ecc16278f0 * Flags specific to TAssignmentNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
0e5da37533 * Flags specific to TAsmNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
c21a0f0654 * Flags specific to TModDivNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
b804fc5164 * Flags specific to TAddNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
5ea60b97b1 * Clarity over blocknode and VMT flags. nf_usercode_entry doesn't need to be cascaded in "firstpass" as TBlockNode.Simplify already does this 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
1bba83cebb * Flags specific to TVecNode have been moved to their own field 2024-03-02 21:31:21 +01:00
Michaël Van Canneyt
05f0ceeb26 * Atributes for class/record methods 2024-03-02 14:15:22 +01:00
Michaël Van Canneyt
2c9870f85a * Attributes must be assigned only to elements before the first colon 2024-02-29 10:22:19 +01:00
Michaël Van Canneyt
4769ed948a * Add codeaddress to extended RTTI for static methods 2024-02-28 11:52:16 +01:00
florian
f9b98092c4 * stack checking is actually 'S' 2024-02-27 22:37:01 +01:00
Nikolay Nikolov
6a28ac53da + support the native exception instructions in TWasmValidationStacks.Validate 2024-02-27 12:54:56 +02:00
Nikolay Nikolov
9da276b352 * fixed bug in thlcgwasm.a_op_reg_reg_reg_checkoverflow that used to generate
code that fails WebAssembly validation
2024-02-27 11:59:39 +02:00
florian
1966ce7c1c + Skylake-X for i386 2024-02-26 22:41:55 +01:00
Nikolay Nikolov
f2d739b93a + perform WebAssembly validation, if the compiler is compiled with the
DEBUG_WASM_VALIDATION defined
2024-02-26 12:13:59 +02:00
florian
cad21584e5 + Skylake-X 2024-02-25 22:52:30 +01:00
Michaël Van Canneyt
fb821b8c9b * Allow use of attributes on fields and properties in records and classes 2024-02-25 19:57:39 +01:00
Michaël Van Canneyt
91284ba543 * Create and correctly typed variable for fieldsym instead of using typecasts 2024-02-25 19:57:39 +01:00
Nikolay Nikolov
0ae014a98f + support the BR and BR_IF instructions in TWasmValidationStacks.Validate 2024-02-25 13:52:34 +02:00
Nikolay Nikolov
13f58fe343 + support if,block,loop,else,end_if,end_block,end_loop in TWasmValidationStacks.Validate 2024-02-25 13:08:41 +02:00
Nikolay Nikolov
472f9be9a6 + support the global.get and global.set instructions in TWasmValidationStacks.Validate 2024-02-25 11:38:36 +02:00
Nikolay Nikolov
ab65c9889b + added the WasmBasicType to TWasmGlobalAsmSymbol. This will help WebAssembly
validation and stack tracking.
2024-02-25 08:54:39 +02:00
Nikolay Nikolov
f4b9d51aff + introduced TWasmGlobalAsmSymbol subclass of TAsmSymbol. Use it for all
AT_WASM_GLOBAL symbols. This allows in the future to add extra data to the
  TWasmGlobalAsmSymbol, such as the WebAssembly global type, which will aid in
  WebAssembly validation and stack tracking.
2024-02-25 07:29:56 +02:00
Nikolay Nikolov
b367d7c905 + introduced TAsmData.WeakRefAsmSymbolByClass 2024-02-25 07:18:22 +02:00
Nikolay Nikolov
26a2ae92ad + introduced TAsmData.RefAsmSymbolByClass - similar to RefAsmSymbol, but allows
to create a subclass of TAsmSymbol even in the case of external symbol.
2024-02-25 07:15:23 +02:00
Nikolay Nikolov
81d98f5ae2 + support the CALL instruction in TWasmValidationStacks.Validate 2024-02-25 04:51:14 +02:00
Nikolay Nikolov
21cc89f1e3 + added a second TWasmFuncType parameter to the CALL WebAssembly instruction. It
is not part of the WebAssembly syntax and binary encoding, but it helps
  WebAssembly stack tracking and validation.
2024-02-25 04:48:17 +02:00
florian
587af1c78e * icelake is x86-64-v4 2024-02-24 21:54:11 +01:00
J. Gareth "Curious Kit" Moreton
7c5847bc70 * x86: "StcClcSet(c)2Mov" optimisation now checks to see if the destination register is in use 2024-02-24 20:37:10 +00:00
Michaël Van Canneyt
a2939e4187 * Force VMT at first position in system.tobject 2024-02-24 18:11:23 +01:00
Nikolay Nikolov
2dcb15f88f + support a_call_indirect in TWasmValidationStacks.Validate 2024-02-24 10:49:15 +02:00
florian
37ed03667f * fixed fpu_x86_64_v4_flags 2024-02-23 21:51:37 +01:00
Pierre Muller
e7f9626592 Be sure not to add a symbol with empty name as an alias for function return variable 2024-02-23 16:00:05 +00:00
Pierre Muller
37c3e86c7f Also reset check_valid_var after calling var_para_allowed 2024-02-23 15:48:50 +00:00
Sven/Sarah Barth
3447512e29 * ensure that "type SomeName = type reference" is still allowed when function references are disabled
+ added test
2024-02-23 15:31:38 +01:00
florian
3cf7890352 * don't throw an internalerror in case of an illegal assignment to an open array, resolves #40662 2024-02-22 22:35:18 +01:00
florian
b8bf295cd1 * patch by Rika: Fold repetitive scandir.pas cases, resolves #40660 2024-02-21 22:01:44 +01:00
Sven/Sarah Barth
5c890b59e3 * fix #40655: apply changes to packrecords, packenum and setalloc using the recordpending*() functions so that they are applied correctly in case of them being used directly after a {$POP}{$PUSH} sequence
+ added test
2024-02-20 23:52:52 +01:00
florian
bccc0b195e * allow type = type ... ; syntax only for previously declared types, avoids also internal error for #40566 2024-02-20 23:14:31 +01:00
florian
bf57750436 * cosmetics 2024-02-19 22:27:06 +01:00
florian
a75e453c30 + thlcgobj.location_force_mem now supports LOC_JUMP as well, resolves #40650 2024-02-19 22:22:12 +01:00
Pierre Muller
728fb7c58c Set ba variable upfront to avoid warning treated as error 2024-02-19 22:12:46 +01:00
Jonas Maebe
a512273976 WPO: handle classes defined in localsymtables
Can happen since the support for anonymous methods
2024-02-19 21:26:42 +01:00
florian
906571fa25 * improve pretty printing of symbols 2024-02-19 20:41:08 +01:00
Pierre Muller
79ed0db624 Avoid warning about unintialized 'ba' variable 2024-02-19 20:37:35 +01:00
Pierre Muller
2044868c10 Swap real constant in internal assembler 2024-02-19 20:19:36 +01:00
Pierre Muller
e3b93b07c6 * Fix writereloc for cross-endian compilation 2024-02-19 20:19:36 +01:00
Pierre Muller
f3e03f0483 Fix tabs 2024-02-19 20:19:35 +01:00
Pierre Muller
1d1e070ad2 Support cross-endian compilation for telfobjdata.writereloc method 2024-02-19 20:19:35 +01:00
Pierre Muller
5c564ea940 Use writeint8/writeuint8 methods to avoid cross-endian issues 2024-02-19 20:19:35 +01:00
Pierre Muller
ca6fe96360 Add writeInt8/writeUInt8 methods to fix some cross-endian generation issues 2024-02-19 20:19:35 +01:00
florian
af482fde23 * generate specializations only of no error happened so far to prevent further (internal)errors, resolves #40646 2024-02-18 23:08:21 +01:00
Michaël Van Canneyt
ccb1985953 * Fix latex error due to unescaped dollar 2024-02-18 21:39:04 +01:00
Pierre Muller
462d0eb07c Restrict use of A_MOVE to ufromsize and utosize = OS_INT. (contributed by Jinyang He)
Fix issue #40648
2024-02-18 20:18:50 +00:00
Sven/Sarah Barth
ea102d792f * fix #40634 the 2nd: a (strict) protected symbol in a parent class of the owner is supposed to be visible
+ added test
2024-02-18 19:35:24 +01:00
Sven/Sarah Barth
5e05630713 * fix the internal error of #40639; however as the test code in question will only compile correctly with the next commit no test is added yet 2024-02-18 19:35:24 +01:00
Sven/Sarah Barth
1dbde8a79d - remove no longer required check as that is now handled by check_strict_private (not to mention that the check had been placed incorrectly anyway...) 2024-02-18 19:35:24 +01:00
Sven/Sarah Barth
11200cfaf6 * use check_strict_private and check_strict_protected in their respective non-strict checks to avoid code duplication 2024-02-18 19:35:23 +01:00
Sven/Sarah Barth
852aee489c * move the checks for strict private and protected into their own nested functions 2024-02-18 19:35:23 +01:00
J. Gareth "Curious Kit" Moreton
ae927b0689 * x86: Fixed "Cmp1Jl2Cmp0Jle" and "CmpJe2NegJo" optimisations
being applied incorrectly if another jump follows
2024-02-18 15:37:27 +00:00
J. Gareth "Curious Kit" Moreton
e406cbd9c8 * x86: Minor efficiency gains in OptPass1CMP 2024-02-18 15:37:27 +00:00
J. Gareth "Curious Kit" Moreton
1e0f6f9f64 * x86: Fixed error in "LeaLea2Lea 1" optimisation
not properly accounting for the first LEA
	 instruction having a repeated register
2024-02-18 15:31:20 +00:00
Pierre Muller
692754b422 Move test to end of possible conversion and add check_valid_var boolean variable 2024-02-17 21:33:52 +00:00
Pierre Muller
f39cfc75fc First attempt to fix bug report #40537 2024-02-17 21:33:52 +00:00
florian
8146443336 + set pi_do_call on ARM as well if we check for fpu exceptions 2024-02-17 21:03:55 +01:00
Michaël Van Canneyt
7a29d8f54d * Fix compilation with DEBUG_NODE_XML 2024-02-17 11:04:29 +01:00
florian
a736a4bba7 + set pi_do_call on RiscV as well if we check for fpu exceptions 2024-02-16 22:48:14 +01:00
Sven/Sarah Barth
d9903e6e16 * fix #40634: correctly check visibility for child classes in case of a mixture of specializations and non-specializations
+ added test
2024-02-16 16:54:23 +01:00
florian
421d67556a + set pi_do_call on loongarch64 as well if we check for fpu exceptions 2024-02-15 22:47:31 +01:00
florian
1ee9a39fe2 + lazarus project for a loongarch64 compiler 2024-02-15 22:47:31 +01:00
florian
57f6ed804e + set pi_do_call on xtensa as well if we check for fpu exceptions
* cosmetics
2024-02-14 23:04:25 +01:00
J. Gareth "Curious Kit" Moreton
f7e4c0f282 * 3-operand LEA instructions are now expanded if the latency could cause slowdown 2024-02-14 20:59:01 +00:00
Michaël Van Canneyt
fe62b3ace8 * Introduce constwresourcestring - in unicode mode, resource strings are unicode strings, and must be streamed differently 2024-02-13 19:44:36 +01:00
florian
a71cc71585 + function needs_check_for_fpu_exceptions to unify fpu exception handling 2024-02-13 17:42:21 +01:00
J. Gareth "Curious Kit" Moreton
629c87efc8 * x86-64: Typo fixed in FPU type string array 2024-02-13 14:39:29 +00:00
florian
3ed5a4a022 + when calling FPC_THROWFPUEXCEPTION in a sub routine, pi_do_call must be set, fixed for aarch64 2024-02-12 23:25:35 +01:00
Pierre Muller
eae74aaee0 Follow sdas documentation for .ascii limitations by using only printable chars and .byte for others 2024-02-12 14:03:02 +00:00
Pierre Muller
53bf5dc6ef Avoid wrong typecast by adding check that p1 is an instuction before casting it to taicpu 2024-02-12 10:39:18 +00:00
J. Gareth "Curious Kit" Moreton
271f69db12 * arm/a64: "OptPass2AND" and "OptPass2CMP" adapted to remove vestigial CMP and TST instructions 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
6b2e4fa413 * arm: "OpCmp2OpS" moved to Pass 2 so it doesn't conflict with AND; CMP -> TST optimisation 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
bf29f2051c * arm/a64: Added new TST post-peephole optimisation to replace previous AND/CMP/B(c) optimisation 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
b18c10d0d8 * arm/a64: New "OptPass2TST" routine to catch "TST; B.c; AND -> ANDS; B.c" optimisation 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
9f19f582c4 * arm/a64: New AND/CMP -> TST or ANDS optimisation 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
29916bc6f6 * arm: Fixed "RegInInstruction" and "RegModifiedByInstruction" not handling the flags properly 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
38d2f3d58c * a64: Renamed OptPostCMP/And to PostPeepholeOptCMP/AND for internal consistency 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
d7d4b446c1 * FindRegAllocBackward will now return nil if it hits a dealloc for the register first 2024-02-11 21:39:19 +00:00
J. Gareth "Curious Kit" Moreton
1fafcbc125 * New "TryRemoveRegAlloc" optimisation utility 2024-02-11 21:39:19 +00:00
florian
4f82fade82 * extend LeaCallLeaRet2Jmp optimization to work on windows 2024-02-11 18:56:26 +01:00
J. Gareth "Curious Kit" Moreton
62495c964a * x86: New "aoc_DoPass2JccOpts" option to catch branch and
STC/CLC optimisations that only manifest in Pass 2
2024-02-11 15:05:57 +00:00
J. Gareth "Curious Kit" Moreton
2055ef4e88 * x86: STC/CLC optimisations can now handle multiple Jcc instructions 2024-02-11 15:05:57 +00:00
J. Gareth "Curious Kit" Moreton
de03a1b894 * x86: Additional STC/CLC; J(N)C deterministic jump optimisation 2024-02-11 15:05:57 +00:00
J. Gareth "Curious Kit" Moreton
698d432cce * x86: Separated out Jcc; STC/CLC optimisation and added additional peephole optimisations 2024-02-11 15:05:57 +00:00
J. Gareth "Curious Kit" Moreton
3e06242fd8 * x86: New "STC/CLC; MOV" peephole optimisation 2024-02-11 15:05:57 +00:00
J. Gareth "Curious Kit" Moreton
d06dd2b0ea * x86: New "Jcc; CLC/STC; .Lbl" optimisation 2024-02-11 15:05:57 +00:00
florian
2575cbc439 * complain about turned off support of c style operators only in the parser,
so error recovery is better
2024-02-11 11:05:05 +01:00
florian
8a48d1bbbc * clean up of arrayconstructor_to_set, the stringdef case didn't work for years and is not tested, so it probably is not supposed to be there at all 2024-02-10 22:16:02 +01:00
florian
bc0d2293a1 * stricter type checking for set constants, resolves #40631 2024-02-09 23:36:44 +01:00
Sven/Sarah Barth
43721f21c4 * fix #40621: when checking for visibility of members then always use the genericdefs for specializations for correct scoping
+ added test
2024-02-09 17:24:39 +01:00
Sven/Sarah Barth
ed8a05d697 * use iscurrentunit only when there isn't a suitable def that the moduleid of the symtables can be compared to 2024-02-09 17:22:46 +01:00
Sven/Sarah Barth
ddc2259e5e * protect against comparisons of nested types of generics and specializations 2024-02-09 17:14:29 +01:00
Sven/Sarah Barth
2c527cfc01 * fix typos in comment, no code changes 2024-02-09 14:01:00 +01:00
Nikolay Nikolov
26855a29c8 * fix warning 2024-02-08 16:54:33 +02:00
Nikolay Nikolov
e073d5f7f7 + implemented support for the local.get, local.set and local.tee instructions in TWasmValidationStacks.Validate 2024-02-08 16:49:45 +02:00
J. Gareth "Curious Kit" Moreton
b4eabbe5ce * x86: Fixed CPU feature flags for AMD Jaguar and Piledriver 2024-02-06 22:15:51 +00:00
J. Gareth "Curious Kit" Moreton
e4bd58d66a * x86: Replaced CPU features array with "cpu_x86_64_v1_flags" where possible 2024-02-06 22:15:51 +00:00
florian
d7a486f225 * comment fixed, hint by Maxim Ganetsky 2024-02-06 22:09:52 +01:00
florian
f80f1112d4 + Zen 4 2024-02-05 23:18:07 +01:00
Nikolay Nikolov
28c4c58b34 * fix warning 2024-02-05 23:35:45 +02:00
Nikolay Nikolov
d7581aa1ee + implemented TWasmValidationStacks.Validate for many (but not all, yet) instructions 2024-02-05 23:29:44 +02:00
florian
ac6dc582be + also add x86-64 as cpu type (gcc compatibility) 2024-02-03 22:40:54 +01:00
J. Gareth "Curious Kit" Moreton
3882066f23 * Speed optimisations for peephole register tracking functions 2024-02-03 20:30:46 +00:00
J. Gareth "Curious Kit" Moreton
05d6e20acc * New Boolean "SetAndTest" utility function 2024-02-03 20:30:46 +00:00
florian
d44cae14f5 * decide more sophisticately if a temp. var is needed for fixing #40618 2024-02-02 22:00:22 +01:00
Sven/Sarah Barth
27a2a04279 * fix #40618: apply adjusted patch by Евгений Савин (@jack128a) so that a non-load case expression is loaded into a temp first when converting a single range branch into an if-clause
+ added test
2024-02-02 15:55:40 +01:00
florian
f8dbb09a46 * fixed some issues with the x86-64 instruction versions
* use more of the constants
2024-02-01 22:08:27 +01:00
Nikolay Nikolov
e53620ebdb * fix warnings 2024-02-01 01:20:15 +02:00
florian
ae465fa8dc + introduce x86-64 microarchitecture levels for cpu and fpu flags 2024-01-31 22:32:57 +01:00
Nikolay Nikolov
5e0dcfb49b + introduced TWasmValidationStacks.Unreachable 2024-01-31 02:57:19 +02:00
Nikolay Nikolov
24315a7f28 + introduced TWasmValidationStacks.label_types 2024-01-31 02:45:43 +02:00
Nikolay Nikolov
f3e667da42 + introduced TWasmValidationStacks.PopCtrl 2024-01-31 02:38:09 +02:00
Nikolay Nikolov
4cb97dcdb3 * fixed warning 2024-01-31 02:33:31 +02:00
Nikolay Nikolov
4cc5cf4d0e + introduced TWasmValidationStacks.PushCtrl 2024-01-31 02:25:44 +02:00
Nikolay Nikolov
18c6e13f45 * fixed warning 2024-01-31 02:19:03 +02:00
Nikolay Nikolov
064adbf3f8 + introduced TWasmValidationStacks.PopVals 2024-01-31 02:15:09 +02:00
Nikolay Nikolov
4d5479741d + introduced TWasmValidationStacks.PushVals 2024-01-31 02:11:59 +02:00
Nikolay Nikolov
2d5c1d43cf + introduced TWasmValidationStacks.PopVal(expect) 2024-01-31 02:10:05 +02:00
Nikolay Nikolov
d575aa5240 + introduced TWasmBasicTypeList 2024-01-31 01:55:38 +02:00
Nikolay Nikolov
1786875319 + implemented TWasmValueStack.GetCount
+ implemented TWasmControlStack.GetCount
+ implemented TWasmValidationStacks.PopVal
2024-01-31 01:52:05 +02:00
Nikolay Nikolov
3f0853692c + implemented methods in TWasmControlStack: Push, Pop, GetItems, SetItems 2024-01-31 01:20:24 +02:00
Nikolay Nikolov
506634f261 * TWasmControlFrame changed to a record 2024-01-31 01:05:02 +02:00
florian
ff3b4adc27 + more CPU and FPU flags added 2024-01-30 22:55:42 +01:00
Pierre Muller
529b64790b Avoid 'false' warning: Local variable "gap_index" does not seem to be initialized on cycle with -O3 option 2024-01-29 18:15:28 +01:00
J. Gareth "Curious Kit" Moreton
bac4ca19e7 * Fixed internal error 2022041701 number clash (LLVM changed to 2022041730) 2024-01-28 09:34:14 +00:00
florian
b32573d1eb * inserting $result into the symtables should never trigger a duplicate symbol error, resolves #40608 2024-01-27 22:05:31 +01:00
J. Gareth "Curious Kit" Moreton
b514e979bd * Fixed issue where OptPass2CMP and OptPass2TEST didn't drop out on labels etc. 2024-01-27 19:00:50 +00:00
J. Gareth "Curious Kit" Moreton
2e441609be * Fixed issue where TryCmpCMovOpts produced bad
code if the last MOV got moved.
2024-01-27 19:00:50 +00:00
Pierre Muller
11b0b9dc57 Use reverse_byte to write constant sets in cross-endian configuration 2024-01-25 11:04:42 +00:00
Pierre Muller
5eda6e027d * Add internal_endian field to tppudumpfile class
* Check that this new field is indeed set, once only, by
    header flags.
  * Use this flag to extract high and low parts of floatx80
    record for soft floatx80 support.
2024-01-25 11:00:28 +00:00
Pierre Muller
71ba76532b * Fix writing of 'comp' type depending on FPC_COMP_IS_INT64 macro.
* Fix writing of floatx80 on systems with gaps due to alignment requirements.
2024-01-25 10:17:11 +00:00
Pierre Muller
8ae28b4846 Fix writing of low qword of floatx80 real type into 10-byte array on big endian systems 2024-01-25 10:13:21 +00:00
Pierre Muller
3db060e47a Use writeUInt32LE/writeUInt16LE method to write multi-byte integer in importlib method in t_win unit (as all supported CPUs are little endian) 2024-01-25 01:01:06 +00:00
florian
c4fc5fc916 * disable OptPass2Test and OptPass2CMP for now as it seems to result in buggy code 2024-01-23 22:11:59 +01:00
Sven/Sarah Barth
981ec64666 * fix #40594: when assigning a nested function to a function reference don't check for the nested procvars parameter, because nested functions can be treated like anonymous functions here
+ added test
2024-01-22 22:27:33 +01:00
Sven/Sarah Barth
feb79e0068 - the setter for tloadnode.procdef is not used, so remove it so that that tloadnode.setprocdef can be extended 2024-01-22 22:27:33 +01:00
J. Gareth "Curious Kit" Moreton
46fa168d43 * Code that checks for divisions against -1 is now not inserted if
it's not necessary (e.g. no downsizing)
2024-01-22 21:17:05 +00:00
J. Gareth "Curious Kit" Moreton
0943458713 * More efficient if-statement construction in tmoddivnode.simplify 2024-01-22 21:17:05 +00:00
Sven/Sarah Barth
47c21fd1bc * fix #40593: don't check for a static method when assigning a methodpointer to a function reference
+ added test
2024-01-22 19:44:36 +01:00
Nikolay Nikolov
6aa49038a5 * inverted the indices of TWasmValueStack, so that item 0 is top of stack 2024-01-22 11:02:32 +02:00
Nikolay Nikolov
fadf43a33b + added TWasmControlStack and frame. Not used, yet. Will be used in the future
for WebAssembly stack tracking and validation.
2024-01-22 10:15:43 +02:00
J. Gareth "Curious Kit" Moreton
0962578511 * Streamlined label referencing 2024-01-21 16:45:38 +00:00
Charles Averill
bb2e2f83e9 Add struct field names to subscriptn nodes in parse tree output 2024-01-21 16:39:09 +00:00
Charles Averill
cd9ed54d35 Add string constant values to stringconstn nodes in parse tree output 2024-01-21 16:39:09 +00:00
florian
7bbd33bcd6 * last commit was not complete, fixed 2024-01-21 15:26:21 +01:00
florian
79f6ee538d * fix compilation on 32 bit hosts 2024-01-21 15:25:36 +01:00
J. Gareth "Curious Kit" Moreton
74625648cf * Vectors of string constants are now simplified into ordinal constants 2024-01-21 11:56:09 +00:00
Pierre Muller
7595dd3624 Also swap word/dword in case of cross-endian compilation 2024-01-20 21:35:24 +01:00
Pierre Muller
9648463eb5 Add MaybeSwap for coffsectionrec records (needed for cross-endian compilation) 2024-01-20 21:35:24 +01:00
florian
615e9bdafd * copyright year for compiler logo updated 2024-01-20 20:54:52 +01:00
Onur ERÇELEN
44af9d87de Upload New File 2024-01-20 19:50:44 +00:00
Nikolay Nikolov
42f447257d + introduced TWasmValueStack for tracking the state of the WebAssembly stack. Not used, yet, but will be in the future. 2024-01-17 11:21:48 +02:00
Nikolay Nikolov
04a077707c * fix warning 2024-01-17 09:43:51 +02:00
Nikolay Nikolov
03fc5d2323 + added a zero/unitialized/unknown value to TWasmBasicType: wbt_Unknown 2024-01-17 08:32:10 +02:00
florian
4867d48e99 + support for .debug_loc and .debuc_loclist sections 2024-01-16 23:24:37 +01:00
Nikolay Nikolov
f65e4f2385 * fixed bug in the handling of WebAssembly goto 2024-01-16 08:44:06 +02:00
Sven/Sarah Barth
1ffef6ed41 * print the whole symbol name for hint messages 2024-01-15 22:29:47 +01:00
Pierre Muller
4c330f2799 Issue internal error in def type is errordef 2024-01-15 19:54:04 +01:00
florian
5f42443db3 * several issues with the in_val_x optimization fixed 2024-01-14 18:58:08 +01:00
J. Gareth "Curious Kit" Moreton
01246e4d30 * Fixed issue where Val shortcutting would not compile under 32-bit systems 2024-01-14 03:43:39 +00:00
J. Gareth "Curious Kit" Moreton
6597f02ebc * The "Val" intrinsic is now simplified for string constants akin to a
pure function.
2024-01-13 22:24:08 +00:00
Nikolay Nikolov
a9316b1953 - removed the DEBUG_WASM_GOTO define from the .lpi file 2024-01-14 00:21:40 +02:00
Nikolay Nikolov
1fecb46c52 - removed the ENABLE_WASM_INTERNAL_LINKER define from the .lpi file 2024-01-12 21:17:49 +02:00
Pierre Muller
637c34571e Avoid range check error in AddNormalStringDef 2024-01-10 23:24:46 +01:00
Nikolay Nikolov
a8b4c0772c * fixed bug that caused 'c in ['a'..'z']' to fail on the WebAssembly target, when code is compiled with {$packset 1} 2024-01-10 03:11:13 +02:00
Karoly Balogh
19fe377455 m68k: fix tw40182 test 2024-01-09 10:57:11 +01:00
Karoly Balogh
88ffc9e228 m68k: refactored the optimizer to avoid direct asml management where possible, and use standard functions instead 2024-01-09 03:03:27 +01:00
Jonas Maebe
60e77de115 LLVM: remove flags used to support older LLVM versions 2024-01-08 19:33:28 +01:00
Karoly Balogh
020ca55e25 m68k: add more cases, where TST instructions can beoptimized away, because the previous instruction already sets all the required flags 2024-01-08 15:06:38 +01:00
Karoly Balogh
3c57eb42f9 do not display the changing assembler note, if the internal and the external assemblers are the same, or there's no internal assembler defined 2024-01-08 14:19:20 +01:00
Karoly Balogh
db137d0528 tabs to spaces cosmetics, no functional change 2024-01-08 14:19:20 +01:00
Nikolay Nikolov
fbcd90f286 + generate DWARF debug info for WebAssembly locals 2024-01-08 01:18:35 +02:00
Michaël Van Canneyt
82ac429954 * Fix missing escape for dollar sign 2024-01-07 20:19:38 +01:00
Sven/Sarah Barth
170c05592b * ensure that the legacy method table has the correct alignment on platforms that require it (e.g. SPARC64) 2024-01-07 18:09:51 +01:00
Sven/Sarah Barth
7163a893e9 * search using the real package name instead of the uppercased one so that an as-is cased package will be found as well 2024-01-07 18:09:50 +01:00
florian
7bb9638094 * copyright year updated 2024-01-07 17:58:52 +01:00
florian
f7bfa0e426 * range checking is already performed in pass_typecheck 2024-01-07 17:51:35 +01:00
florian
dbf6527508 * factor out pointer_dec 2024-01-07 17:32:50 +01:00
J. Gareth "Curious Kit" Moreton
1f178d381f * x86: PostPeepholeOptMov attempts to convert mov $0,%reg to
xor %reg,%reg and mov $-1,%reg to or $-1,%reg under
	 -Os even if the flags are in use by looking ahead.
2024-01-07 14:29:42 +00:00
J. Gareth "Curious Kit" Moreton
63879e74cd * x86: Additional TEST/CMP optimisations to optimise CMOV blocks
that aren't optimal due to register pressure
2024-01-07 14:29:42 +00:00
J. Gareth "Curious Kit" Moreton
0b6faeba68 * x86: CMOV block optimisation overhauled 2024-01-07 14:29:42 +00:00
Nikolay Nikolov
e3f4bad164 * fixed internal linker crash if no tags are defined (i.e. no WASM native exceptions used) 2024-01-07 03:29:32 +02:00
Nikolay Nikolov
9681378d37 + enable the WASI internal linker 2024-01-07 03:17:07 +02:00
Nikolay Nikolov
93365f7e38 * wasm internal linker: produce an internal error on unknown relocations 2024-01-07 02:41:53 +02:00
Nikolay Nikolov
cd72a8910e + wasm internal linker: implemented RELOC_TAG_INDEX_LEB relocations 2024-01-07 02:39:57 +02:00
Nikolay Nikolov
4084da63ab + wasm internal linker: create the tag section (if not empty) 2024-01-07 02:35:35 +02:00
Nikolay Nikolov
033a2ae2e7 * wasm internal linker: set mempos of the .wasm_tags (and .wasm_globals) section to 0 2024-01-07 02:12:49 +02:00
Nikolay Nikolov
6b47a03cc9 * wasm internal object reader: handle tag symbol flags properly (support weak and local symbols) 2024-01-07 02:08:32 +02:00
Nikolay Nikolov
59c88f4c79 + WASI internal linker: added the .wasm_tags exe section to the linker script 2024-01-07 01:56:34 +02:00
Nikolay Nikolov
1d48cd7eba * wasm internal linker: treat exception symbols as AB_COMMON 2024-01-07 01:50:16 +02:00
Nikolay Nikolov
07677f4214 * wasm internal object reader: convert R_WASM_TAG_INDEX_LEB relocations to relocation objects 2024-01-07 01:45:27 +02:00
Nikolay Nikolov
3121f3f8a0 * wasm internal object reader: validate that R_WASM_TAG_INDEX_LEB relocations point to a SYMTAB_EVENT symbol 2024-01-07 01:43:47 +02:00
Nikolay Nikolov
962b36a6e8 + wasm internal object reader: create symbols for SYMTAB_EVENT entries in the symbol table 2024-01-07 01:42:12 +02:00
Nikolay Nikolov
09accffd28 + wasm internal object reader: range check event symbols against the tag index space (imports + tag section) 2024-01-07 01:33:00 +02:00
Nikolay Nikolov
02b7cc0e56 + wasm internal object reader: read tags from the export section 2024-01-07 01:29:10 +02:00
Nikolay Nikolov
79d739baa6 + wasm internal object reader: bounds check the tag type index against the types table 2024-01-07 01:25:48 +02:00
Nikolay Nikolov
2de0bcb8d0 + wasm internal object reader: store the tags from the tag section in the TagTypes array 2024-01-07 01:23:05 +02:00
Nikolay Nikolov
55002d1905 + wasm internal object reader: read tag imports 2024-01-07 01:15:13 +02:00
Nikolay Nikolov
c527437594 + wasm internal object reader: parse the tag section 2024-01-07 01:06:04 +02:00
Nikolay Nikolov
7f3ed9e85c * wasm internal linker: skip the element section when reading object files. This fixes linking with object modules, produced by the external assembler. 2024-01-07 00:11:59 +02:00
Nikolay Nikolov
6a9376cb9e * wasm internal linker: fixed the relocation of imported function symbol aliases 2024-01-06 23:53:15 +02:00
Nikolay Nikolov
b8db469c48 + WASI internal linker: simplify linker script generation for the .text, .rodata, .data and .bss sections via the use of ScriptAddGenericSections 2024-01-06 23:26:14 +02:00
Nikolay Nikolov
749688b3b0 + WASI internal linker: also add .debug_frame and .debug_str sections to the output binary 2024-01-06 23:24:26 +02:00
Nikolay Nikolov
49395f2b00 + WASI internal linker: add all object sections, starting with '.bss' to the .bss section 2024-01-06 23:22:25 +02:00
Nikolay Nikolov
aac37e3179 * fix warning 2024-01-06 22:10:34 +02:00
Nikolay Nikolov
4b2a924ea0 * fix warning 2024-01-06 22:05:35 +02:00
Nikolay Nikolov
3fddae4a40 + wasm internal linker: implemented R_WASM_FUNCTION_OFFSET_I32 relocations 2024-01-06 21:55:20 +02:00
Nikolay Nikolov
b679f8bc06 - wasm internal object reader: removed redundant check for R_WASM_TABLE_INDEX_I32 pointing to a SYMTAB_FUNCTION entry (we now do this check earlier) 2024-01-06 21:39:31 +02:00
Nikolay Nikolov
e3b6d70f93 * wasm internal linker: set mempos of debug sections to 0 2024-01-06 21:16:31 +02:00
Nikolay Nikolov
baee5b9fd4 * wasm internal linker: perform R_WASM_SECTION_OFFSET_I32 relocations 2024-01-06 21:12:22 +02:00
Nikolay Nikolov
1061965ea5 + wasm internal object reader: check that R_WASM_GLOBAL_INDEX_LEB point to a SYMTAB_GLOBAL symbol 2024-01-06 21:03:02 +02:00
Nikolay Nikolov
30c8930c30 * fix warning 2024-01-06 21:00:14 +02:00
Nikolay Nikolov
dc16426790 + wasm internal object reader: check that relocations that should point to a SYMTAB_DATA symbol, actually point to such symbol 2024-01-06 20:57:23 +02:00
Nikolay Nikolov
b35c118244 + wasm internal object reader: added range check to the reader of the SymKind field 2024-01-06 20:54:04 +02:00
Nikolay Nikolov
f3401c3f53 * fix warning 2024-01-06 20:51:35 +02:00
Nikolay Nikolov
3071ae231a + wasm internal object reader: validate that relocations that should point to a SYMTAB_FUNCTION entry, actually point to such entry 2024-01-06 20:30:20 +02:00
Nikolay Nikolov
baf9681684 * refactor: changed the type of SymbolTable.SymKind to TWasmSymbolType, to avoid type casts. No functional changes. 2024-01-06 20:26:27 +02:00
Nikolay Nikolov
00d8d53c4e * refactor: changed the type RelocationTable.RelocType to avoid type casts. No functional changes. 2024-01-06 20:22:47 +02:00
Nikolay Nikolov
d87a6c89d4 * wasm internal object reader: removed the warnings in case of missing symbol (this will now create an internal error, instead) 2024-01-06 20:18:14 +02:00
Nikolay Nikolov
a2a85dc7af * wasm internal object reader: validation of the RelocIndex range moved to a single place - in ReadRelocationSection 2024-01-06 20:14:40 +02:00
Nikolay Nikolov
4933d73938 + support R_WASM_SECTION_OFFSET_I32 relocations in the wasm internal object reader 2024-01-06 20:06:54 +02:00
Nikolay Nikolov
39c3d5d035 + wasm internal object reader: support relocations for debug sections 2024-01-06 19:30:14 +02:00
Nikolay Nikolov
dfdc4a4d78 + wasm internal object reader: record section indices for debug sections. Check for duplicated debug sections. 2024-01-06 19:08:01 +02:00
Nikolay Nikolov
6ab2cd3ce9 + wasm internal object reader: also read the '.debug_frame' and '.debug_str' sections 2024-01-06 18:51:22 +02:00
Nikolay Nikolov
ada576e559 + wasm internal object reader: pass a TWasmCustomDebugSectionType parameter to ReadDebugSection 2024-01-06 18:47:32 +02:00
Nikolay Nikolov
543b341203 + write debug sections in the wasm internal exe writer 2024-01-04 16:00:00 +02:00
Jonas Maebe
f86a9bd5c0 Extended RTTI: fix use of wrong def for the methods table
Fixes LLVM compilation
2024-01-03 22:29:01 +01:00
Jonas Maebe
0104edce45 Extended RTTI: optimise fetching VMT index 2024-01-03 22:29:01 +01:00
Jonas Maebe
8147185907 LLVM: fix missing line debug info for some invokes in specialised functions
Required when the code can be inlined. Fixes compilation with debug info of
system.messaging.pp
2024-01-03 22:29:01 +01:00
Sven/Sarah Barth
9a1083c98e * for some reason my ppu.pas had a version of 18, instead of 20... so now the correct version m( 2024-01-03 22:03:03 +01:00
Sven/Sarah Barth
40cbda6e7e * increase PPU version due to Extended RTTI related changes 2024-01-03 21:57:09 +01:00
Nikolay Nikolov
995309c209 + add the debug sections in the WASI internal linker script file 2024-01-02 20:33:55 +02:00
Nikolay Nikolov
3724e00169 + wasm object reader: allow other sections to be created before the first code section 2024-01-02 20:25:54 +02:00
Nikolay Nikolov
ff4744e0ed * ignore relocation sections for custom sections for now (will be done later), so that we can proceed with the debug info generation in a later phase 2024-01-02 20:19:51 +02:00
Nikolay Nikolov
9a983632f9 + read debug sections in the wasm internal object reader 2024-01-02 20:10:43 +02:00
Nikolay Nikolov
3c08ad4af5 + increased the default stack size of the WASI platform from 64 KB to 8 MB (like in i386-linux) 2024-01-02 18:38:22 +02:00
Nikolay Nikolov
5fe4ab49bc + fill the correct minimal number of memory pages required in the wasm internal linker 2024-01-02 17:58:01 +02:00
Pierre Muller
d83004dee1 Add emulation_opt settings for all four mips CPUs 2024-01-02 14:31:21 +01:00
Pierre Muller
7887f46700 Try to compute correct page size for wlib call 2024-01-02 14:17:23 +01:00
Pierre Muller
952f4bae17 Fix wrong explicit typecast of srsym variable (caught by -CR option) 2024-01-02 14:16:38 +01:00
Ryan Joseph
b4ff9b71d3 * Dump extended RTTI info from PPU 2024-01-02 07:09:22 +01:00
Ryan Joseph
519a102379 * Write extended RTTI info 2024-01-02 07:09:22 +01:00
Ryan Joseph
d74d41c5d2 * Allow RTTI directive also before uses clauses 2024-01-02 07:09:22 +01:00
Ryan Joseph
2005e3c094 * Apply RTTI directive status to symbol 2024-01-02 07:09:22 +01:00
Ryan Joseph
fefa163a35 * Introduce RTTI options in symbol definition 2024-01-02 07:09:21 +01:00
Ryan Joseph
ecfff40f96 * Implement parsing of RTTI directive 2024-01-02 07:09:21 +01:00
Ryan Joseph
a31f37b5e5 + Implement support for parsing sets in preprocessor directives 2024-01-02 07:09:21 +01:00
Ryan Joseph
bc72021039 * Define RTTI directive parameters 2024-01-02 07:09:21 +01:00
Sven/Sarah Barth
a4121d2201 * use SizeInt instead of PtrInt for the stack area size (this both matches the declaration in TypInfo as well as enough on 16-bit targets like i8086) 2024-01-02 07:09:19 +01:00
Nikolay Nikolov
93d38629aa + added check for whether R_WASM_TABLE_INDEX_I32 relocations always point to a function symbol in the wasm internal object reader 2024-01-01 23:52:25 +02:00
Nikolay Nikolov
dd1565c667 * wasm internal exe writer: set mempos for code sections to the offset within
the code section. This does not affect the .wasm binary generation, only the
  linker map file.
2024-01-01 23:09:54 +02:00
Nikolay Nikolov
c49ac16a19 * wasm internal linker: start the .text section at mempos 0 2024-01-01 22:54:16 +02:00
Nikolay Nikolov
5eb5fdabad * start the data at offset 1024 instead of 0, just like the LLVM linker 2024-01-01 22:38:03 +02:00
Nikolay Nikolov
baa81d5275 + allocate stack and set the initial value for the stack pointer in the wasm internal exe writer 2024-01-01 22:32:48 +02:00
Nikolay Nikolov
eaf9a9f1b9 * fixed bug in the application of RELOC_GLOBAL_INDEX_LEB fixups in the wasm internal exe writer 2024-01-01 22:14:39 +02:00
Nikolay Nikolov
ec206cf490 + wasm internal linker: write the exported functions to the export section in the exe writer 2024-01-01 22:05:03 +02:00
Nikolay Nikolov
c4a77a832f + write export section in the wasm internal linker exe writer, only the memory is exported for now 2024-01-01 21:20:37 +02:00
Nikolay Nikolov
d03963afe9 + generate the global section in the wasm internal linker exe writer 2024-01-01 21:11:56 +02:00
florian
27be091c44 * more clean variable initialization 2024-01-01 19:31:04 +01:00
Nikolay Nikolov
f48282d7b3 + implemented R_WASM_GLOBAL_INDEX_LEB relocations in the wasm internal linker 2024-01-01 20:09:04 +02:00
Nikolay Nikolov
bbeb98aeef + wasm internal linker: put all wasm global symbols in separate sections,
called .wasm_globals.n_XXX. This allows section-based smartlinking to work on
  global symbols.
2024-01-01 19:06:24 +02:00
Nikolay Nikolov
cd93050d7e * set the size of AT_WASM_GLOBAL symbols to 1 2024-01-01 18:10:20 +02:00
Nikolay Nikolov
ef796906e9 + wasm internal obj reader: add globals to a '.wasm_globals' object section 2024-01-01 18:03:02 +02:00
Nikolay Nikolov
2eae62a6e8 * define the __stack_pointer symbol in a different way, so it doesn't crash during linking 2024-01-01 17:54:59 +02:00
Nikolay Nikolov
167c7bc565 + create relocations for R_WASM_GLOBAL_INDEX_LEB entires in the wasm object reader 2024-01-01 17:46:51 +02:00
Nikolay Nikolov
9ee13f2937 + also define non-imported SYMTAB_GLOBAL symbols in the wasm internal object reader 2024-01-01 17:40:31 +02:00
Nikolay Nikolov
408e388af3 + wasm internal linker: internally define the '__stack_pointer' global symbol 2024-01-01 17:36:52 +02:00
Nikolay Nikolov
880d0333b0 + wasm internal object reader: process SYMTAB_GLOBAL import entries 2024-01-01 17:25:56 +02:00
Nikolay Nikolov
e6a68b28b6 * wasm internal linker: produce an error if an R_WASM_SECTION_OFFSET_I32 or an
R_WASM_TAG_INDEX_LEB relocations is encountered - these aren't implemented,
  and are not required for 'hello, world', so will be done later.
2024-01-01 17:12:07 +02:00
Nikolay Nikolov
4208fc79c7 + implemented R_WASM_MEMORY_ADDR_SLEB and R_WASM_TABLE_INDEX_SLEB relocations in the wasm internal linker 2024-01-01 17:08:36 +02:00
Nikolay Nikolov
b440f57739 + implemented R_WASM_MEMORY_ADDR_LEB relocations in the wasm internal linker 2024-01-01 17:04:35 +02:00
Nikolay Nikolov
5771245d74 + create the Table and Elem sections in the wasm exe writer 2024-01-01 16:56:53 +02:00
Nikolay Nikolov
7a228bccfc + implement R_WASM_TABLE_INDEX_I32 relocations in the wasm internal linker 2024-01-01 16:41:03 +02:00
Nikolay Nikolov
1b2d29ea1a + implemented R_WASM_MEMORY_ADDR_I32 relocations in the wasm internal linker 2024-01-01 16:13:11 +02:00
Nikolay Nikolov
12d7d271d6 + write the data section in the wasm internal linker exe writer 2024-01-01 15:58:17 +02:00
Nikolay Nikolov
1e89579766 + WASI internal linker: implemented GetCodeSize, GetDataSize and GetBssSize. 2024-01-01 15:32:28 +02:00
Nikolay Nikolov
b361b41a86 + webassembly internal linker: create separate exe sections for .rodata and .bss 2024-01-01 14:56:33 +02:00
Nikolay Nikolov
dc4689ba1b * wasm internal linker: start the data section at offset 0, as WebAssembly is a Harvard architecture. 2024-01-01 14:44:44 +02:00
Nikolay Nikolov
69ce966691 + implemented RELOC_TYPE_INDEX_LEB relocations in the wasm internal linker 2024-01-01 14:35:10 +02:00
Nikolay Nikolov
0b3238bcd3 * refactor: invert if condition and else statement (reducing the nesting level), because then terminates the function. No functional changes. 2024-01-01 14:04:29 +02:00
Nikolay Nikolov
5845bb9095 * produce an internal error, instead of a warning in case of RELOC_FUNCTION_INDEX_LEB pointing to a function with missing ExeFunctionIndex 2024-01-01 14:03:03 +02:00
Nikolay Nikolov
50986967f5 + wasm internal linker: fill ExeFunctionIndex of alias code symbols as well 2024-01-01 14:01:43 +02:00
Nikolay Nikolov
cf79ca16b4 * only set MainFuncSymbol of code sections to the main (non-alias) symbol 2024-01-01 13:44:36 +02:00
Nikolay Nikolov
c453bac7ad + report an error in case a wasm object file has a code section, without a main symbol 2024-01-01 13:42:24 +02:00
Nikolay Nikolov
e1d56a9944 * wasm internal linker: use the main symbol (without WASM_SYM_EXPLICIT_NAME,
i.e. not an alias) to define code section names in the wasm object reader.
  For example, the section for the INITHEAP function is now called:
    .text.n_SYSTEM_$$_INITHEAP
  instead of
    .text.n__FPC_InitHeap
  (which is based on an explicit alias for the function - '_FPC_InitHeap')
2024-01-01 13:35:23 +02:00
Nikolay Nikolov
7747e1f6c8 + wasm internal linker: write the functions, defined in the current module in the linker map file 2024-01-01 13:20:28 +02:00
Nikolay Nikolov
409de5ac96 + write the import function indexes in the linker map file 2024-01-01 13:13:48 +02:00
Nikolay Nikolov
1c1dbaf776 + partial implementation of RELOC_FUNCTION_INDEX_LEB relocations in the wasm internal linker 2024-01-01 01:05:49 +02:00
Nikolay Nikolov
f4f6a16796 + fill the memory section in the wasm exe writer 2024-01-01 00:39:14 +02:00
Nikolay Nikolov
507e9eb20a + added check for the ExeFunctionIndex inside WriteCodeSegments 2024-01-01 00:15:27 +02:00
Nikolay Nikolov
88a42c3ee0 + write the type indexes correctly 2023-12-31 23:50:53 +02:00
Nikolay Nikolov
f5dbd38b7e * extracted the import preparation to a separate method TWasmExeOutput.PrepareImports 2023-12-31 23:39:26 +02:00
Nikolay Nikolov
946fc370e9 * set TWasmObjSection.MainFuncSymbol in the wasm object reader 2023-12-31 23:32:51 +02:00
Nikolay Nikolov
ac0c187b56 + WebAssembly exe writer: write the code section 2023-12-31 23:29:33 +02:00
Nikolay Nikolov
d9a67bb16d + generate the import section in the wasm exe writer 2023-12-31 22:52:03 +02:00
Nikolay Nikolov
2c72b62a0e + generate and write the Type section in the WebAssembly internal exe writer 2023-12-31 22:47:07 +02:00
Nikolay Nikolov
3c4a1087f3 * writing of the type wasm object section extracted to a method TWasmFuncTypeTable.WriteTo, so it can be reused in the exe writer 2023-12-31 22:43:44 +02:00
Nikolay Nikolov
a387accf81 * WriteWasmBasicType and WriteWasmResultType converted to global functions to allow reuse in the exe writer 2023-12-31 22:39:35 +02:00