Commit Graph

63434 Commits

Author SHA1 Message Date
Nikolay Nikolov
a5dcd1c44d + initial implementation of try..except in branchful exceptions mode 2021-10-05 03:14:58 +03:00
Nikolay Nikolov
7ce19c1ad7 + implemented try..finally in branchful exceptions mode 2021-10-05 02:47:49 +03:00
Nikolay Nikolov
7afb665c92 + insert exception flag check and branch after each function call, when
compiling in WebAssembly branchful exceptions mode
2021-10-05 02:26:13 +03:00
Nikolay Nikolov
5be1bfeeca + added comment that states that raiseBr is only used in branchful exceptions mode 2021-10-05 01:11:31 +03:00
Nikolay Nikolov
d02921d66b + introduced raiseBr, similar to exitBr, but will point to the current
innermost exception handler, if there is such a handler in the current
  procedure, otherwise it will be the same as exitBr.
2021-10-05 01:07:37 +03:00
Nikolay Nikolov
6599f1d898 - don't generate any WebAssembly native exception handling instructions, nor
relocations, when compiling in branchful exceptions mode. This produces a
  currently not working, but accepted by wasmtime binary (otherwise, it
  complains it doesn't support exceptions and refuses to try to run it).
2021-10-05 01:01:24 +03:00
Nikolay Nikolov
30b503abc4 * instead of using the 'throw' intrinsic, set a boolean flag, in the branchful
exceptions support code
2021-10-05 00:49:29 +03:00
Nikolay Nikolov
5124ab2521 * cloned the WebAssembly native exceptions code generation and rtl support into
the branchful exceptions (which will be modified later, but we're using this
  as their starting point, because we can get a snapshot built, without compiler
  internal errors)
2021-10-05 00:37:20 +03:00
Pierre Muller
7778d20003 Avoid range check error in TCpuAsmOptimizer.OptPostAnd method 2021-10-04 21:08:24 +00:00
florian
1e136b0cc7 * bail out early in MatchInstruction 2021-10-04 22:18:53 +02:00
florian
01a449c807 + debug msg added 2021-10-04 22:11:08 +02:00
Jonas Maebe
c745ae4836 AArch64 popt: don't replace registers with X/WZR
Most arithmetic/logica instructions don't support X/WZR as operand (since
you should use movk with the calculated constant in that case)

Resolves #39372
2021-10-04 20:58:05 +02:00
Yuriy Sydorov
e9d318e7e2 * x86: Fixed update of used registers in the CMOV optimizations.
This fixes a bug reported by Martin Frb in fpc-devel which is triggered
  by the recently provided test code in FPC 3.2.2 x86_64, but is hidden
  in trunk by other pipeline peephole optimizations.
2021-10-04 18:10:34 +03:00
Nikolay Nikolov
3989a01968 - removed msg2inc. Stupid git added it without my consent. 2021-10-04 00:34:18 +03:00
Nikolay Nikolov
9a85ac204c + fixed compilation of ppudump 2021-10-04 00:29:27 +03:00
florian
494dac5db5 + x86: MovOp2Op optimization 2021-10-03 23:17:27 +02:00
Nikolay Nikolov
1011c31a80 + increase string type to avoid const string truncation 2021-10-04 00:15:27 +03:00
Nikolay Nikolov
2577180b93 + introduced WebAssembly branchful exceptions 2021-10-04 00:10:31 +03:00
Jonas Maebe
ab01b0ebd7 Typed constants: no internalerror on failure
Don't check whether the expression queue is empty in the destructor in case
there was an error. Also improved error messages (constant expression instead
of variable expression expected).

Resolves #39393
2021-10-03 21:46:23 +02:00
J. Gareth "Curious Kit" Moreton
190c77e863 Fixed bug where hp1 object was used after being freed 2021-10-03 19:45:22 +01:00
florian
2e8c99947a * define DEBUG_AOPTCPU if EXTDEBUG is used 2021-10-03 18:40:20 +02:00
Nikolay Nikolov
890b899842 + support the <= and >= operators for smallsets on the Z80 2021-10-03 18:33:00 +03:00
Nikolay Nikolov
b00c0e44a5 + support equality comparison of smallsets on the Z80 2021-10-03 18:16:45 +03:00
Jonas Maebe
3fb0fab410 Fix bitpacking 62/63 bit fields on 64 bit targets
As reported on the lazarus forum:
* https://forum.lazarus.freepascal.org/index.php?topic=56341.new
* https://forum.lazarus.freepascal.org/index.php/topic,56339.msg418608/topicseen.html

