diff options
author | Andy Wingo <wingo@pobox.com> | 2021-04-26 09:36:56 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2021-04-26 09:48:52 +0200 |
commit | 83023160b18ec92ba4a80bd2a27b4d45e3878699 (patch) | |
tree | 77c8c188d008c4a0db5bfa300fc0b9bd992b6650 /libguile/jit.c | |
parent | 976433d667e2502c25f8f6ac8eef04b7d472df6d (diff) | |
download | guile-83023160b18ec92ba4a80bd2a27b4d45e3878699.tar.gz |
Simplify module variable lookup slow-path
* libguile/intrinsics.h:
* libguile/intrinsics.c (lookup_bound_public, lookup_bound_private): Two
new intrinsics.
(scm_bootstrap_intrinsics): Wire them up.
* libguile/jit.c (compile_call_scm_from_scmn_scmn):
(compile_call_scm_from_scmn_scmn_slow):
(COMPILE_X8_S24__N32__N32__C32): Add JIT support for new instruction
kind.
* libguile/vm-engine.c (call-scm<-scmn-scmn): New instruction, takes
arguments as non-immediate offsets, to avoid needless loads and register
pressure.
* module/language/cps/effects-analysis.scm: Add cases for new
primcalls.
* module/language/cps/compile-bytecode.scm (compile-function): Add new
primcalls.
* module/language/cps/reify-primitives.scm (cached-module-box): If the
variable is bound, call lookup-bound-public / lookup-bound-private as
appropriate instead of separately resolving the module, name, and doing
the bound check.
* module/language/tree-il/compile-bytecode.scm (emit-cached-module-box):
Use new instructions.
* module/system/vm/assembler.scm (define-scm<-scmn-scmn-intrinsic):
(lookup-bound-public, lookup-bound-private): Add assembler support.
Diffstat (limited to 'libguile/jit.c')
-rw-r--r-- | libguile/jit.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libguile/jit.c b/libguile/jit.c index 45208be30..8420829b4 100644 --- a/libguile/jit.c +++ b/libguile/jit.c @@ -5217,6 +5217,26 @@ compile_s64_to_f64_slow (scm_jit_state *j, uint16_t dst, uint16_t src) { } +static void +compile_call_scm_from_scmn_scmn (scm_jit_state *j, uint32_t dst, + void *a, void *b, uint32_t idx) +{ + void *intrinsic = ((void **) &scm_vm_intrinsics)[idx]; + jit_operand_t op_a = jit_operand_imm (JIT_OPERAND_ABI_POINTER, (uintptr_t)a); + jit_operand_t op_b = jit_operand_imm (JIT_OPERAND_ABI_POINTER, (uintptr_t)b); + + emit_store_current_ip (j, T2); + emit_call_2 (j, intrinsic, op_a, op_b); + emit_retval (j, T0); + emit_reload_sp (j); + emit_sp_set_scm (j, dst, T0); +} +static void +compile_call_scm_from_scmn_scmn_slow (scm_jit_state *j, uint32_t dst, + void *a, void *b, uint32_t idx) +{ +} + #define UNPACK_8_8_8(op,a,b,c) \ do \ @@ -5575,6 +5595,16 @@ compile_s64_to_f64_slow (scm_jit_state *j, uint16_t dst, uint16_t src) comp (j, a, b, c, d, e); \ } +#define COMPILE_X8_S24__N32__N32__C32(j, comp) \ + { \ + uint32_t a; \ + UNPACK_24 (j->ip[0], a); \ + int32_t b = j->ip[1]; \ + int32_t c = j->ip[2]; \ + uint32_t d = j->ip[3]; \ + comp (j, a, j->ip + b, j->ip + c, d); \ + } + static uintptr_t opcodes_seen[256 / (SCM_SIZEOF_UINTPTR_T * 8)]; static uintptr_t |