summaryrefslogtreecommitdiff
path: root/libguile/objcodes.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2009-02-01 10:50:45 +0100
committerAndy Wingo <wingo@pobox.com>2009-02-01 10:50:45 +0100
commitac47d5f6399c54bcb39a01bb0ade83a614d625b4 (patch)
tree218be79c6771477492f78ffdaebec67a6f43afec /libguile/objcodes.c
parent1f1ec13b5c459717b22030565e591f1f713ee39d (diff)
downloadguile-ac47d5f6399c54bcb39a01bb0ade83a614d625b4.tar.gz
avoid 8 words of allocation per lambda, whoooo
* libguile/objcodes.c (scm_bytecode_to_objcode): Check that the length of the vector matches the length embedded in the bytecode. * libguile/programs.c (scm_program_meta): Call through to scm_objcode_meta, instead of looking in the object table. Avoids consing up a program+objcode slice for the meta until the meta is actually called. * libguile/vm-i-loader.c (load-program): Step past the metadata too. * module/language/glil/compile-assembly.scm (make-meta): Just return the load-program form, or #f. (assoc-ref-or-acons, object-index-and-alist, make-object-table): Don't write the meta into the object table. (glil->assembly): Instead write the meta into the load-program form.
Diffstat (limited to 'libguile/objcodes.c')
-rw-r--r--libguile/objcodes.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libguile/objcodes.c b/libguile/objcodes.c
index eb40213e9..7dba0e00b 100644
--- a/libguile/objcodes.c
+++ b/libguile/objcodes.c
@@ -190,14 +190,17 @@ SCM_DEFINE (scm_bytecode_to_objcode, "bytecode->objcode", 1, 0, 0,
data = (struct scm_objcode*)c_bytecode;
SCM_NEWSMOB2 (objcode, scm_tc16_objcode, data, bytecode);
scm_array_handle_release (&handle);
+
+ SCM_ASSERT_RANGE (0, bytecode, size >= sizeof(struct scm_objcode));
+ if (data->len + data->metalen != (size - sizeof (*data)))
+ scm_misc_error (FUNC_NAME, "bad u8vector size (~a != ~a)",
+ SCM_LIST2 (scm_from_size_t (size),
+ scm_from_uint32 (sizeof (*data) + data->len + data->metalen)));
assert (increment == 1);
- SCM_ASSERT_RANGE (0, bytecode, size < 1<<31);
- SCM_ASSERT_RANGE (0, bytecode, size >= sizeof(*data));
SCM_SET_SMOB_FLAGS (objcode, SCM_F_OBJCODE_IS_U8VECTOR);
/* foolishly, we assume that as long as bytecode is around, that c_bytecode
will be of the same length; perhaps a bad assumption? */
- /* FIXME: check length of bytecode */
return objcode;
}