Daniel Kolesa
dc507f80dd
make thread safety a compile-time toggle
2022-04-21 04:54:47 +02:00
Daniel Kolesa
b430cf7c83
do not use deprecated std::aligned_storage
2022-04-21 04:15:31 +02:00
Daniel Kolesa
12bd267efc
implement atomic variable storage
...
Variable values are global, and can be accessed concurrently
from different cubescript threads. Make storage of var values
atomic so that it is safe to do so. This is done with a simple
load-store wrapper. It does not do any other operations on the
values, so we can handle floats and pointers this way as well.
Floats are simply stored in the smallest integer type that can
fully fit the float.
2022-04-21 04:08:44 +02:00
Daniel Kolesa
4cb7987ed9
add missing include
2022-04-20 05:03:01 +02:00
Daniel Kolesa
2406324a96
lock-free argument lookup
...
Since we know these ids are always early and up to a fixed index,
we can have a separate, fixed mapping for them, which is only
initialized once during state creation, and never changes.
2022-04-20 05:00:05 +02:00
Daniel Kolesa
4627321e23
fix foreach_ident
2022-04-20 04:38:16 +02:00
Daniel Kolesa
f26979a69f
protect ident lookups
...
These are global and may be accessed from different states,
so they need to be protected. Everything else generally lives
locally or is initialized upon startup.
2022-04-20 04:31:24 +02:00
Daniel Kolesa
41bae89472
ci: we can't actually use cpp_link_args this way...
2022-04-20 01:49:00 +02:00
Daniel Kolesa
af9577ccea
ci: more crappy mingw workarounds
2022-04-20 01:45:23 +02:00
Daniel Kolesa
a49b0c65ec
ci: try to work around some mingw nonsense
2022-04-20 01:34:18 +02:00
Daniel Kolesa
1f93c3ea19
update now obsolete comment
2022-04-20 01:27:41 +02:00
Daniel Kolesa
91e25607ac
make strman thread-safe
...
This and var storage are the only things that will need locking.
The locking here is handled transparently and care is taken to
keep the critical sections short and non-recursive, so that the
outer interface is safe to use.
Handling of non-string types should be all doable with atomics.
2022-04-20 01:25:02 +02:00
Daniel Kolesa
f332cc7475
remove some obsolete files
2022-04-20 00:56:13 +02:00
Daniel Kolesa
2eebfe8ba1
ci: disable libc++ for clang for now
...
There is something wrong with the ubuntu env.
2022-04-20 00:53:13 +02:00
Daniel Kolesa
e34186b9f6
add libc++ into the ci env
2022-04-20 00:50:55 +02:00
Daniel Kolesa
a35cf1a1fd
release 1.0.0 alpha1
...
No functional changes since the last commit. I decided that
I have nothing significant to actually change and am pretty
happy with how it is, so just ship it.
2022-04-20 00:42:07 +02:00
Daniel Kolesa
d748b0e671
remove state::get_idents
...
this was never going to be good from API standpoint, and is no
longer necessary (can use ident_count + get_ident by index with
a loop, for example)
2021-05-16 00:51:26 +02:00
Daniel Kolesa
4fb6b9a0bc
add ident getter by index, + ident count method on state
2021-05-16 00:50:14 +02:00
Daniel Kolesa
8086c23a77
memory safe error stack state
2021-05-15 23:27:34 +02:00
Daniel Kolesa
3189d87ac9
use a reference for the ident in stack node
2021-05-15 04:23:47 +02:00
Daniel Kolesa
b5127c52bf
simplify exec_alias more
2021-05-14 23:31:27 +02:00
Daniel Kolesa
72c3ecedb1
move cs thread call stack off real thread call stack
2021-05-14 23:14:48 +02:00
Daniel Kolesa
203e0bd5e4
exec_alias cleanups
2021-05-14 22:42:19 +02:00
Daniel Kolesa
263b12c1c4
stop using reinterpret_cast
2021-05-14 22:10:16 +02:00
Daniel Kolesa
6ffdc7fa91
various vm cleanups
2021-05-14 19:18:11 +02:00
Daniel Kolesa
036362683c
kill call_with_args template
2021-05-14 02:54:29 +02:00
Daniel Kolesa
8b04bd1488
refactor vm scope guard
2021-05-14 02:36:16 +02:00
Daniel Kolesa
36fb06425b
do not use lambdas with captures in vm
2021-05-13 04:48:55 +02:00
Daniel Kolesa
523586e3a6
mask vm loop always by opcode (fewer switch cases)
2021-05-13 00:43:44 +02:00
Daniel Kolesa
a5536d6974
more vm type handling cleanups
2021-05-12 04:09:18 +02:00
Daniel Kolesa
775d69cf1c
minor vm cleanups
2021-05-12 03:55:20 +02:00
Daniel Kolesa
497502bdb0
drop util::print_stack
2021-05-10 01:49:14 +02:00
Daniel Kolesa
43898b4798
make pcall not collect the entire bt, call body per level instead
2021-05-10 01:48:09 +02:00
Daniel Kolesa
a8d2bfc442
don't use print_stack in repl
2021-05-10 01:16:27 +02:00
Daniel Kolesa
1739cbed6e
remove separate stack_state
2021-05-09 20:21:35 +02:00
Daniel Kolesa
fdcc8a09e9
remove gap property from stack_state
2021-05-09 20:01:47 +02:00
Daniel Kolesa
6e779f827f
cap default recursion limit at 1024
2021-05-08 21:41:13 +02:00
Daniel Kolesa
201d6031b0
add missing file
2021-05-08 17:26:23 +02:00
Daniel Kolesa
54a7b4b7f1
add assert in lib_base, remove formatting public error api
2021-05-08 17:20:56 +02:00
Daniel Kolesa
dec7e844e7
use a regular union for any_value
2021-05-08 06:42:47 +02:00
Daniel Kolesa
7f74602b7e
add convenience constructors and assignment ops to any_value
2021-05-07 01:56:43 +02:00
Daniel Kolesa
1c56ea36ff
remove save_val
2021-05-07 01:13:02 +02:00
Daniel Kolesa
9437e0951b
eliminate type separation between IVAR/FVAR/SVAR
2021-05-07 00:07:13 +02:00
Daniel Kolesa
6218adb78a
remove public type specializations for vars
2021-05-06 23:13:48 +02:00
Daniel Kolesa
6fede13b97
remove set_value() specialization per-vartype
2021-05-06 04:13:11 +02:00
Daniel Kolesa
fa5e38afad
remove the call() specializations per-vartype
2021-05-06 04:07:45 +02:00
Daniel Kolesa
6a892b4b2c
move set_raw_value to builtin_var
2021-05-06 04:01:29 +02:00
Daniel Kolesa
74f437f851
s/global_var/builtin_var/
2021-05-06 03:47:38 +02:00
Daniel Kolesa
139ead5d72
fold BC_INST_IVAR/FVAR/SVAR into one instruction
2021-05-06 03:42:58 +02:00
Daniel Kolesa
a57072fb73
use any_value for var storage and return it from value()
2021-05-06 03:34:25 +02:00