diff options
author | Andy Wingo <wingo@oblong.net> | 2009-08-12 16:33:49 +0200 |
---|---|---|
committer | Andy Wingo <wingo@oblong.net> | 2009-08-12 16:34:05 +0200 |
commit | 94ff26b96b555f0263fab2221cd55801119ffddd (patch) | |
tree | 6911dde6ef41d2b87eb9cfa6b857e7692bc21ac1 /libguile/vm-i-system.c | |
parent | 6cf48307989d2552f2215ef8406ea92745d2d3e9 (diff) | |
download | guile-94ff26b96b555f0263fab2221cd55801119ffddd.tar.gz |
rework the vm support for wide strings
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.
* libguile/vm-engine.c (vm_error_bad_wide_string_length): New error
case.
* libguile/vm-i-loader.c (load-unsigned-integer, load-integer)
(load-keyword): Remove these instructions. The former two are
obsoleted by make-int64/make-uint64, the latter via make-keyword.
(load-string): Only handle narrow strings.
(load-symbol): Only handle narrow symbols. The wide case is handled
via make-symbol.
(load-wide-string): New instruction, for wide strings.
* libguile/vm-i-system.c (define): Move here from loaders.c, as now it
just takes a sym on the stack.
(make-keyword, make-symbol): New instructions.
* module/language/assembly.scm: Remove removed instructions. No more
width byte in load-string etc.
* module/language/assembly/compile-bytecode.scm (write-bytecode): Adapt
to change in instruction set.
* module/language/glil/compile-assembly.scm (glil->assembly): Compile
define by pushing the sym then emitting (define).
(dump-object): Dump narrow and wide strings differently. Use
make-keyword and make-symbol as appropriate.
* module/language/tree-il/compile-glil.scm (flatten): When compiling a
ref to a primitive (not a call), first see if the primitive is
actually bound in the root module. (That's not the case with e.g.
bytevector-u8-ref).
* module/system/xref.scm (program-callee-rev-vars): Don't parse out
"nexts".
* test-suite/tests/asm-to-bytecode.test ("compiler"): Adapt to bytecode
format change.
Diffstat (limited to 'libguile/vm-i-system.c')
-rw-r--r-- | libguile/vm-i-system.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c index 9604ce55a..b298c88a6 100644 --- a/libguile/vm-i-system.c +++ b/libguile/vm-i-system.c @@ -1246,6 +1246,34 @@ VM_DEFINE_INSTRUCTION (65, fix_closure, "fix-closure", 2, 0, 1) NEXT; } +VM_DEFINE_INSTRUCTION (66, define, "define", 0, 0, 2) +{ + SCM sym, val; + POP (sym); + POP (val); + SYNC_REGISTER (); + VARIABLE_SET (scm_sym2var (sym, scm_current_module_lookup_closure (), + SCM_BOOL_T), + val); + NEXT; +} + +VM_DEFINE_INSTRUCTION (67, make_keyword, "make-keyword", 0, 1, 1) +{ + CHECK_UNDERFLOW (); + SYNC_REGISTER (); + *sp = scm_symbol_to_keyword (*sp); + NEXT; +} + +VM_DEFINE_INSTRUCTION (68, make_symbol, "make-symbol", 0, 1, 1) +{ + CHECK_UNDERFLOW (); + SYNC_REGISTER (); + *sp = scm_string_to_symbol (*sp); + NEXT; +} + /* (defun renumber-ops () |