mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 12:20:20 +02:00
remove @call-with-current-continuation memoizer
* module/ice-9/boot-9.scm (call-with-current-continuation): Change to primcall call-with-current-continuation. * libguile/memoize.h: * libguile/expand.c (scm_sym_atcall_cc): Remove. * libguile/memoize.c (memoize): Memoize call/cc primcalls to SCM_M_CONT. (m_call_cc): Remove. (unmemoize): Unmemoize to call-with-current-continuation. * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Update to call-with-current-continuation without @ prefix, and fix fallback case. * module/language/tree-il/primitives.scm (*multiply-valued-primitives*): (*interesting-primitive-names*): Remove @call-with-current-continuation. (call/cc): Expand to call-with-current-continuation. * test-suite/tests/tree-il.test ("call/cc"): Update to use and expect call-with-current-continuation primcalls / toplevel refs.
This commit is contained in:
parent
5da2aae364
commit
bc056057c8
7 changed files with 22 additions and 26 deletions
|
@ -282,6 +282,11 @@ memoize (SCM exp, SCM env)
|
|||
else if (nargs == 2
|
||||
&& scm_is_eq (name, scm_from_latin1_symbol ("apply")))
|
||||
return MAKMEMO_APPLY (CAR (args), CADR (args));
|
||||
else if (nargs == 1
|
||||
&& scm_is_eq (name,
|
||||
scm_from_latin1_symbol
|
||||
("call-with-current-continuation")))
|
||||
return MAKMEMO_CONT (CAR (args));
|
||||
else if (scm_is_eq (scm_current_module (), scm_the_root_module ()))
|
||||
return MAKMEMO_CALL (MAKMEMO_TOP_REF (name), nargs, args);
|
||||
else
|
||||
|
@ -527,25 +532,15 @@ SCM_DEFINE (scm_memoize_expression, "memoize-expression", 1, 0, 0,
|
|||
#define SCM_DEFINE_MEMOIZER(STR, MEMOIZER, N) \
|
||||
SCM_SNARF_INIT(scm_c_define (STR, SCM_MAKE_MEMOIZER (STR, MEMOIZER, N)))
|
||||
|
||||
static SCM m_call_cc (SCM proc);
|
||||
static SCM m_call_values (SCM prod, SCM cons);
|
||||
static SCM m_dynamic_wind (SCM pre, SCM exp, SCM post);
|
||||
|
||||
SCM_DEFINE_MEMOIZER ("@call-with-current-continuation", m_call_cc, 1);
|
||||
SCM_DEFINE_MEMOIZER ("@call-with-values", m_call_values, 2);
|
||||
SCM_DEFINE_MEMOIZER ("@dynamic-wind", m_dynamic_wind, 3);
|
||||
|
||||
|
||||
|
||||
|
||||
static SCM m_call_cc (SCM proc)
|
||||
#define FUNC_NAME "@call-with-current-continuation"
|
||||
{
|
||||
SCM_VALIDATE_MEMOIZED (1, proc);
|
||||
return MAKMEMO_CONT (proc);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
static SCM m_call_values (SCM prod, SCM cons)
|
||||
#define FUNC_NAME "@call-with-values"
|
||||
{
|
||||
|
@ -634,7 +629,9 @@ unmemoize (const SCM expr)
|
|||
case SCM_M_CALL:
|
||||
return scm_cons (unmemoize (CAR (args)), unmemoize_exprs (CDDR (args)));
|
||||
case SCM_M_CONT:
|
||||
return scm_list_2 (scm_sym_atcall_cc, unmemoize (args));
|
||||
return scm_list_2 (scm_from_latin1_symbol
|
||||
("call-with-current_continuation"),
|
||||
unmemoize (args));
|
||||
case SCM_M_CALL_WITH_VALUES:
|
||||
return scm_list_3 (scm_sym_at_call_with_values,
|
||||
unmemoize (CAR (args)), unmemoize (CDR (args)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue