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

Add VM ops needed for string-ref

* libguile/vm-engine.c (tail-pointer-ref/immediate, tag-char)
  (untag-char): New instructions.
* module/language/cps/compile-bytecode.scm (compile-function): Add
  support for new instructions.
* module/language/cps/cse.scm (compute-equivalent-subexpressions): CSE
  cases for tag-char / untag-char.
* module/language/cps/effects-analysis.scm:
* module/language/cps/types.scm: Add cases for new primcalls.
* module/language/cps/reify-primitives.scm (reify-primitives): Update
  comment.
* module/language/cps/slot-allocation.scm (compute-var-representations):
  Add cases for untag-char, tail-pointer-ref/immediate.
* module/language/cps/specialize-primcalls.scm (specialize-primcalls):
  Add untag-char case, and add FIXME comment for tag-char.
* module/system/vm/assembler.scm: Export new assemblers.
This commit is contained in:
Andy Wingo 2018-04-08 21:26:46 +02:00
parent 39fb7e540b
commit 91d0db1bf7
9 changed files with 62 additions and 12 deletions

View file

@ -1431,10 +1431,15 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
NEXT (1);
}
VM_DEFINE_OP (47, unused_47, NULL, NOP)
VM_DEFINE_OP (47, tail_pointer_ref_immediate, "tail-pointer-ref/immediate", OP1 (X8_S8_S8_C8) | OP_DST)
{
vm_error_bad_instruction (op);
abort ();
scm_t_uint8 dst, obj, idx;
UNPACK_8_8_8 (op, dst, obj, idx);
SP_SET_PTR (dst, ((scm_t_bits *) SCM2PTR (SP_REF (obj))) + idx);
NEXT (1);
}
@ -2206,8 +2211,24 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
VM_DEFINE_OP (81, unused_81, NULL, NOP)
VM_DEFINE_OP (82, unused_82, NULL, NOP)
VM_DEFINE_OP (81, tag_char, "tag-char", OP1 (X8_S12_S12) | OP_DST)
{
scm_t_uint16 dst, src;
UNPACK_12_12 (op, dst, src);
SP_SET (dst,
SCM_MAKE_ITAG8 ((scm_t_bits) (scm_t_wchar) SP_REF_U64 (src),
scm_tc8_char));
NEXT (1);
}
VM_DEFINE_OP (82, untag_char, "untag-char", OP1 (X8_S12_S12) | OP_DST)
{
scm_t_uint16 dst, src;
UNPACK_12_12 (op, dst, src);
SP_SET_U64 (dst, SCM_CHAR (SP_REF (src)));
NEXT (1);
}
VM_DEFINE_OP (83, unused_83, NULL, NOP)
VM_DEFINE_OP (84, unused_84, NULL, NOP)
VM_DEFINE_OP (85, unused_85, NULL, NOP)