-
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PORT: Use portable definition of
struct clause
- Loading branch information
1 parent
cfb2b8f
commit b343b56
Showing
3 changed files
with
17 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
Author: Jan Wielemaker | ||
E-mail: [email protected] | ||
WWW: http://www.swi-prolog.org | ||
Copyright (c) 1997-2024, University of Amsterdam | ||
Copyright (c) 1997-2025, University of Amsterdam | ||
VU University Amsterdam | ||
CWI, Amsterdam | ||
SWI-Prolog Solutions b.v. | ||
|
@@ -389,6 +389,8 @@ struct PL_global_data | |
int cgc_space_factor; /* Max total/margin garbage */ | ||
double cgc_stack_factor; /* Price to scan stack space */ | ||
double cgc_clause_factor; /* Pce to scan clauses */ | ||
Clause top_clause; /* See PL_open_query() */ | ||
struct clause_ref top_cref; /* Its reference */ | ||
} clauses; | ||
|
||
struct | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
Author: Jan Wielemaker | ||
E-mail: [email protected] | ||
WWW: http://www.swi-prolog.org | ||
Copyright (c) 1985-2024, University of Amsterdam, | ||
Copyright (c) 1985-2025, University of Amsterdam, | ||
VU University Amsterdam | ||
CWI, Amsterdam | ||
SWI-Prolog Solutions b.v. | ||
|
@@ -1419,7 +1419,7 @@ struct clause | |
unsigned int references; /* # ClauseRef pointing at me */ | ||
unsigned int tr_erased_no; /* # transactions that erased me */ | ||
code code_size; /* size of ->codes */ | ||
code codes[1]; /* VM codes of clause */ | ||
code codes[]; /* VM codes of clause */ | ||
}; | ||
|
||
typedef struct arg_info | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
Author: Jan Wielemaker | ||
E-mail: [email protected] | ||
WWW: http://www.swi-prolog.org | ||
Copyright (c) 1985-2024, University of Amsterdam | ||
Copyright (c) 1985-2025, University of Amsterdam | ||
VU University Amsterdam | ||
CWI, Amsterdam | ||
SWI-Prolog Solutions b.v. | ||
|
@@ -2721,18 +2721,17 @@ PL_open_query(Module ctx, int flags, Procedure proc, term_t args) | |
size_t i, arity; | ||
Word ap; | ||
size_t lneeded; | ||
static int top_initialized = false; | ||
static struct clause clause; | ||
static struct clause_ref cref; | ||
|
||
if ( !top_initialized ) | ||
{ clause.predicate = PROCEDURE_dc_call_prolog->definition; | ||
clause.generation.erased = ~(gen_t)0; | ||
clause.code_size = 1; | ||
clause.codes[0] = encode(I_EXITQUERY); | ||
cref.value.clause = &clause; | ||
if ( !GD->clauses.top_clause ) | ||
{ Clause cl = allocHeapOrHalt(sizeofClause(1)); | ||
|
||
top_initialized = true; | ||
memset(cl, 0, sizeofClause(1)); | ||
cl->predicate = PROCEDURE_dc_call_prolog->definition; | ||
cl->generation.erased = ~(gen_t)0; | ||
cl->code_size = 1; | ||
cl->codes[0] = encode(I_EXITQUERY); | ||
GD->clauses.top_cref.value.clause = cl; | ||
GD->clauses.top_clause = cl; /* MT-safe as a init is a single thread */ | ||
} | ||
|
||
DEBUG(2, { FunctorDef f = proc->definition->functor; | ||
|
@@ -2782,7 +2781,7 @@ PL_open_query(Module ctx, int flags, Procedure proc, term_t args) | |
top->parent = NULL; | ||
top->predicate = PROCEDURE_dc_call_prolog->definition; | ||
top->programPointer= NULL; | ||
top->clause = &cref; | ||
top->clause = &GD->clauses.top_cref; | ||
#ifdef O_PROFILE | ||
if ( LD->profile.active ) | ||
top->prof_node = profCall(top->predicate); | ||
|
@@ -2801,7 +2800,7 @@ PL_open_query(Module ctx, int flags, Procedure proc, term_t args) | |
fr->parent = top; | ||
setNextFrameFlags(fr, top); | ||
set(top, FR_HIDE_CHILDS); | ||
fr->programPointer = clause.codes; | ||
fr->programPointer = GD->clauses.top_clause->codes; | ||
|
||
DEBUG(CHK_SECURE, checkStacks(NULL)); | ||
assert((uintptr_t)fli_context > (uintptr_t)environment_frame); | ||
|