]> Repositorios git - scryer-prolog.git/commitdiff
very minor optimizations
authorMark Thom <[email protected]>
Mon, 18 Apr 2022 02:10:13 +0000 (20:10 -0600)
committerMark Thom <[email protected]>
Mon, 18 Apr 2022 02:10:13 +0000 (20:10 -0600)
Cargo.toml
src/lib/builtins.pl
src/machine/system_calls.rs

index 7ed79773e38115b81244a7c455568bf74c9e3fe1..89241b959d981f84e6118a64b1976607293bca27 100644 (file)
@@ -79,4 +79,4 @@ modular-bitfield = { git = "https://github.com/mthom/modular-bitfield" }
 num-rug-adapter = { git = "https://github.com/mthom/num-rug-adapter" }
 
 [profile.release]
-debug = true
+debug = true
\ No newline at end of file
index b839ee5de331dc34d37685b90c317efca88a3225..786c56f257ba4869e074c04954297c6049767639 100644 (file)
@@ -587,8 +587,6 @@ read(Term) :-
     current_input(Stream),
     read(Stream, Term).
 
-% term_variables.
-
 % ensures List is either a variable or a list.
 can_be_list(List, _)  :-
     var(List),
@@ -603,6 +601,8 @@ can_be_list(List, _)  :-
 can_be_list(List, PI) :-
     throw(error(type_error(list, List), PI)).
 
+% term_variables.
+
 term_variables(Term, Vars) :-
     can_be_list(Vars, term_variables/2),
     '$term_variables'(Term, Vars).
@@ -1375,13 +1375,14 @@ must_be_number(N, PI) :-
     ;  throw(error(instantiation_error, PI))
     ).
 
-can_be_chars_or_vars(Cs, _) :- var(Cs), !.
+can_be_chars_or_vars(Cs, _)  :- var(Cs), !.
 can_be_chars_or_vars(Cs, PI) :- chars_or_vars(Cs, PI).
 
 chars_or_vars([], _).
 chars_or_vars([C|Cs], PI) :-
     (  nonvar(C) ->
-       (  catch(builtins:atom_length(C, 1), _, false) ->
+       (  atom(C),
+          atom_length(C, 1) ->
           (  nonvar(Cs) ->
              chars_or_vars(Cs, PI)
           ;  false
index 3d27e93a36bf3bc6a3711b16aa804ee766305f06..fcbeb5538b6f623ad81567eff717bec7645c316f 100644 (file)
@@ -707,7 +707,7 @@ impl MachineState {
         indices: &IndexStore,
         stub_gen: impl Fn() -> FunctorStub,
     ) -> CallResult {
-        let nx = self.registers[2];
+        let nx = self.store(self.deref(self.registers[2]));
 
         if let Some(c) = string.chars().last() {
             if layout_char!(c) {