summaryrefslogtreecommitdiffstats
path: root/autoload.h
Commit message (Collapse)AuthorAgeFilesLines
* autoload: move socket material into socket module.Kaz Kylheku2022-02-191-0/+1
| | | | | | | | | | | | | | | | | * autoload.c (sock_set_entries, sock_instantiate): Functions removed from here. (autoload_init): autoload_reg call for above functions removed from here. (autoload_intern): New function, wrapper for intern_only. sock_set_entries uses intern_only which is static, so we need to expose this. * autoload.h (autoload_intern): Declared. * socket.c (sock_set_entries, sock_instantiate): Functions moved here. intern_only call replaced with autoload_intern. (sock_load_init): Function removed: body moved into sock_instantiate, which no longer calls sock_load_init.
* autoload: use weak hash to erase registrations.Kaz Kylheku2022-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In autoload the _set_entries functions are being called twice: the first time with a functional argument to associate symbols with that function, and then when the module is loaded, a second time with a nil argument to erase those associations. This is inefficient; some modules have many symbols to remove from a hash. What we can do is make the hash weak; associate the symbols with a function weakly, such that those entries lapse when the function becomes garbage. Lapsing of weak hash table entries during GC is more efficient than making numerous calls to remhash. We can use a separate strong hash table to hang on to the functions; when a module is instantiated, all we have to do is remove the instantiation function from the table. Then that function is reachable only as a weak value from the other tables. * autoload.c (autoload_reg_hash): New static variable. (place_instantiate, ver_instantiate, ifa_instantiate, txr_case_instantiate, with_resources_instantiate, path_test_instantiate, struct_instantiate, with_stream_instantiate, hash_instantiate, except_instantiate, type_instantiate, yield_instantiate, sock_instantiate, termios_instantiate, awk_instantiate, build_instantiate, trace_instantiate, getopts_instantiate, package_instantiate, getput_instantiate, tagbody_instantiate, pmac_instantiate, error_instantiate, keyparams_instantiate, ffi_instantiate, doloop_instantiate, stream_wrap_instantiate, asm_instantiate, compiler_instantiate, debugger_instantiate, op_instantiate, save_exe_instantiate, defset_instantiate, copy_file_instantiate, arith_each_instantiate, each_prod_instantiate, quips_instantiate, match_instantiate, doc_instantiate, pic_instantiate, constfun_instantiate): Remove set_fun argument and call to that function. (autoload_reg): Remove argument from instantiate function. Add the function to the autoload_reg_hash table, associated with the t symbol. (autoload_init_tables): Initialize autoload_reg_hash. Turn the existing symbol hashes into weak tables. Let's use weak or-semantics, so they don't hang onto uninterned symbols. (autoload_try): If a symbol resolves to a function, indicating a load might be required, we now must verify whether that is really the case by seeing whether the function exists in the autolod_reg_hash table. If so, we remove it from that table and do the load. * autoload.h (autoload_reg): Declaration updated. * gencadr.txr (cadr_register): Remove set_fun argument and call to that function. * cadr.c: Regenerated.
* lisplib: rename to autoload.Kaz Kylheku2022-02-181-0/+43
* Makefile (OBJS): rename lisplib.o to autoload.o. * lisplib.c: Renamed to autoload.c. (lisplib_init_tables): Renamed to autoload_init_tables. (lisplib_init): Renamed to autoload_init, and calls autoload_init_tables. (lisplib_try_load): Renamed to autoload_try. (autoload_try_fun, autoload_try_var, autloload_try_slot, autoload_try_struct, autoload_try_keyword): Follow rename. * lisplib.h: Renamed to autoload.h. (lisplib_init): Renamed to autoload_init. * eval.c: Include autoload.h. (eval_init): Follow rename of lisplib_init. * gencadr.txr: include "autoload.h" * cadr.c: Regenerated.