diff options
author | Andy Wingo <wingo@pobox.com> | 2020-07-23 12:05:14 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2020-07-23 12:24:11 +0200 |
commit | bb7fa5bdc24e35927d3450343ee23879dc556745 (patch) | |
tree | 682b098eee947bee2bee4e66d6969d76d1b37532 /module/system/vm/assembler.scm | |
parent | 5e1748f75128107e3a0707b66df5adb95d98437e (diff) | |
download | guile-bb7fa5bdc24e35927d3450343ee23879dc556745.tar.gz |
Add jtable instruction
* doc/ref/vm.texi (Instruction Set): Document new v32-x8-l24 instruction
kind.
(Branch Instructions): Document jtable.
* libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): Add
V32_X8_L24.
* libguile/jit.c (compile_jtable, compile_jtable_slow):
(COMPILE_X8_S24__V32_X8_L24, analyze): Add stub JIT compiler
implementation.
* libguile/vm-engine.c (jtable): New instruction.
* module/language/bytecode.scm (instruction-arity): Deprecate.
* module/system/vm/assembler.scm (encoder, assembler): Add V32_X8_L24
case.
* module/system/vm/disassembler.scm (u32-ref, s32-ref): Move definitions
to expansion-time only.
(define-op-handlers): New definition, replacing visit-opcodes.
(disassemblers, jump-parsers, stack-effect-parsers, clobber-parsers):
Rework in terms of define-op-handlers. Default case becomes #f, and
add support for jtable.
(disassemble-one, instruction-relative-jump-targets)
(instruction-stack-size-after, instruction-slot-clobbers): Inline
default case in the lookup procedure, not copied in the handler
vector.
(compute-labels): Add jtable case.
(instruction-lengths-vector, instruction-length): Rework to allow
variable-length instructions, and mark jtable as being
variable-length.
(instruction-has-fallthrough?): Add jtable to the no-fallthrough
set.
Diffstat (limited to 'module/system/vm/assembler.scm')
-rw-r--r-- | module/system/vm/assembler.scm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm index ff883d38c..e0a39d35c 100644 --- a/module/system/vm/assembler.scm +++ b/module/system/vm/assembler.scm @@ -89,6 +89,7 @@ emit-jne emit-jge emit-jnge + emit-jtable emit-fixnum? emit-heap-object? @@ -746,6 +747,19 @@ later by the linker." (emit asm (pack-u8-u24 a b))) ((C16_C16 a b) (emit asm (pack-u16-u16 a b))) + ((V32_X8_L24 labels) + (let ((len (vector-length labels))) + (emit asm len) + (let lp () + (unless (<= (+ (asm-pos asm) (* 4 len)) + (bytevector-length (asm-buf asm))) + (grow-buffer! asm) + (lp))) + (let lp ((n 0)) + (when (< n len) + (record-label-reference asm (vector-ref labels n)) + (emit asm 0) + (lp (1+ n)))))) ((B1_X7_L24 a label) (record-label-reference asm label) (emit asm (pack-u1-u7-u24 (if a 1 0) 0 0))) @@ -1050,6 +1064,7 @@ later by the linker." ('C8_C24 #'(a b)) ('C8_S24 #'(a b)) ('C16_C16 #'(a b)) + ('V32_X8_L24 #'(labels)) ('B1_X7_L24 #'(a label)) ('B1_C7_L24 #'(a b label)) ('B1_X31 #'(a)) |