1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-14 15:40:19 +02:00

`define!' instruction returns the variable

* doc/ref/vm.texi (Top-Level Environment Instructions): Update
  documentation.
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump, sadly.
* module/system/vm/assembler.scm (*bytecode-minor-version*): Bump.
* libguile/vm-engine.c (define!): Change to store variable in dst slot.
* module/language/tree-il/compile-cps.scm (convert):
* module/language/cps/compile-bytecode.scm (compile-function): Adapt to
  define! change.
* module/language/cps/effects-analysis.scm (current-module): Fix define!
  effects.  Incidentally here was the bug: in Guile 2.2 you can't have
  effects on different object kinds in one instruction, without
  reverting to &unknown-memory-kinds.
* test-suite/tests/compiler.test ("regression tests"): Add a test.
This commit is contained in:
Andy Wingo 2016-06-21 22:29:55 +02:00
parent 1f6a8f2a6e
commit f1c0434403
8 changed files with 27 additions and 13 deletions

View file

@ -1950,18 +1950,21 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
NEXT (2);
}
/* define! sym:12 val:12
/* define! dst:12 sym:12
*
* Look up a binding for SYM in the current module, creating it if
* necessary. Set its value to VAL.
*/
VM_DEFINE_OP (66, define, "define!", OP1 (X8_S12_S12))
VM_DEFINE_OP (66, define, "define!", OP1 (X8_S12_S12) | OP_DST)
{
scm_t_uint16 sym, val;
UNPACK_12_12 (op, sym, val);
scm_t_uint16 dst, sym;
SCM var;
UNPACK_12_12 (op, dst, sym);
SYNC_IP ();
scm_define (SP_REF (sym), SP_REF (val));
var = scm_module_ensure_local_variable (scm_current_module (),
SP_REF (sym));
CACHE_SP ();
SP_SET (dst, var);
NEXT (1);
}