Commit 44b9f398 authored by Jean-Claude Beaudoin's avatar Jean-Claude Beaudoin
Browse files

Work around a bug in the optimizer (-02) of recent versions (4, 5, 6, up to 10+) of clang.

parent 4ce7031e
......@@ -334,7 +334,7 @@ mkcl_object mk_si_mangle_function_name(MKCL, mkcl_object symbol)
static void
make_this_symbol(MKCL, int i, mkcl_object s, int code, const char *name,
make_this_symbol(MKCL, int i, struct mkcl_symbol * symbol, int code, const char *name,
mkcl_objectfn fun, int narg, mkcl_object value)
{
enum mkcl_stype stp;
......@@ -358,41 +358,41 @@ make_this_symbol(MKCL, int i, mkcl_object s, int code, const char *name,
case GRAY_PACKAGE: package = mkcl_core.gray_package; break;
default: mkcl_lose(env, "Unknown package in make_this_symbol");
}
s->symbol.t = mkcl_t_symbol;
s->symbol.special_index = MKCL_NOT_A_SPECIAL_INDEX;
MKCL_SET(s, MKCL_OBJNULL);
MKCL_SYM_FUN(s) = mk_cl_Cnil;
s->symbol.plist = mk_cl_Cnil;
s->symbol.sys_plist = mk_cl_Cnil;
s->symbol.hpack = mk_cl_Cnil;
s->symbol.properly_named_class = mk_cl_Cnil;
s->symbol.stype = stp;
s->symbol.hpack = package;
s->symbol.name = mkcl_make_simple_base_string(env, (char *) name);
symbol->t = mkcl_t_symbol;
symbol->special_index = MKCL_NOT_A_SPECIAL_INDEX;
symbol->value = MKCL_OBJNULL;
symbol->gfdef = mk_cl_Cnil;
symbol->plist = mk_cl_Cnil;
symbol->sys_plist = mk_cl_Cnil;
symbol->hpack = mk_cl_Cnil;
symbol->properly_named_class = mk_cl_Cnil;
symbol->stype = stp;
symbol->hpack = package;
symbol->name = mkcl_make_simple_base_string(env, (char *) name);
if (package == mkcl_core.keyword_package) {
mkcl_sethash(env, s->symbol.name, package->pack.external, s);
MKCL_SET(s, s);
mkcl_sethash(env, symbol->name, package->pack.external, (mkcl_object) symbol);
symbol->value = (mkcl_object) symbol;
} else {
int intern_flag;
MKCL_SET(s, value);
if (mkcl_find_symbol(env, s->symbol.name, package, &intern_flag) != mk_cl_Cnil
symbol->value = value;
if (mkcl_find_symbol(env, symbol->name, package, &intern_flag) != mk_cl_Cnil
&& intern_flag == MKCL_SYMBOL_IS_INHERITED) {
mkcl_shadowing_import(env, s, package);
mkcl_shadowing_import(env, (mkcl_object) symbol, package);
} else {
mkcl_import2(env, s, package);
mkcl_import2(env, (mkcl_object) symbol, package);
}
mkcl_export2(env, s, package);
mkcl_export2(env, (mkcl_object) symbol, package);
}
if (form) {
s->symbol.stype |= mkcl_stp_special_form;
symbol->stype |= mkcl_stp_special_form;
} else if (fun) {
mkcl_object f;
if (narg >= 0) {
f = mkcl_make_cfun(env, (mkcl_objectfn_fixed) fun, s, MKCL_OBJNULL, narg, NULL);
f = mkcl_make_cfun(env, (mkcl_objectfn_fixed) fun, (mkcl_object) symbol, MKCL_OBJNULL, narg, NULL);
} else {
f = mkcl_make_cfun_va(env, fun, s, MKCL_OBJNULL, NULL);
f = mkcl_make_cfun_va(env, fun, (mkcl_object) symbol, MKCL_OBJNULL, NULL);
}
MKCL_SYM_FUN(s) = f;
symbol->gfdef = f;
}
}
......@@ -406,7 +406,7 @@ mkcl_init_all_symbols(MKCL)
/* We skip NIL and T, thus we start at 2. */
for (i = 2; mkcl_root_symbols[i].init.name != NULL; i++) {
s = (mkcl_object)(mkcl_root_symbols + i);
struct mkcl_symbol * s = &(mkcl_root_symbols[i].data);
code = mkcl_root_symbols[i].init.type;
name = mkcl_root_symbols[i].init.name;
fun = (mkcl_objectfn)mkcl_root_symbols[i].init.fun;
......
......@@ -285,6 +285,7 @@ static void _mkcl_boot_inner(MKCL)
mk_cl_Cnil_symbol->symbol.properly_named_class = mk_cl_Cnil;
mk_cl_Cnil_symbol->symbol.stype = mkcl_stp_constant;
#if !__clang__
mk_cl_Ct->symbol.t = mkcl_t_symbol;
mk_cl_Ct->symbol.special_index = MKCL_NOT_A_SPECIAL_INDEX;
mk_cl_Ct->symbol.value = mk_cl_Ct;
......@@ -295,7 +296,18 @@ static void _mkcl_boot_inner(MKCL)
mk_cl_Ct->symbol.hpack = mk_cl_Cnil;
mk_cl_Ct->symbol.properly_named_class = mk_cl_Cnil;
mk_cl_Ct->symbol.stype = mkcl_stp_constant;
#else
mkcl_root_symbols[1].data.t = mkcl_t_symbol;
mkcl_root_symbols[1].data.special_index = MKCL_NOT_A_SPECIAL_INDEX;
mkcl_root_symbols[1].data.value = mk_cl_Ct;
mkcl_root_symbols[1].data.name = mkcl_make_simple_base_string(env, "T");
mkcl_root_symbols[1].data.gfdef = mk_cl_Cnil;
mkcl_root_symbols[1].data.plist = mk_cl_Cnil;
mkcl_root_symbols[1].data.sys_plist = mk_cl_Cnil;
mkcl_root_symbols[1].data.hpack = mk_cl_Cnil;
mkcl_root_symbols[1].data.properly_named_class = mk_cl_Cnil;
mkcl_root_symbols[1].data.stype = mkcl_stp_constant;
#endif
#if 1
mkcl_core.packages = mk_cl_Cnil;
......@@ -347,7 +359,11 @@ static void _mkcl_boot_inner(MKCL)
mkcl_import2(env, mk_cl_Cnil, mkcl_core.lisp_package);
mkcl_export2(env, mk_cl_Cnil, mkcl_core.lisp_package);
#if !__clang__
mk_cl_Ct->symbol.hpack = mkcl_core.lisp_package;
#else
mkcl_root_symbols[1].data.hpack = mkcl_core.lisp_package;
#endif
mkcl_import2(env, mk_cl_Ct, mkcl_core.lisp_package);
mkcl_export2(env, mk_cl_Ct, mkcl_core.lisp_package);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment