Nikolay Nikolov
b340994e1b
* proper implementation for the function Sptr (which returns the stack pointer) for WebAssembly
2024-08-06 03:16:41 +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
Nikolay Nikolov
a417b0db9b
* WebAssembly threads: simplified (optimized) the implementation of
...
TWasmRTLEvent, so it doesn't use a Mutex. Use atomic operations instead.
2024-08-05 00:31:27 +03:00
florian
4afb07cc5e
+ Risc-V 32: tcpuparamanager.get_saved_registers_fpu
2024-08-04 23:03:44 +02:00
Nikolay Nikolov
74a4550ff0
* WebAssembly threads: fix TThread.WaitFor (use -1 instead of 0 to signal infinite timeout)
2024-08-04 21:09:18 +03:00
Nikolay Nikolov
6be3a42a2f
* WebAssembly: optimized SysOSAlloc to use memory area left at the end of the
...
page (64kb). This reduces memory use, when SysOSAlloc is called with sizes,
smaller than 64kb.
2024-08-04 18:04:10 +03:00
Michaël Van Canneyt
a0c11becde
* Small fix in saveobject
2024-08-04 12:02:05 +02:00
Nikolay Nikolov
801f902efe
* WebAssembly threads: fix threadvars with the new WASI-threads implementation
2024-08-04 05:50:06 +03: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
7681c192db
* WebAssembly threads: protect SysOSAlloc against race conditions via a critical section
2024-08-04 03:15:31 +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
Nikolay Nikolov
31bb06ac87
+ WebAssembly threads: initial implementation of the WASI threads proposal:
...
https://github.com/WebAssembly/wasi-threads
Note that the WASI folk have already declared this proposal 'obsolete' and
only intended to be used for engines that support WASI v0.1. On the other
hand, the WASI v0.2 threads proposal is an early draft and not implemented
anywhere, so we have no choice, but to stay with v0.1 at this time, or give up
on multithreading for who knows how long it would take for the v0.2 spec to be
completed.
Regarding the WASI v0.1 engines that implement WASI threads correctly and can
be used with Free Pascal, I've discovered only one that works:
https://github.com/bytecodealliance/wasm-micro-runtime/tree/main
Wasmtime claims to support multithreading since version 15, however it doesn't
seem to work. I tested all versions until the 23.0.1, and none of them works.
Caveat: using the internal linker is not yet supported with WebAssembly and
multithreading. Please use the external linker (the -Xe option), if you want
to give this new feature a try.
2024-08-04 02:24:20 +03:00
Nikolay Nikolov
bb93b918a5
* WebAssembly threads: don't check for GetThreadState(MyThread)<>tsRunning in
...
LockMutexTimeoutWait and LockMutexTimeoutNoWait
2024-08-04 01:56:25 +03:00
Nikolay Nikolov
694341aa78
* WebAssembly threads: fixed bug in LockMutexTimeoutNoWait, caused by the use of
...
Result instead of Res. This stupid bug broke WebAssembly critical sections,
causing random spurious hangs and it took me quite a lot of time to find it!
2024-08-04 00:37:16 +03:00
Nikolay Nikolov
c2fcb1a833
* WebAssembly threads: reformat code in LockMutexTimeoutNoWait for better
...
readability by removing begin..end blocks and replacing it with an 'else if'
chain. No functional changes.
2024-08-04 00:33:44 +03:00
florian
cc2406ad74
* factor out TRVCpuAsmOptimizer.OptPass1Add
2024-08-03 21:55:41 +02:00
Nikolay Nikolov
e612401562
* WebAssembly threads: also access TRTLCriticalSection.Owner using atomic loads and stores
2024-08-03 02:58:32 +03:00
Nikolay Nikolov
6a1eb520e9
* WebAssembly threads: use atomic loads and stores for accessing TRTLCriticalSection.Locked
2024-08-03 02:51:27 +03:00
Nikolay Nikolov
41ead20bfb
* WebAssembly threads: fixed race condition LockMutex in the check where Locked
...
is 1, but Owner still holds the current thread id, even though another thread
has just acquired a lock, but still haven't updated the owner thread ID. We
avoid this problem by setting Owner to nil before unlocking the mutex. And in
InitMutex/DoneMutex, we store the creator thread ID in a different field -
Creator, instead of Owner.
2024-08-03 02:34:05 +03:00
Nikolay Nikolov
692bd62359
* WebAssembly threads: bug fixes in LockMutexTimeoutWait
2024-08-03 01:29:04 +03:00
florian
8708144c50
+ RiscV: AndiAndi2Andi
2024-08-02 22:15:37 +02:00
Nikolay Nikolov
a179ca8cf8
* WebAssembly mutex: changed the timeout parameter to be in nanoseconds (these
...
functions are only used internally, so this doesn't break compatibility)
2024-08-02 23:10:06 +03:00
Nikolay Nikolov
a21dfc0245
* WebAssembly mutex: changed the aTimeoutMS parameters of LockMutexTimeoutNoWait
...
and LockMutexTimeoutWait to int64, instead of longint, since they're called
from LockMutexTimeout, which takes an int64 parameter
2024-08-02 23:02:33 +03:00
Nikolay Nikolov
6d45fd09a2
* WebAssembly mutex: treat all negative values of aTimeoutMS as infinite, instead of just -1
2024-08-02 22:59:31 +03:00
Jan Rysavy
08bae9ee2e
OpenSSL: add support for OSSL_PARAM, EVP_PKEY_encrypt, EVP_PKEY_decrypt
2024-08-02 15:29:56 +00:00
florian
5b5a8b3387
* add cpuriscv to be on the safe side
2024-08-01 22:40:11 +02:00
florian
80febbd8cf
* Risc-V: use OptPass1OP more
2024-08-01 22:24:07 +02:00
Michaël Van Canneyt
406d5f4147
* Dump certificate in temp dir. Fixes issue #40872
2024-08-01 18:39:27 +02:00
Nikolay Nikolov
04b9bc7702
* fix typo in comment
2024-07-31 15:02:47 +03:00
florian
13dfd1cafd
* get rid of a couple of more tabs
2024-07-30 22:31:24 +02:00
Nikolay Nikolov
1a93cad4f3
* fixed conversion between milliseconds and nanoseconds in LockMutexTimeoutNoWait and LockMutexTimeoutWait
2024-07-30 20:47:38 +03:00
Nikolay Nikolov
b9a6b01c97
* WebAssembly threads: set M.Locked to 0 on UnLockMutex
2024-07-30 20:37:49 +03:00
Nikolay Nikolov
8413c2b073
* optimization in WebAssembly's MutexKind() function - mark the first parameter
...
as const, to avoid making a copy on the stack
2024-07-30 17:36:09 +03:00
Nikolay Nikolov
c6794dd7d7
* fixed WebAssembly InitMutex() and DoneMutex() - pass the parameter by reference
2024-07-30 17:32:56 +03:00
Nikolay Nikolov
5de7084d35
* WasiRTLEventWaitFor_WaitNotAllowed: treat timeout of 0 as zero wait time,
...
instead of infinite time, for consistency with WasiRTLEventWaitFor_WaitAllowed
(and other platforms, such as Windows)
2024-07-30 17:15:47 +03:00
Nikolay Nikolov
038ecaef92
* fixed WasiRTLEventWaitFor_WaitAllowed: second parameter is expected value to wait on (0), not wait to wait for (1)
2024-07-30 17:14:13 +03:00
Nikolay Nikolov
2fb300c5c0
* fixes to WebAssembly RTLEventWaitFor:
...
* correct conversion from milliseconds to nanoseconds (multiply by 1000000,
instead of 1000)
* use a negative timeout value, instead of 0, to indicate infinite wait
timeout. Using 0 with the 'wait' instruction indicates no wait at all.
2024-07-30 16:49:36 +03:00
Karoly Balogh
6f7d2136c6
h68units: new h68kutil unit, with various constans for now. more to come.
2024-07-30 15:08:31 +02:00
Karoly Balogh
1cea95e8e0
h68units: also credit Federico Roviralta for his X68K related work
2024-07-30 15:08:31 +02:00
Karoly Balogh
bcaf8d1409
h68units: added some more IOCS calls, mostly related to hardware sprite handling
2024-07-30 15:08:31 +02:00
Karoly Balogh
c20178b6e1
h68units: fix copyright year in h68iocs unit. no functional change
2024-07-30 15:08:31 +02:00
Nikolay Nikolov
1a714d688a
* fixed WasiRTLCreateEvent to actually return the result
2024-07-30 15:12:24 +03:00
Nikolay Nikolov
e579da0844
+ implemented CheckInitialStkLen for the WASI target (just returns the parameter
...
stklen as a result value, unmodified)
2024-07-29 22:52:33 +03:00
Michaël Van Canneyt
3e098316fd
* Handle tkFloat in TValue.ToString
2024-07-29 20:48:16 +02:00
Michaël Van Canneyt
303c0378e9
* Send properties sorted
2024-07-29 17:55:53 +02:00
Michaël Van Canneyt
3160e45316
* String must not be shortstring
2024-07-29 17:55:53 +02:00
Michaël Van Canneyt
04a9cc3ed9
* INdicate required dictionary fields
2024-07-29 17:55:53 +02:00
florian
f35a565f4e
* fix condition to match the comment
2024-07-29 17:38:36 +02:00