From 7b09d447d6ed4533c773a0c492cbe5c7561794e8 Mon Sep 17 00:00:00 2001 From: Aleksy Grabowski Date: Thu, 18 Jul 2024 08:15:25 +0200 Subject: [PATCH 1/8] Fix rustc warning --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index ddb6f239..8807f58f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ repl = ["dep:crossterm", "dep:ctrlc", "dep:rustyline"] hostname = ["dep:hostname"] tls = ["dep:native-tls"] http = ["dep:warp", "dep:reqwest"] +num = [] crypto-full = [] "rust-version-1.80" = [] From 6f0c7f42c6a94b866876644de01800582a52fc21 Mon Sep 17 00:00:00 2001 From: Aleksy Grabowski Date: Fri, 12 Jul 2024 21:15:32 +0200 Subject: [PATCH 2/8] Remove executable bit for files that don't need it --- .dockerignore | 0 Dockerfile | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 .dockerignore mode change 100755 => 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore old mode 100755 new mode 100644 diff --git a/Dockerfile b/Dockerfile old mode 100755 new mode 100644 From 61c258f49ed6a821ff734acb354e6cc37986fd9c Mon Sep 17 00:00:00 2001 From: Aleksy Grabowski Date: Fri, 6 Sep 2024 08:07:21 +0200 Subject: [PATCH 3/8] Fix mistake in predicate indicator --- src/loader.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loader.pl b/src/loader.pl index 0998182d..0de805cf 100644 --- a/src/loader.pl +++ b/src/loader.pl @@ -790,7 +790,7 @@ qualified_spec((:)). qualified_spec(MS) :- integer(MS), MS >= 0. -:- non_counted_backtracking expand_meta_predicate_subgoals/5. +:- non_counted_backtracking expand_meta_predicate_subgoals/6. expand_meta_predicate_subgoals([SG | SGs], [MS | MSs], M, [ESG | ESGs], HeadVars, TGs) :- ( var(SG) -> From 2b7310763157eeaa8edb73a0f16217c5cd80e93f Mon Sep 17 00:00:00 2001 From: Aleksy Grabowski Date: Fri, 6 Sep 2024 08:15:45 +0200 Subject: [PATCH 4/8] Explain non_counted_backtracking a little bit more --- src/lib/iso_ext.pl | 1 + src/lib/ops_and_meta_predicates.pl | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/iso_ext.pl b/src/lib/iso_ext.pl index 3eb00a3e..5c779b10 100644 --- a/src/lib/iso_ext.pl +++ b/src/lib/iso_ext.pl @@ -223,6 +223,7 @@ run_cleaners_without_handling(Cp) :- %% call_with_inference_limit(Goal, Limit, Result). % % Similar to `call(Goal)` but it limits the number of inferences for each solution of Goal. +% Calls to it may be nested, but only the last limit will be in power. call_with_inference_limit(G, L, R) :- ( integer(L) -> ( L < 0 -> diff --git a/src/lib/ops_and_meta_predicates.pl b/src/lib/ops_and_meta_predicates.pl index 929165e3..d4f67671 100644 --- a/src/lib/ops_and_meta_predicates.pl +++ b/src/lib/ops_and_meta_predicates.pl @@ -5,9 +5,13 @@ :- op(1199, fx, meta_predicate). -/* this is an implementation specific declarative operator used to implement call_with_inference_limit/3 - and setup_call_cleanup/3. switches to the default trust_me and retry_me_else. Indexing choice - instructions are unchanged. */ +% Declarative operator used to implement `call_with_inference_limit/3` and +% `setup_call_cleanup/3`. Compiler switches to the default trust_me, retry_me_else +% and some other instructions for all predicates the marked with it. Indexing +% choice instructions are unchanged. +% +% Default instructins are not subject to inference counting, so their execution +% will not be considered if they happen to be called by `call_with_inference_limit/3`. :- op(700, fx, non_counted_backtracking). % arithmetic operators. From 7af93f153240b7ddb2023ea1a24d42db802e747a Mon Sep 17 00:00:00 2001 From: Aleksy Grabowski Date: Fri, 6 Sep 2024 08:20:13 +0200 Subject: [PATCH 5/8] Remove unnecessary "unsafe" block to fix compiler warning --- src/ffi.rs | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/ffi.rs b/src/ffi.rs index a3e93380..2895009b 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -89,27 +89,25 @@ impl ForeignFunctionTable { } fn map_type_ffi(&mut self, source: &Atom) -> *mut ffi_type { - unsafe { - match source { - atom!("sint64") => addr_of_mut!(types::sint64), - atom!("sint32") => addr_of_mut!(types::sint32), - atom!("sint16") => addr_of_mut!(types::sint16), - atom!("sint8") => addr_of_mut!(types::sint8), - atom!("uint64") => addr_of_mut!(types::uint64), - atom!("uint32") => addr_of_mut!(types::uint32), - atom!("uint16") => addr_of_mut!(types::uint16), - atom!("uint8") => addr_of_mut!(types::uint8), - atom!("bool") => addr_of_mut!(types::sint8), - atom!("void") => addr_of_mut!(types::void), - atom!("cstr") => addr_of_mut!(types::pointer), - atom!("ptr") => addr_of_mut!(types::pointer), - atom!("f32") => addr_of_mut!(types::float), - atom!("f64") => addr_of_mut!(types::double), - struct_name => match self.structs.get_mut(&*struct_name.as_str()) { - Some(ref mut struct_type) => &mut struct_type.ffi_type, - None => unreachable!(), - }, - } + match source { + atom!("sint64") => addr_of_mut!(types::sint64), + atom!("sint32") => addr_of_mut!(types::sint32), + atom!("sint16") => addr_of_mut!(types::sint16), + atom!("sint8") => addr_of_mut!(types::sint8), + atom!("uint64") => addr_of_mut!(types::uint64), + atom!("uint32") => addr_of_mut!(types::uint32), + atom!("uint16") => addr_of_mut!(types::uint16), + atom!("uint8") => addr_of_mut!(types::uint8), + atom!("bool") => addr_of_mut!(types::sint8), + atom!("void") => addr_of_mut!(types::void), + atom!("cstr") => addr_of_mut!(types::pointer), + atom!("ptr") => addr_of_mut!(types::pointer), + atom!("f32") => addr_of_mut!(types::float), + atom!("f64") => addr_of_mut!(types::double), + struct_name => match self.structs.get_mut(&*struct_name.as_str()) { + Some(ref mut struct_type) => &mut struct_type.ffi_type, + None => unreachable!(), + }, } } From 08aed04dd2aeed354d1f407158e3359437e8071a Mon Sep 17 00:00:00 2001 From: Aleksy Grabowski Date: Fri, 6 Sep 2024 10:25:45 +0200 Subject: [PATCH 6/8] Revert "Fix rustc warning" This reverts commit 7b09d447d6ed4533c773a0c492cbe5c7561794e8. --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 8807f58f..ddb6f239 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,6 @@ repl = ["dep:crossterm", "dep:ctrlc", "dep:rustyline"] hostname = ["dep:hostname"] tls = ["dep:native-tls"] http = ["dep:warp", "dep:reqwest"] -num = [] crypto-full = [] "rust-version-1.80" = [] From d3071988b2aa1f9ef73c8b1c62ef89d3333876f2 Mon Sep 17 00:00:00 2001 From: Aleksy Grabowski Date: Fri, 6 Sep 2024 10:26:17 +0200 Subject: [PATCH 7/8] Revert "Remove unnecessary "unsafe" block to fix compiler warning" This reverts commit 7af93f153240b7ddb2023ea1a24d42db802e747a. --- src/ffi.rs | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/ffi.rs b/src/ffi.rs index 2895009b..a3e93380 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -89,25 +89,27 @@ impl ForeignFunctionTable { } fn map_type_ffi(&mut self, source: &Atom) -> *mut ffi_type { - match source { - atom!("sint64") => addr_of_mut!(types::sint64), - atom!("sint32") => addr_of_mut!(types::sint32), - atom!("sint16") => addr_of_mut!(types::sint16), - atom!("sint8") => addr_of_mut!(types::sint8), - atom!("uint64") => addr_of_mut!(types::uint64), - atom!("uint32") => addr_of_mut!(types::uint32), - atom!("uint16") => addr_of_mut!(types::uint16), - atom!("uint8") => addr_of_mut!(types::uint8), - atom!("bool") => addr_of_mut!(types::sint8), - atom!("void") => addr_of_mut!(types::void), - atom!("cstr") => addr_of_mut!(types::pointer), - atom!("ptr") => addr_of_mut!(types::pointer), - atom!("f32") => addr_of_mut!(types::float), - atom!("f64") => addr_of_mut!(types::double), - struct_name => match self.structs.get_mut(&*struct_name.as_str()) { - Some(ref mut struct_type) => &mut struct_type.ffi_type, - None => unreachable!(), - }, + unsafe { + match source { + atom!("sint64") => addr_of_mut!(types::sint64), + atom!("sint32") => addr_of_mut!(types::sint32), + atom!("sint16") => addr_of_mut!(types::sint16), + atom!("sint8") => addr_of_mut!(types::sint8), + atom!("uint64") => addr_of_mut!(types::uint64), + atom!("uint32") => addr_of_mut!(types::uint32), + atom!("uint16") => addr_of_mut!(types::uint16), + atom!("uint8") => addr_of_mut!(types::uint8), + atom!("bool") => addr_of_mut!(types::sint8), + atom!("void") => addr_of_mut!(types::void), + atom!("cstr") => addr_of_mut!(types::pointer), + atom!("ptr") => addr_of_mut!(types::pointer), + atom!("f32") => addr_of_mut!(types::float), + atom!("f64") => addr_of_mut!(types::double), + struct_name => match self.structs.get_mut(&*struct_name.as_str()) { + Some(ref mut struct_type) => &mut struct_type.ffi_type, + None => unreachable!(), + }, + } } } From 3af24a8067173b3242cdb9357abe7f4fb0fadad4 Mon Sep 17 00:00:00 2001 From: Aleksy Grabowski Date: Sat, 7 Sep 2024 08:13:10 +0200 Subject: [PATCH 8/8] Revert "Explain non_counted_backtracking a little bit more" This reverts commit 2b7310763157eeaa8edb73a0f16217c5cd80e93f. --- src/lib/iso_ext.pl | 1 - src/lib/ops_and_meta_predicates.pl | 10 +++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/lib/iso_ext.pl b/src/lib/iso_ext.pl index 5c779b10..3eb00a3e 100644 --- a/src/lib/iso_ext.pl +++ b/src/lib/iso_ext.pl @@ -223,7 +223,6 @@ run_cleaners_without_handling(Cp) :- %% call_with_inference_limit(Goal, Limit, Result). % % Similar to `call(Goal)` but it limits the number of inferences for each solution of Goal. -% Calls to it may be nested, but only the last limit will be in power. call_with_inference_limit(G, L, R) :- ( integer(L) -> ( L < 0 -> diff --git a/src/lib/ops_and_meta_predicates.pl b/src/lib/ops_and_meta_predicates.pl index d4f67671..929165e3 100644 --- a/src/lib/ops_and_meta_predicates.pl +++ b/src/lib/ops_and_meta_predicates.pl @@ -5,13 +5,9 @@ :- op(1199, fx, meta_predicate). -% Declarative operator used to implement `call_with_inference_limit/3` and -% `setup_call_cleanup/3`. Compiler switches to the default trust_me, retry_me_else -% and some other instructions for all predicates the marked with it. Indexing -% choice instructions are unchanged. -% -% Default instructins are not subject to inference counting, so their execution -% will not be considered if they happen to be called by `call_with_inference_limit/3`. +/* this is an implementation specific declarative operator used to implement call_with_inference_limit/3 + and setup_call_cleanup/3. switches to the default trust_me and retry_me_else. Indexing choice + instructions are unchanged. */ :- op(700, fx, non_counted_backtracking). % arithmetic operators.