summaryrefslogtreecommitdiff
path: root/libguile/goops.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2010-01-06 20:11:33 +0100
committerAndy Wingo <wingo@pobox.com>2010-01-07 23:49:25 +0100
commitfd12a19a5e59afbd78ca67b1305c70bb1ecb724b (patch)
tree40e549e520e00d799afc8e3ee602b9dcc8f5bc5b /libguile/goops.c
parent97812f4d38b1077c87e8fde02b1d62da6a1a6a06 (diff)
downloadguile-fd12a19a5e59afbd78ca67b1305c70bb1ecb724b.tar.gz
subrs are now VM trampoline procedures
* libguile/_scm.h: Add foreign.h and programs.h to the private include list, as snarfing subrs with static allocation now needs access to some of their enums and macros. * libguile/gsubr.c (create_gsubr): Instead of creating a tc7_gsubr object, create a VM program with the call-subr opcode, so that the representation of subrs is now gsubrs. CPP and elisp, together at last. (scm_subr_objcode_trampoline): New function, used by the SCM_DEFINE snarf macro. * libguile/gsubr.h (SCM_SUBR_META_INFO, SCM_SUBR_PROPS) (SCM_SET_SUBR_GENERIC_LOC, SCM_SUBR_ARITY_TO_TYPE): Remove these macros. They were never deprecated, but hopefully people aren't using them. (SCM_SUBRF, SCM_SUBR_NAME, SCM_SUBR_GENERIC, SCM_SET_SUBR_GENERIC): Update to work on the new subr representation. * libguile/objcodes.h (SCM_F_OBJCODE_IS_STATIC): New flag, indicates that the "backing store" of the objcode is statically allocated. * libguile/procprop.c (scm_sym_name): Define here instead of in gsubr.c. * libguile/snarf.h (SCM_DEFINE): If we are doing static allocation, statically allocate the foreign object, the object table, and the program, and use some SCM_SNARF_INITtery to fix things up. Unfortunately I have not been able to make this immutable. It might be possible, though. (SCM_IMMUTABLE_CELL, SCM_STATIC_DOUBLE_CELL, SCM_IMMUTABLE_FOREIGN): (SCM_STATIC_SUBR_OBJVECT, SCM_STATIC_PROGRAM): New helper macros.
Diffstat (limited to 'libguile/goops.c')
-rw-r--r--libguile/goops.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libguile/goops.c b/libguile/goops.c
index ca850fa8c..97129851b 100644
--- a/libguile/goops.c
+++ b/libguile/goops.c
@@ -254,7 +254,10 @@ SCM_DEFINE (scm_class_of, "class-of", 1, 0, 0,
else
return scm_class_procedure;
case scm_tc7_program:
- return scm_class_procedure;
+ if (SCM_PROGRAM_IS_PRIMITIVE_GENERIC (x) && *SCM_SUBR_GENERIC (x))
+ return scm_class_primitive_generic;
+ else
+ return scm_class_procedure;
case scm_tc7_smob:
{