summaryrefslogtreecommitdiff
path: root/libguile/objcodes.h
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2009-02-01 09:19:24 +0100
committerAndy Wingo <wingo@pobox.com>2009-02-01 09:19:24 +0100
commit9aeaabdc4571b5a2319c88e02904bd8996d5ac01 (patch)
treeebc106e1e56e3a34fa6049b9f2bfbb69661d782e /libguile/objcodes.h
parentd2d7acd5c11c6573dad62b0a77ace7bb6603e425 (diff)
downloadguile-9aeaabdc4571b5a2319c88e02904bd8996d5ac01.tar.gz
add metalen field to bytecode serialization
* libguile/objcodes.h (struct scm_objcode): Add a new field, metalen, in preparation for embedding metadata within a program. (SCM_OBJCODE_META_LEN, SCM_OBJCODE_TOTAL_LEN): New defines. * libguile/vm.c (really_make_boot_program): * module/language/assembly.scm (*program-header-len*, byte-length): * module/language/assembly/compile-bytecode.scm (write-bytecode): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/disassemble.scm (disassemble-load-program): * module/language/glil/compile-assembly.scm (glil->assembly): * test-suite/tests/asm-to-bytecode.test ("compiler"): Update for metalen addition.
Diffstat (limited to 'libguile/objcodes.h')
-rw-r--r--libguile/objcodes.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/libguile/objcodes.h b/libguile/objcodes.h
index 6b3c2aec9..7480a03c1 100644
--- a/libguile/objcodes.h
+++ b/libguile/objcodes.h
@@ -51,6 +51,8 @@ struct scm_objcode {
scm_t_uint8 nlocs;
scm_t_uint8 nexts;
scm_t_uint32 len; /* the maximum index of base[] */
+ scm_t_uint32 metalen; /* well, i lie. this many bytes at the end of
+ base[] for metadata */
scm_t_uint8 base[0];
};
@@ -65,6 +67,8 @@ extern scm_t_bits scm_tc16_objcode;
#define SCM_VALIDATE_OBJCODE(p,x) SCM_MAKE_VALIDATE (p, x, OBJCODE_P)
#define SCM_OBJCODE_LEN(x) (SCM_OBJCODE_DATA (x)->len)
+#define SCM_OBJCODE_META_LEN(x) (SCM_OBJCODE_DATA (x)->metalen)
+#define SCM_OBJCODE_TOTAL_LEN(x) (SCM_OBJCODE_LEN (x) + SCM_OBJCODE_META_LEN (x))
#define SCM_OBJCODE_NARGS(x) (SCM_OBJCODE_DATA (x)->nargs)
#define SCM_OBJCODE_NREST(x) (SCM_OBJCODE_DATA (x)->nrest)
#define SCM_OBJCODE_NLOCS(x) (SCM_OBJCODE_DATA (x)->nlocs)