summaryrefslogtreecommitdiff
path: root/libguile/vm-engine.h
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2009-07-23 17:12:10 +0200
committerAndy Wingo <wingo@pobox.com>2009-07-23 17:15:13 +0200
commit20d47c3915c1b910e683d4b010b91c48047d6251 (patch)
treeb4d9a6d3dd5b9b696d358d8436970a856ddd1ee5 /libguile/vm-engine.h
parent66d3e9a32c2da4eedb3f316e0dcffe92e6631f87 (diff)
downloadguile-20d47c3915c1b910e683d4b010b91c48047d6251.tar.gz
remove "externals" from the vm
* libguile/frames.c (scm_frame_external_link): Removed. * libguile/frames.h: No need to have the "external link" in the stack frame -- update macros to take the new situation into account. * libguile/objcodes.h (struct scm_objcode): Rename the nexts field to "unused". In the future we can use it for nlocs, I think. (SCM_OBJCODE_NEXTS): removed. * libguile/programs.h: * libguile/programs.c (scm_make_program): Expect the third argument to be a vector of free variables, not a list of free variables. SCM_BOOL_F indicates no free variables, not SCM_EOL. (program_mark): Adapt. (scm_program_arity): No more nexts. (scm_program_free_vars): Replaces scm_program_externals. * libguile/vm-engine.c (VM_CHECK_EXTERNAL) (vm_engine): No need for the "external" var. * libguile/vm-engine.h (CACHE_PROGRAM): Update for SCM_PROGRAM_FREE_VARS instead of SCM_PROGRAM_EXTERNALS. (NEW_FRAME): Update for new frame size, and no need to cons up externals. Yay :) * libguile/vm-i-loader.c (load-program): Update for scm_make_program. * libguile/vm-i-system.c (external-ref, external-set): No more. (make-closure): No more. (goto/args): No need to re-cons externals here. Update for new stack frame size. (mv-call, return, return/values): Update for new frame size. No need to reinstate externals on return. * libguile/vm.c (really_make_boot_program, scm_load_compiled_with_vm): Update for scm_make_program. * module/language/objcode/spec.scm (objcode-env-externals): Treat '() as #f, for the externals. Need to clean this up later... * module/system/vm/program.scm (arity:nexts): Remove. Rename program-external to program-free-vars.
Diffstat (limited to 'libguile/vm-engine.h')
-rw-r--r--libguile/vm-engine.h36
1 files changed, 6 insertions, 30 deletions
diff --git a/libguile/vm-engine.h b/libguile/vm-engine.h
index a2c1effd3..b860bf151 100644
--- a/libguile/vm-engine.h
+++ b/libguile/vm-engine.h
@@ -138,11 +138,7 @@
#define ASSERT_BOUND(x)
#endif
-/* Get a local copy of the program's "object table" (i.e. the vector of
- external bindings that are referenced by the program), initialized by
- `load-program'. */
-/* XXX: We could instead use the "simple vector macros", thus not having to
- call `scm_vector_writable_elements ()' and the likes. */
+/* Cache the object table and free variables. */
#define CACHE_PROGRAM() \
{ \
if (bp != SCM_PROGRAM_DATA (program)) { \
@@ -156,7 +152,7 @@
} \
} \
{ \
- SCM c = SCM_PROGRAM_EXTERNALS (program); \
+ SCM c = SCM_PROGRAM_FREE_VARS (program); \
if (SCM_I_IS_VECTOR (c)) \
{ \
closure = SCM_I_VECTOR_WELTS (c); \
@@ -185,14 +181,6 @@
* Error check
*/
-#undef CHECK_EXTERNAL
-#if VM_CHECK_EXTERNAL
-#define CHECK_EXTERNAL(e) \
- do { if (SCM_UNLIKELY (!SCM_CONSP (e))) goto vm_error_external; } while (0)
-#else
-#define CHECK_EXTERNAL(e)
-#endif
-
/* Accesses to a program's object table. */
#if VM_CHECK_OBJECT
#define CHECK_OBJECT(_num) \
@@ -406,7 +394,7 @@ do { \
/* New registers */ \
fp = sp - bp->nargs + 1; \
data = SCM_FRAME_DATA_ADDRESS (fp); \
- sp = data + 3; \
+ sp = data + 2; \
CHECK_OVERFLOW (); \
stack_base = sp; \
ip = bp->base; \
@@ -416,23 +404,11 @@ do { \
data[-i] = SCM_UNDEFINED; \
\
/* Set frame data */ \
- data[3] = (SCM)ra; \
- data[2] = 0x0; \
- data[1] = (SCM)dl; \
- \
- /* Postpone initializing external vars, \
- because if the CONS causes a GC, we \
- want the stack marker to see the data \
- array formatted as expected. */ \
- data[0] = SCM_UNDEFINED; \
- external = SCM_PROGRAM_EXTERNALS (fp[-1]); \
- for (i = 0; i < bp->nexts; i++) \
- CONS (external, SCM_UNDEFINED, external); \
- data[0] = external; \
+ data[2] = (SCM)ra; \
+ data[1] = 0x0; \
+ data[0] = (SCM)dl; \
}
-#define CACHE_EXTERNAL() external = fp[bp->nargs + bp->nlocs]
-
/*
Local Variables:
c-file-style: "gnu"