Commit Graph
100 Commits
Author SHA1 Message Date
Bennet Bleßmann 3ad4b05a97 add a features for gating things we can use once 1.80 is msrv 2024-07-25 23:09:17 +02:00
Bennet Bleßmann 0da313eb84 use a OnceLock static for LIBRARIES instead of thread_local! static 2024-07-25 18:58:29 +02:00
Bennet Bleßmann 6b50ec328c move the creation of the LIBRARIES IndexMap out of the generated file
- only leave the filling of the map in the generated code
2024-07-25 18:53:36 +02:00
Bennet Bleßmann 1eb6a883f6 run rustfmt 2024-07-23 00:01:58 +02:00
Bennet Bleßmann e7fd408548 use include_str! for the build in libraries
instead of "copy-paste-ing" the prolog source into rust string literals in the generated files
2024-07-23 00:01:29 +02:00
Bennet Bleßmann 5d03be4b09 fix leak of slaps with dropped payload 2024-07-07 19:22:46 +02:00
Bennet Bleßmann 689632b51c cleanup the slab types
- get rid of HeaderOrIdxPtr
- add IndexPtrSlab
- add UntypedArenaSlab
- add to_untyped for converting a typed slab into an unsyped slab
- remove TypedArenaPtr::new, as they shouldn't be created outside of this module
2024-07-07 17:12:52 +02:00
Bennet Bleßmann 1b19ae81d5 wrap Payloads that are dropped eraly in ManuallyDrop 2024-07-07 15:58:31 +02:00
Bennet Bleßmann a0d790445d check that we don't attempt to un-drop while evacuating 2024-07-07 14:37:41 +02:00
Bennet Bleßmann 213ee5ca45 add AllocateInArena as a Pivot for arena_alloc!
so that the value type passed to `arena_alloc!` can differ from the `ArenaAllocated::Payload` type
2024-07-07 14:36:53 +02:00
Bennet Bleßmann 74720d4d2e remove unsafe impl From<UntypedArenaPtr> for CodeIndex 2024-07-07 14:18:50 +02:00
Bennet Bleßmann 496e4e9f56 fix clippy again 2024-07-07 11:31:36 +02:00
Bennet Bleßmann 89c1ea4232 fix leak of ArenaAllocated IndexPtr 2024-07-07 11:30:56 +02:00
Bennet Bleßmann a2a50586aa replace static Once and two mut statics with one static OnceLock 2024-07-07 11:30:56 +02:00
Bennet Bleßmann 0284a2092d reduce span of unsafe block 2024-07-07 11:30:37 +02:00
Bennet Bleßmann c414f75329 switch macos to latest as macos-11 has been removed
See https://github.com/actions/runner-images/issues/9255
2024-07-06 18:47:35 +02:00
Bennet Bleßmann 943dce566b fix clippy 2024-07-06 18:26:34 +02:00
Bennet Bleßmann b32498b37c adjust ignore reason 2024-07-06 18:24:38 +02:00
Bennet Bleßmann ea041a40f9 if UB un IndexPtr ArenaAllocated impl 2024-07-06 17:43:13 +02:00
Bennet Bleßmann 1d66f91a41 replace ref_thread_local::ref_thread_local! with std::thread_local!
removes `ref_thread_local` which was still at 0.0.0 released October 2018 while latest 0.1.1 was released mid November 2021

fixes libraries.rs UB
2024-07-06 17:18:26 +02:00
Bennet Bleßmann fee7ba58b0 fix stack alignement
- adjust align() in RawBlockTraits impl for Stack
- ensure ptr is always aligned in RawBlock::allock
2024-07-06 16:21:59 +02:00
Bennet Bleßmann 8e53d12776 make components a comma seperated string instead of a list 2024-07-06 16:01:52 +02:00
Bennet Bleßmann 33793193cc add miri to CI 2024-07-06 15:46:04 +02:00
Bennet Bleßmann 285f11ccdc add associated Payload type to ArenaAllocated 2024-07-06 15:37:08 +02:00
Bennet Bleßmann d87400afa0 switch Rcu to the arcu crate
The arcu crate is a more general implementation of the Rcu I implemented in here in scryer. It contains some bug-fixes regarding race-conditions in the Rcu update function, which could cause leaks and uses after free.

