si::mangle-name: return the function name from symbols_list.h

To achieve that we store the symbol name in a separate ecl_symbol slot called
cname. It is initialized from the translation slot in the structure
cl_symbol_initializer. That makes dpp and runtime always resolve function
names to the same symbol. Fixes #534.
This commit is contained in:
Daniel Kochmański 2020-09-14 23:00:49 +02:00
parent 7908ba8003
commit 6e0124bc64
2 changed files with 10 additions and 3 deletions

View file

@ -153,6 +153,9 @@ mangle_name(cl_object output, unsigned char *source, int l)
}
}
}
if (!Null(symbol->symbol.cname)) {
@(return found symbol->symbol.cname minarg maxarg);
}
package = ecl_symbol_package(symbol);
if (Null(package)) {
;
@ -204,7 +207,8 @@ mangle_name(cl_object output, unsigned char *source, int l)
@)
static void
make_this_symbol(int i, cl_object s, int code, const char *name,
make_this_symbol(int i, cl_object s, int code,
const char *name, const char *cname,
cl_objectfn fun, int narg, cl_object value)
{
enum ecl_stype stp;
@ -242,6 +246,7 @@ make_this_symbol(int i, cl_object s, int code, const char *name,
s->symbol.stype = stp;
s->symbol.hpack = package;
s->symbol.name = ecl_make_constant_base_string(name,-1);
s->symbol.cname = ecl_cstring_to_base_string_or_nil(cname);
if (package == cl_core.keyword_package) {
package->pack.external =
_ecl_sethash(s->symbol.name, package->pack.external, s);
@ -285,7 +290,7 @@ void
init_all_symbols(void)
{
int i, code, narg;
const char *name;
const char *name, *cname;
cl_object s, value;
cl_objectfn fun;
@ -297,6 +302,7 @@ init_all_symbols(void)
fun = (cl_objectfn)cl_symbols[i].init.fun;
narg = cl_symbols[i].init.narg;
value = cl_symbols[i].init.value;
make_this_symbol(i, s, code, name, fun, narg, value);
cname = cl_symbols[i].init.translation;
make_this_symbol(i, s, code, name, cname, fun, narg, value);
}
}

View file

@ -288,6 +288,7 @@ struct ecl_symbol {
cl_object plist; /* property list */
/* This field coincides with cons.car */
cl_object name; /* print name */
cl_object cname; /* associated C name (or NIL) */
cl_object hpack; /* home package */
/* ECL_NIL for uninterned symbols */
#ifdef ECL_THREADS