mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 00:30:21 +02:00
loop detection in the house
* libguile/vm-i-scheme.c (vector-ref, vector-set): Sync registers if we call out to C. * module/language/tree-il/compile-glil.scm (flatten-lambda): Add an extra argument, the self-label, which should be the gensym under which the procedure is bound in a <fix> expression. (flatten): If we see a call to a lexical ref to the self-label in a tail position, rename and goto instead of goto/args, which will tear down the frame -- or will, in the future. It's a primitive form of loop detection. * module/language/tree-il/primitives.scm (zero?): Expand to (= x 0).
This commit is contained in:
parent
80af116875
commit
9b29d60791
3 changed files with 54 additions and 23 deletions
|
@ -315,7 +315,10 @@ VM_DEFINE_FUNCTION (129, vector_ref, "vector-ref", 2)
|
|||
&& i < SCM_I_VECTOR_LENGTH (vect)))
|
||||
RETURN (SCM_I_VECTOR_ELTS (vect)[i]);
|
||||
else
|
||||
RETURN (scm_vector_ref (vect, idx));
|
||||
{
|
||||
SYNC_REGISTER ();
|
||||
RETURN (scm_vector_ref (vect, idx));
|
||||
}
|
||||
}
|
||||
|
||||
VM_DEFINE_INSTRUCTION (130, vector_set, "vector-set", 0, 3, 0)
|
||||
|
@ -329,7 +332,10 @@ VM_DEFINE_INSTRUCTION (130, vector_set, "vector-set", 0, 3, 0)
|
|||
&& i < SCM_I_VECTOR_LENGTH (vect)))
|
||||
SCM_I_VECTOR_WELTS (vect)[i] = val;
|
||||
else
|
||||
scm_vector_set_x (vect, idx, val);
|
||||
{
|
||||
SYNC_REGISTER ();
|
||||
scm_vector_set_x (vect, idx, val);
|
||||
}
|
||||
NEXT;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue