diff --git a/packages/PLStream/pl-global.h b/packages/PLStream/pl-global.h index d6b4ded2b..e1fa1b173 100644 --- a/packages/PLStream/pl-global.h +++ b/packages/PLStream/pl-global.h @@ -76,6 +76,11 @@ typedef struct { atom_t *for_code[256]; /* code --> one-char-atom */ } atoms; + struct + { + int optimise; /* -O: optimised compilation */ + } cmdline; + struct { ExtensionCell _ext_head; /* head of registered extensions */ ExtensionCell _ext_tail; /* tail of this chain */ @@ -167,6 +172,7 @@ typedef struct PL_local_data { occurs_check_t occurs_check; /* Unify and occurs check */ } feature; + source_location read_source; /* file, line, char of last term */ struct diff --git a/packages/PLStream/pl-prologflag.c b/packages/PLStream/pl-prologflag.c index 3c135e767..6460f5000 100644 --- a/packages/PLStream/pl-prologflag.c +++ b/packages/PLStream/pl-prologflag.c @@ -994,7 +994,6 @@ initPrologFlags(void) #if defined(HAVE_GETPID) || defined(EMULATE_GETPID) setPrologFlag("pid", FT_INTEGER|FF_READONLY, getpid()); #endif - setPrologFlag("optimise", FT_BOOL, GD->cmdline.optimise, PLFLAG_OPTIMISE); setPrologFlag("generate_debug_info", FT_BOOL, truePrologFlag(PLFLAG_DEBUGINFO), PLFLAG_DEBUGINFO); setPrologFlag("last_call_optimisation", FT_BOOL, TRUE, PLFLAG_LASTCALL); @@ -1100,6 +1099,8 @@ initPrologFlags(void) } #endif #endif /* YAP_PROLOG */ + /* Flags copied by YAP */ + setPrologFlag("optimise", FT_BOOL, GD->cmdline.optimise, PLFLAG_OPTIMISE); /* FLAGS used by PLStream */ setPrologFlag("tty_control", FT_BOOL|FF_READONLY, truePrologFlag(PLFLAG_TTY_CONTROL), PLFLAG_TTY_CONTROL); diff --git a/pl/flags.yap b/pl/flags.yap index a1b039f89..0982737e8 100644 --- a/pl/flags.yap +++ b/pl/flags.yap @@ -67,6 +67,13 @@ yap_flag(fileerrors,X) :- yap_flag(fileerrors,X) :- '$swi_set_prolog_flag'(fileerrors, X). +% -O optimisation +yap_flag(optimise,X) :- + var(X), !, + '$swi_current_prolog_flag'(optimise, X). +yap_flag(optimise,X) :- + '$swi_set_prolog_flag'(optimise, X). + % control garbage collection yap_flag(gc,V) :- var(V), !, @@ -834,6 +841,7 @@ yap_flag(dialect,yap). '$yap_system_flag'(n_of_integer_keys_in_db). '$yap_system_flag'(open_expands_filename). '$yap_system_flag'(open_shared_object). +'$yap_system_flag'(optimise). '$yap_system_flag'(profiling). '$yap_system_flag'(prompt_alternatives_on). '$yap_system_flag'(readline).