Commit Graph

63575 Commits

Author SHA1 Message Date
Karoly Balogh
e018264ad9 internalerror if the section we're about to keep has no exesection assigned 2021-10-20 14:37:27 +02:00
Nikolay Nikolov
4e3a6aa5a8 * match the label to the wider block, if it is adjacent to both the brevious
and the next instruction
2021-10-20 14:35:52 +03:00
Nikolay Nikolov
c96e203780 * moved the 'end_block' WebAssembly instruction before the 'exit' label right
before the procedure finalization code. This fixes compilation errors in
  procedures with implicit finalization code (e.g. for ansistring local vars,
  etc).
2021-10-20 14:35:52 +03:00
Nikolay Nikolov
03513720a3 * fixed range check error in the DOS unit 2021-10-20 14:35:52 +03:00
Nikolay Nikolov
bb30958665 + wrap block nodes with exit in a_block..a_end_block instructions. This fixes
'exit' in inlined procedures on the WebAssembly target.
2021-10-20 14:35:51 +03:00
Nikolay Nikolov
703ae75ba6 * if a label cannot be associated with the previous block instruction, try
matching it with the next instruction
2021-10-20 14:35:51 +03:00
Nikolay Nikolov
9f077d4ac0 * leave unresolved branches in the asm output, when the compiler is compiled with -dEXTDEBUG 2021-10-20 14:35:51 +03:00
Nikolay Nikolov
1ce2fb8a4a * use WebAssembly asm labels for generating code for the 'exit' statement 2021-10-20 14:35:51 +03:00
mattias
2fa60d1af3 fcl-pasrc: error if exports section inside inside procedure 2021-10-20 11:53:40 +02:00
mattias
0aecf4d89f pastojs: library: create and call main 2021-10-20 11:32:54 +02:00
mattias
20ae686e31 pastojs: test unit linklib 2021-10-20 10:58:56 +02:00
mattias
3ceddfb2d6 pastojs: added test linklib 2021-10-20 10:37:32 +02:00
mattias
1e80ae406d pastojs: comments 2021-10-20 10:37:32 +02:00
Sven/Sarah Barth
b876a02daf * the libc unit might be deprecated, but it's no reason for wrong declarations, in this case values that should be declared as octal but were declared as decimal with the same literal text 2021-10-20 09:57:20 +02:00
Nikolay Nikolov
dc9090e67f * fixed some more warnings 2021-10-20 10:23:02 +03:00
Nikolay Nikolov
b3a9c36cbb * fixed some warnings 2021-10-20 10:03:14 +03:00
Nikolay Nikolov
0662a0bd44 + use WebAssembly asm labels for the code generation of 'break' statements as well 2021-10-20 09:59:54 +03:00
Nikolay Nikolov
01dc62b127 + introduced the use of asm labels for WebAssembly. Resolve them in
tcpuprocinfo.postprocess_code. Use them when generating code for the
  'continue' label jumps.
2021-10-20 09:39:44 +03:00
florian
e1698a5969 * when compiling with the main branch compiler, p2align with 3 parameters can be used now 2021-10-19 21:32:40 +02:00
Nikolay Nikolov
6921b968f1 - removed TWasiSearchRec.Mode, because it was unused 2021-10-19 17:31:02 +03:00
Nikolay Nikolov
8c39213d39 + implemented DOS.FSearch for WASI 2021-10-19 16:24:43 +03:00
Nikolay Nikolov
8e730d20db + implemented FindFirst, FindNext and FindClose in SysUtils for the WASI platform 2021-10-19 15:39:59 +03:00
Nikolay Nikolov
090cc8fa8f * moved the FindFirst/FindNext/FindClose code from unit DOS to WasiUtil, using
RawByteString. This will allow to reuse the same implementation in SysUtils.
2021-10-19 13:39:20 +03:00
Nikolay Nikolov
0ead28c1e0 - removed the RtlInfoType record, because it is only used only once in a local
variable. Use an anonymous record instead.
2021-10-19 12:01:14 +03:00
Nikolay Nikolov
6cd88575c6 - removed unused, commented out fields from the RtlInfoType record 2021-10-19 11:51:25 +03:00
Nikolay Nikolov
78c4585b53 * the FNMatch private helper function moved from unit DOS to unit WasiUtil, and
changed to have rawbytestring parameters, so it can be used from SysUtils as
  well.
2021-10-19 11:36:01 +03:00
Nikolay Nikolov
de3ab7e46b * added the fpc_wasi_path_readlink_ansistring helper function to unit wasiutil 2021-10-19 09:39:25 +03:00
Nikolay Nikolov
b2a0df0d10 * ConvertToFdRelativePath removed from the interface part of the WASI system
unit (to avoid cluttering the WASI system unit interface with platform
  dependent routines) and added to a new unit, called wasiutil