Source of the problem was the Relaxed load/strore/update of the reference count in side the Arc not being properly ordered with other load/stores.
2024-07-06 14:49:19 +02:00
Bennet Bleßmann fcb41542c3 fix stream.rs UB 2024-07-06 14:30:03 +02:00
Bennet Bleßmann 87b4c9d736 somehow this was never marked as bad 2024-07-06 14:30:03 +02:00
Bennet Bleßmann 6386e70584 clippy: change ToString impl to Display
- write directly to formatter, eliminating intermediate String allocations
- take Value by reference eliminating clones
- remove trim() called on the result of  QueryResolution::to_string
    - we only  emit "true", "false", or "[<resolutions>]"
      neither of which contains trailing or leading withespace,
      so the calls was effectively a noop
2024-07-06 13:32:58 +02:00
Bennet Bleßmann 722975d77e clippy: use type associated constants 2024-07-06 13:08:59 +02:00
Bennet Bleßmann 8943962704 clippy: ptr dereference in safe function 2024-07-06 13:07:26 +02:00
Bennet Bleßmann ed57ef3d01 clippy: identity conversion 2024-07-06 13:06:50 +02:00
Bennet Bleßmann 9e7d41025a fix saftey comment 2024-07-06 13:06:24 +02:00
Bennet Bleßmann d2f236d116 clippy: explicit ptr addrs comparision
relevant for wide pointers i.e. pointers with metadata
2024-07-06 13:06:13 +02:00
Bennet Bleßmann 1ff995fedb clippy: allow new without default 2024-07-06 13:04:55 +02:00
Bennet Bleßmann 1b16c6c73f clippy: use clone_from rather than clone 2024-07-06 13:03:14 +02:00
Bennet Bleßmann ceac9c9095 clippy: ignore unused fields on PrologBenchmark struct 2024-07-06 13:01:19 +02:00
Bennet Bleßmann 467a82fe46 run rustfmt 2024-07-06 04:18:02 +02:00
Bennet Bleßmann ce40f8f10c update ignore reason 2024-07-06 04:15:30 +02:00
Bennet Bleßmann d2d451b182 adjust the generation of the LIBRARIES map
pre-genrate constants instaed of driectly genrating the literal for the insert
2024-07-06 03:53:22 +02:00
Bennet Bleßmann 52fa51853e don't use env::current_dir() in miri 2024-07-06 03:53:22 +02:00
Bennet Bleßmann 6575b1b573 fix some more miri errors
probably relevant to mthom/scryer-prolog#2438
2024-07-06 03:52:46 +02:00
Bennet Bleßmann cba81b4dc7 some test pass miri 2024-07-06 02:43:00 +02:00
Bennet Bleßmann 91253917b4 remove rust_beta_channel feature
- the msrv (i.e. rust-version in Cargo.toml) is high enough that all gated code can now be used on stabe
2024-07-06 02:24:26 +02:00
Bennet Bleßmann 821358c062 unify pointer width 2024-07-06 01:49:25 +02:00
Bennet Bleßmann 3de0a4e2ad replace transmut with pointer cast calls 2024-07-06 01:38:13 +02:00
Bennet Bleßmann b8a3067744 resolve miri error for pstr_iter_tests in atom_table
relevant to mthom/scryer-prolog#2438
2024-07-06 01:21:03 +02:00
Bennet Bleßmann 7509cc1a07 adjust alignment calculation
- I think this used to overallocate when the alignment was already met
2024-07-06 00:13:46 +02:00
Bennet Bleßmann dd2548453b rework some unsafe parts
- removed some unsafe
- added some safety comments
- add explicit types to transmute calls
- reworked UntypedArenaPtr -> TypedArenaPtr conversion

might help with mthom/scryer-prolog#2438, I noticed fewer complains from miri after changing the default impl for `ArenaAllocated::alloc`
2024-07-05 23:45:02 +02:00
Bennet Bleßmann a93585080c remove remains of num feature
commit c41aba6b90 removed the num feature but a few cfgs remained
2024-07-05 21:29:38 +02:00
Bennet Bleßmann 45a8a7bb31 create swap file for wasm32 build 2024-05-29 19:50:27 +02:00
Bennet Bleßmann 1a9d10d298 fix two clippy lints 2024-05-28 21:28:18 +02:00
Bennet Bleßmann 80a0cab6ab re-add CI job to test Cargo.toml rust-version
was removed in #2393 instead of being updated, see