Also optimized nextpowerof2 in the compiler
2021-10-03 14:00:50 +02:00
Nikolay Nikolov
41db71c21c + implemented the <= operator for smallsets for WebAssembly 2021-10-03 04:37:13 +03:00
Nikolay Nikolov
799cd957e6 + added WASI .o files for the tests for linking with C 2021-10-03 04:11:51 +03:00
Nikolay Nikolov
be90ad1672 + enabled compilation of unit heaptrc for the WASI target 2021-10-03 03:29:54 +03:00
Nikolay Nikolov
5adec3ca98 + workaround for WebAssembly treating the stack parameter of the store and load
instructions as unsigned. This caused an 'out of bounds memory access' trap
  when accessing arrays with negative offset index, e.g. in test/cg/tvec.pp
2021-10-03 03:16:34 +03:00
Nikolay Nikolov
0a383d8c0f * fixed WebAssembly method pointer assignment 2021-10-03 02:27:19 +03:00
Nikolay Nikolov
77ca8ba16d * always return error in SysUtils.FindFirst and .FindNext on the WASI platform,
in order to prevent infinite loops in tests
2021-10-03 01:08:52 +03:00
Nikolay Nikolov
6f88919f37 - don't set casmdata in wasm32/aasmcpu.pas, so that the aasmdef unit can override it 2021-10-03 00:59:11 +03:00
Nikolay Nikolov
c1eeb8beda + use the aasmdef unit in wasm32/cpunode.pas 2021-10-03 00:49:53 +03:00
Nikolay Nikolov
020a58b075 + added system_wasm32_embedded to systems_embedded 2021-10-02 23:14:24 +03:00
Nikolay Nikolov
c450b63f1c + enabled compilation of the fpintres unit for the WASI target and enabled tf_has_winlike_resources for the target 2021-10-02 22:43:05 +03:00
J. Gareth "Kit" Moreton
4b39f7dea0 x86: Missed logic with CMP and MOV optimisations 2021-10-02 19:32:44 +00:00
Nikolay Nikolov
cc2fa67dfa * fixed OS_S8 to OS_16 conversion for WebAssembly. This fixes test/cg/tcnvint6 2021-10-02 22:10:34 +03:00
Nikolay Nikolov
3258937d97 + implemented move() for WebAssembly via the memory.copy instruction 2021-10-02 21:33:28 +03:00
Nikolay Nikolov
2e3e3edb5f + implemented FillChar for WebAssembly via the memory.fill instruction 2021-10-02 20:31:37 +03:00
Nikolay Nikolov
85207e94f8 + added inline numbers for a memory.copy and a memory.fill intrinsic 2021-10-02 19:40:36 +03:00
Nikolay Nikolov
026d23632a + added the memory.copy and memory.fill WebAssembly instructions 2021-10-02 19:35:26 +03:00
florian
cc5ee6b868 + comments 2021-10-02 16:24:47 +02:00
florian
39164ad732 * cleanup 2021-10-02 16:15:19 +02:00
florian
c1d8e32eae + Aarch64: Ldr<Postfix>Mov2Ldr<Postfix> optimization 2021-10-02 16:07:00 +02:00
florian
b5c7997c88 + Aarch64: AndCmpB.E/NE2Tbnz/Tbz optimization 2021-10-02 15:46:37 +02:00
florian
177b38dfe9 * modified (cosmetics) patch by Rika: replace DJB2 with MurmurHash3, resolves #39377 2021-10-01 23:06:31 +02:00
Nikolay Nikolov
02745b0b83 + implemented GetDate, GetTime and WeekDay in the WASI dos unit. They return
UTC time (I don't know how to obtain the local time zone from within WASI).
2021-10-01 06:34:52 +03:00
Nikolay Nikolov
d2726c2406 * fixed WebAssembly code generation for not(cbool64) 2021-10-01 05:17:12 +03:00
Nikolay Nikolov
9aefda1e6a * bug fix in test taddbool.pp - it was testing longbool conversion to boolean
twice, and not testing wordbool conversion to boolean at all
2021-10-01 04:56:36 +03:00
Nikolay Nikolov
4fc763ac50 * fixed WebAssembly cbool support for OP_NOT 2021-10-01 04:54:17 +03:00
Nikolay Nikolov
baf5ff4e05 * another WebAssembly cbool fix in twasmtypeconvnode.second_int_to_bool 2021-10-01 04:40:50 +03:00