2021-10-19 09:06:56 +03:00
Pierre Muller
c616832792 Disable utils packages for wasi OS if required package is not supported or if labels are used (which is not supported for wasm32 target CPU) 2021-10-18 22:41:38 +00:00
Pierre Muller
d4e610dbc3 Disable utils/fpcmkcfg package for wasi OS as it requires packages/fpmkunit package 2021-10-18 22:03:42 +00:00
florian
7e73e0dd23 + support reading of .p2align with op code and/or max. bytes in the gas assembler reader
+ test
2021-10-18 22:12:27 +02:00
mattias
b8102dcdc0 fcl-js: fixed stackoverflow when freeing long binary list 2021-10-18 21:34:05 +02:00
mattias
6cfee2f5d5 fcl-passrc: updated lpi 2021-10-18 21:33:31 +02:00
florian
bdc826cc18 * x86-64: do not jump in inc/declocked to return but return directly 2021-10-17 22:44:52 +02:00
florian
08050086b9 * keep type when removing "1*", resolves #38840 2021-10-17 22:23:49 +02:00
Michaël Van Canneyt
e97e27b8d5 * Raise exception for fileseek positions that do not fit in longing. Issue #39407 2021-10-17 17:58:11 +02:00
Michaël Van Canneyt
1e74c418ae * Fix integer overflow not being detected. Issue #39406 2021-10-17 12:44:44 +02:00
florian
ee10850a57 * patch by Sergey Larin: Reducing and aligning the size of TAnsiRec, TUnicodeRec for CPU64, resolves #38018:
For CPU64, the size of record TAnsiRec and TUnicodeRec is 16 bytes instead of 24.
    Which is very good also because of the alignment. when allocating memory, the address
    of the first character of the string will be aligned on the 16-byte boundary.
    At the same time, the useless Dummy field, which is needed in CPU64 for exactly alignment, has been removed.
    For CPU32 (and CPU16), the record size has not changed, so procedures such as
    fpc_AnsiStr_Decr_Ref, implemented in assembler (see i386, arm), remained working correctly.
  * tests adapted
2021-10-17 11:13:29 +02:00
florian
ea6529ff63 * manually merged merge request 69 by J. Gareth "Kit" Moreton:
x86: CMP/MOV refactoring and expansion
      This merge request refactors the SwapMovCmp routine, and calls to it, to be more self-contained,
      having the preliminary checks built-in to ensure that moving the MOV instruction is
      actually a sound idea, while also making it more general-purpose so it can handle instructions
      that are not MOV operations. This feature is primarily for future expansion,
      but also cleans up the code for the x86 peephole optimizer.
2021-10-17 10:22:30 +02:00
florian
4012c3dbd4 * merge request 75 by J. Gareth "Kit" Moreton manually applied:
This merge request makes a number of improvements to the DeepMOVOpt method and supporting functions:

      * ReplaceRegisterInInstruction now replaces registers in references that are written to
        (since the registers themselves won't change)
      * RegModifiedByInstruction will no longer return True for a register that appears in a reference
        that's written to (for the same reason as above) - special operations like MOVSS
        (the 0-operand version) aren't affected.
      * DeepMOVOpt returning True will now always set the Result of OptPass1MOV to True even though p
        wasn't directly modified, since this often caused missed optimisations.
      * Some of the speed-ups in the patch from #32916 have also been applied in order to make
        the general DeepMOVOpt run faster, notably it tries to avoid calling UpdateUsedRegs where possible.
2021-10-17 09:50:47 +02:00
florian
5c75ef30ce * test for #37785 which is resolved meanwhile 2021-10-16 20:44:52 +02:00
J. Gareth "Curious Kit" Moreton
fd28cc0db0 Better handling of zeroing upper parts of registers
Better handling of zeroing upper parts of registers
2021-10-16 14:42:19 +02:00
J. Gareth "Curious Kit" Moreton
674ed4069a Expanded MM block move to include YMM registers under AVX 2021-10-16 14:17:41 +02:00
florian
d55b2c2a35 + extend assembler optimization MovxMov2Mov to MovxOp2Op 2021-10-15 23:12:59 +02:00
Nikolay Nikolov
21d843128d + added a wrapper function around __wasi_path_readlink that calls it iteratively
with doubling buffer sizes, starting with 64 bytes, until it reaches 16384
  bytes, and reads the link into a rawbytestring. Use that function in all
  places in the WASI rtl that need to read a symlink.
2021-10-15 14:33:43 +03:00
Nikolay Nikolov
0da5d57c1e * replaced the 'if br end_if' sequence with the 'br_if' instruction, when
generating WebAssembly code for try..finally blocks (in all exception modes)
2021-10-14 14:19:13 +03:00
Nikolay Nikolov
dcae87bd52 + support cdecl and stdcall on the WebAssembly target. They are essentially the
same, the only difference is that cdecl creates an unmangled alias
2021-10-14 12:29:59 +03:00
Nikolay Nikolov
b91fc3a0d3 * fixed passing of singleton record parameters, containing a float in WebAssembly 2021-10-14 10:53:55 +03:00
Nikolay Nikolov
df92d88f39 + added support for the handling of singleton record and array types in
defToWasmBasic
2021-10-14 10:53:55 +03:00
Nikolay Nikolov
3511b80972 * fixed formatting in defToWasmBasic 2021-10-14 10:53:55 +03:00