mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-13 04:42:13 -08:00
Use a hash to seek the compilation strategies in the interpreter
This commit is contained in:
parent
6b83ade38d
commit
b5d5cacbde
4 changed files with 22 additions and 6 deletions
|
|
@ -2070,7 +2070,6 @@ static int
|
|||
compile_form(cl_env_ptr env, cl_object stmt, int flags) {
|
||||
const cl_compiler_ptr c_env = env->c_env;
|
||||
cl_object code_walker = ECL_SYM_VAL(env, @'si::*code-walker*');
|
||||
compiler_record *l;
|
||||
cl_object function;
|
||||
bool push = flags & FLAG_PUSH;
|
||||
int new_flags;
|
||||
|
|
@ -2131,9 +2130,10 @@ compile_form(cl_env_ptr env, cl_object stmt, int flags) {
|
|||
stmt = ECL_CONS_CAR(stmt);
|
||||
goto QUOTED;
|
||||
}
|
||||
for (l = database; l->symbol != OBJNULL; l++) {
|
||||
/*cl_print(1, l->symbol);*/
|
||||
if (l->symbol == function) {
|
||||
{
|
||||
cl_object index = ecl_gethash(function, cl_core.compiler_dispatch);
|
||||
if (index != OBJNULL) {
|
||||
compiler_record *l = database + fix(index);
|
||||
c_env->lexical_level += l->lexical_increment;
|
||||
if (c_env->stepping && function != @'function' &&
|
||||
c_env->lexical_level)
|
||||
|
|
@ -2890,3 +2890,18 @@ si_make_lambda(cl_object name, cl_object rest)
|
|||
return output;
|
||||
}
|
||||
@)
|
||||
|
||||
void
|
||||
init_compiler()
|
||||
{
|
||||
cl_object dispatch_table =
|
||||
cl_core.compiler_dispatch =
|
||||
cl__make_hash_table(@'eq', MAKE_FIXNUM(128), /* size */
|
||||
ecl_make_singlefloat(1.5f), /* rehash-size */
|
||||
ecl_make_singlefloat(0.5f), /* rehash-threshold */
|
||||
Cnil); /* thread-safe */
|
||||
int i;
|
||||
for (i = 0; database[i].symbol; i++) {
|
||||
ecl_sethash(database[i].symbol, dispatch_table, MAKE_FIXNUM(i));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -677,6 +677,7 @@ cl_boot(int argc, char **argv)
|
|||
ECL_SET(@'si::*load-hooks*', aux);
|
||||
init_error();
|
||||
init_macros();
|
||||
init_compiler();
|
||||
|
||||
/*
|
||||
* Set up infrastructure for CLOS.
|
||||
|
|
|
|||
|
|
@ -243,6 +243,8 @@ struct cl_core_struct {
|
|||
cl_object reused_indices;
|
||||
#endif
|
||||
cl_object slash;
|
||||
|
||||
cl_object compiler_dispatch;
|
||||
};
|
||||
|
||||
extern ECL_API struct cl_core_struct cl_core;
|
||||
|
|
|
|||
|
|
@ -43,9 +43,7 @@ extern void init_read(void);
|
|||
extern void init_stacks(cl_env_ptr);
|
||||
extern void init_unixint(int pass);
|
||||
extern void init_unixtime(void);
|
||||
#if defined(__MINGW32__)
|
||||
extern void init_compiler(void);
|
||||
#endif
|
||||
#ifdef ECL_THREADS
|
||||
extern void init_threads(cl_env_ptr);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue