Skip to content

Commit 58411e4

Browse files
JanWielemakerclaude
andcommitted
CLEANUP: drop compileClauseGuarded() and its C_STACK_OVERFLOW_GUARDED wrapper
compileBody(), analyseVariables2(), setVars(), compileArgument() and compileArithArgument() no longer recurse on the C stack, so the SIGSEGV-catching guard around the compiler is redundant. Fold compileClauseGuarded() back into compileClause() and remove the cleanupCompile() helper the guard used. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8dda5e7 commit 58411e4

1 file changed

Lines changed: 6 additions & 35 deletions

File tree

src/pl-comp.c

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,49 +1994,20 @@ goal-term and therefore initialised. This implies there is no need to
19941994
play around with variable tables.
19951995
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
19961996

1997-
#define compileClauseGuarded(ci, cp, head, body, proc, module, warnings, flags) \
1998-
LDFUNC(compileClauseGuarded, ci, cp, head, body, proc, module, warnings, flags)
1999-
static ssize_t compileClauseGuarded(DECL_LD CompileInfo ci, Clause *cp, Word head, Word body,
2000-
Procedure proc, Module module, term_t warnings,
2001-
int flags);
2002-
2003-
#ifdef O_C_STACK_GUARDED
2004-
#define cleanupCompile(ci) LDFUNC(cleanupCompile, ci)
2005-
2006-
static void
2007-
cleanupCompile(DECL_LD CompileInfo ci)
2008-
{ resetVars();
2009-
discardBuffer(&ci->codes);
2010-
}
2011-
#endif
2012-
20131997
ssize_t
20141998
compileClause(DECL_LD Clause *cp, Word head, Word body,
20151999
Procedure proc, Module module, term_t warnings,
20162000
int flags)
2017-
{ compileInfo ci; /* data base for the compiler */
2018-
ssize_t rc;
2019-
2020-
ci.progress = 0;
2021-
initBuffer(&ci.codes);
2022-
2023-
C_STACK_OVERFLOW_GUARDED(
2024-
rc,
2025-
compileClauseGuarded(&ci, cp, head, body, proc, module, warnings, flags),
2026-
cleanupCompile(&ci));
2027-
2028-
return rc;
2029-
}
2030-
2031-
static ssize_t
2032-
compileClauseGuarded(DECL_LD CompileInfo ci, Clause *cp, Word head, Word body,
2033-
Procedure proc, Module module, term_t warnings,
2034-
int flags)
2035-
{ struct clause clause = {0};
2001+
{ compileInfo _ci; /* data base for the compiler */
2002+
CompileInfo ci = &_ci;
2003+
struct clause clause = {0};
20362004
Clause cl;
20372005
Definition def = getProcDefinition(proc);
20382006
ssize_t rc;
20392007

2008+
ci->progress = 0;
2009+
initBuffer(&ci->codes);
2010+
20402011
if ( head )
20412012
{ ci->islocal = false;
20422013
ci->subclausearg = false;

0 commit comments

Comments
 (0)