- https://github.com/mthom/scryer-prolog/pull/2393#discussion_r1585963855 and
- https://github.com/mthom/scryer-prolog/commit/79bc2d9c68da2257a94eb22ef8717a304173e344#commitcomment-141790142
2024-05-28 21:27:29 +02:00
Bennet Bleßmann e9982dc447 fix build of run_iai bench for wasm32 2024-02-17 00:15:03 +01:00
Bennet Bleßmann 7028baaf8f fix benchmarks being broken for every target except wam32 2024-02-17 00:01:10 +01:00
Bennet Bleßmann 7837c76c74 cfg out benches for wasm32 2024-02-16 23:43:22 +01:00
Bennet Bleßmann e5ad70c093 fix compilation of wasm32 test and skip to run wasm32 tests 2024-02-16 23:18:21 +01:00
Bennet Bleßmann 7fce688769 undo continue-on-error
- currently  `continue-on-error` is not shown in a usefull way on failiure see <https://github.com/orgs/community/discussions/15452>
2024-02-16 22:23:22 +01:00
Bennet Bleßmann 90c874777c bump ahash lock to 0.8.7
- fix nightly build
- not bumping to latest aka. 0.8.8 as that has a msrv of 1.72.0 and we are only at 1.70.0
2024-02-16 22:15:32 +01:00
Bennet Bleßmann 5928d64d7a make F64Table concurency safe 2023-09-05 19:39:59 +02:00
Bennet Bleßmann c7ec5a13a5 remove locks from AtomTable
there are technically still two locks
- the Mutex to serialize consurrent updates to the AtomTable
- the RwLock as part of GLOBAL_ATOM_TABLE

the former is the age lock of RESIZE ATOM TABLE in <https://arxiv.org/pdf/1608.00989.pdf>, though we use it for the whole update as we don't match the whole structure and can't reserve an atom slot as is, so we need to also lock concurrent updates without resizing

the later should be uncontendet as we only write AtomTable::new iff the current value is a dangling Weak
2023-09-05 19:39:59 +02:00
Bennet Bleßmann 01aeb7515d [WIP] move towards lockless AtomTable 2023-09-05 19:39:46 +02:00
Bennet Bleßmann 13cbff7eab [WIP] fix deadlock in AtomTable::build_with 2023-09-05 19:12:22 +02:00
Bennet Bleßmann a70157003b fix spelling 2023-07-29 13:11:00 +02:00
Bennet Bleßmann 6aa3c7d5d6 handle atom table resize
* bumping serial_test dev-dependency due to broken should_panic handling in old version
2023-07-29 11:22:25 +02:00
Bennet Bleßmann 4ef8c5c47d detect and prevent² concurrent AtomTable use
²in the case of `#[cfg(not(test))]` there is still a toctou race as I am not sufficently familiar with Atomics
2023-07-27 23:37:03 +02:00
Skgland 45db236ec7 add a CI job to verify msrv is still correct 2022-03-12 19:23:34 +01:00
Skgland 5848ff5735 add min rust version
was proposed in https://github.com/mthom/scryer-prolog/issues/1335#issuecomment-1062039516 and got positive feedback

