Include new instruction execute_cpred to perform tail optimisation for
builtins. Required changes: - be careful about creeping in deallocate: it may be followed by something that is not a cut nor a proceed. - include new instruction in absmi.c: it is a merge of execute and call_cpred. - change compiler to generate execute even for C builtins. - be careful with dexecute: it may not be done if execute_op is a C builtin. - if we are in execute_cpred, the garbage collector cannot trust P: instead it must look at CP to find out the size of the current environment. The macro gc_P receives that information. - We don't need to change CP if we do a meta-call from within execute_cpred (and we in fact cannot). Check places where we do meta-calls: exec, clause in cdmgr, and lu_recorded.
This commit is contained in:
@@ -3284,7 +3284,7 @@ p_peek_mem_write_stream (void)
|
||||
if (H + 1024 >= ASP) {
|
||||
UNLOCK(Stream[sno].streamlock);
|
||||
H = HI;
|
||||
if (!Yap_gcl((ASP-HI)*sizeof(CELL), 3, ENV, P)) {
|
||||
if (!Yap_gcl((ASP-HI)*sizeof(CELL), 3, ENV, gc_P(P,CP))) {
|
||||
UNLOCK(Stream[sno].streamlock);
|
||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||
return(FALSE);
|
||||
@@ -5842,7 +5842,7 @@ p_same_file(void) {
|
||||
{
|
||||
struct stat *b1, *b2;
|
||||
while ((char *)H+sizeof(struct stat)*2 > (char *)(ASP-1024)) {
|
||||
if (!Yap_gcl(2*sizeof(struct stat), 2, ENV, P)) {
|
||||
if (!Yap_gcl(2*sizeof(struct stat), 2, ENV, gc_P(P,CP))) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user