(cherry picked from commit fcfa3beaa3)
2022-03-12 19:23:33 +01:00
Skgland 5bd73741cf add a CI job to verify msrv is still correct 2022-03-12 19:02:34 +01:00
Skgland fcfa3beaa3 add min rust version
was proposed in https://github.com/mthom/scryer-prolog/issues/1335#issuecomment-1062039516 and got positive feedback
2022-03-12 18:57:33 +01:00
Skgland 590d80268e only rerun build.rs when something in src/ has changed
by default (when no rerun-if is emitted) build.rs is rerun if something in the package changes
2022-01-10 21:20:07 +01:00
Skgland a5de329712 don't genrate code in src/
[Outputs of Build Script](https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script) states that only files in $OUT_DIR may be modified
2022-01-10 21:19:18 +01:00
Skgland 49e024bdd8 remove unused fields instead, prompting more dead_code removal 2021-11-11 19:32:35 +01:00
Skgland 7bc4876071 fix failing lint warnings in beta build 2021-11-11 18:53:08 +01:00
Skgland e7899ee15e pass -f to scryer-prolog in cargo test so that we ignore .scryerrc
fixes issue #1085
2021-11-11 11:37:05 +01:00
Skgland 2089727c7f ignore setup_call_cleanup tests as their output is apparently non-deterministic 2021-06-02 17:41:14 +02:00
Skgland fbbf705d10 fix tests 2021-06-02 17:15:31 +02:00
Skgland e08c302756 fix beta build 2021-06-02 16:43:10 +02:00
Skgland 08320119f1 fix expected output for syntax_error test 2021-03-11 17:01:26 +01:00
Skgland 49dcd9bb4a address problems brought up in review 2021-03-11 16:16:31 +01:00
Skgland 8f41603101 add more tests
for some of the recently closed issues
2021-03-11 01:52:22 +01:00
Skgland d437609365 improve comment 2021-03-11 01:52:21 +01:00
Skgland e1c681fffe clean up tests/
give helper function a more descriptive name
2021-03-11 01:52:21 +01:00
Skgland 40e5a2dc35 workaround to make num tests work 2021-03-03 01:18:24 +01:00
Skgland 5a78f02dcb revert removal of PartialEq 2021-02-28 19:21:32 +01:00
Skgland 0a08464d4f move the signal handler to the binary 2021-02-28 19:21:31 +01:00
Skgland a638d42d92 remove #[allow(dead_code)]
only commenting out the unused variant as `OptArgIndexKeyType`
as it appears to mirror `OptArgIndexKey` and there List is not unused
so this appears to be not yet used rather than obsolete
2021-02-28 19:21:31 +01:00
Skgland 90256ea2f5 fix CI lib build with beta compiler 2021-02-28 19:21:31 +01:00
Skgland 90aefd35f0 adjust ci 2021-02-28 19:21:30 +01:00
Skgland 2f428b7261 split into lib and bin
* makes most pub things in src/ pub(crate) as not to expose things accidentally
  * only those things needed by src/bin/scryer-prolog.rs and tests/scryer.rs
    should be pub
* split src/main.rs into src/lib.rs and src/bin/scryer-prolog.rs
* add tests folder and run most of the files in src/tests with cargo test
  added bytes method to Stream in src/machine/streams.rs to check if stdout is as expected
2021-02-28 19:21:30 +01:00
Skgland 5041042925 rename prolog_parser_rebis to prolog_parser
also remove remaining extern crate statements that slipped through earlier
2021-02-06 22:13:34 +01:00
Skgland 0d983e63a1 fix incorrect rug path 2021-02-06 22:13:06 +01:00
Skgland 3f7a60d84b more clippy lints 2021-02-06 22:13:06 +01:00
Skgland 1eb9fcf521 more clippy lints 2021-02-06 22:13:06 +01:00
Skgland 1571690bbb fix clippy lint match|if let looks like matches! macro 2021-02-06 22:13:05 +01:00
Skgland eb2133e648 fix clippy lint Manual RangeInclusive::contains implementation 2021-02-06 22:13:05 +01:00
Skgland 9107b3ddbe fix some clippy lint warnings 2021-02-06 22:13:05 +01:00
Skgland 64433bd8dd fix macro hygien 2021-02-06 22:13:04 +01:00
Skgland bc6159c538 change prolog_parse_rebis to use 2018 edition rust
so all crates use the same edition
2021-02-06 22:13:04 +01:00
Skgland 8e5954f36f remove use statements from main.rs that temporary replaced extern crate and fixed paths that previously used them 2021-02-06 22:13:04 +01:00
Skgland b53ef148a0 remove extern crate declaration and fix outfall (macros now need to be imported into scope)
using use declarations in main.rs so that use paths don't need to be updated as well, this will be done in a later commit
2021-02-06 22:12:31 +01:00