1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-24 20:30:28 +02:00

Rework VM approach to shuffling unknown numbers of args

* libguile/vm-engine.c (shuffle-down, expand-apply-argument): New
  instructions.
  (tail-call, tail-call-label, return-values): Don't reset the frame.
  The compiler should reset the frame appropriately.
  (tail-call/shuffle, tail-apply): Remove unused instructions.
* libguile/vm.c (vm_builtin_apply_code): Use new shuffle-down and
  expand-apply-argument opcodes.
  (vm_builtin_call_with_values_code): Replace tail-call/shuffle with
  shuffle-down then tail-call.
* libguile/jit.c (compile_shuffle_down, compile_expand_apply_argument):
  Add compiler stubs
  (COMPILE_X8_F12_F12): New definition.
  (compile_tail_call_shuffle, compile_tail_apply): Remove unused
  compilers.
* module/language/cps/compile-bytecode.scm (compile-function): Emit
  reset-frame before tail calls and returns.
* module/system/vm/assembler.scm (system): Remove unbound "emit-return"
  export.
* module/system/vm/disassembler.scm (code-annotation)
  (instruction-has-fallthrough?, define-stack-effect-parser): Adapt for
  opcode changes.
This commit is contained in:
Andy Wingo 2018-07-19 10:56:44 +02:00
parent 043432fd57
commit c2a8224a63
6 changed files with 106 additions and 151 deletions

View file

@ -61,17 +61,12 @@ compile_call_label (scm_jit_state *j, uint32_t a, uint32_t b, int32_t offset)
}
static void
compile_tail_call (scm_jit_state *j, uint32_t a)
compile_tail_call (scm_jit_state *j)
{
}
static void
compile_tail_call_label (scm_jit_state *j, uint32_t a, int32_t offset)
{
}
static void
compile_tail_call_shuffle (scm_jit_state *j, uint32_t a)
compile_tail_call_label (scm_jit_state *j, int32_t offset)
{
}
@ -86,7 +81,12 @@ compile_receive_values (scm_jit_state *j, uint32_t a, uint8_t b, uint32_t c)
}
static void
compile_return_values (scm_jit_state *j, uint32_t a)
compile_shuffle_down (scm_jit_state *j, uint16_t from, uint16_t to)
{
}
static void
compile_return_values (scm_jit_state *j)
{
}
@ -110,11 +110,6 @@ compile_compose_continuation (scm_jit_state *j, uint32_t a)
{
}
static void
compile_tail_apply (scm_jit_state *j)
{
}
static void
compile_call_cc (scm_jit_state *j)
{
@ -190,6 +185,11 @@ compile_assert_nargs_ee_locals (scm_jit_state *j, uint16_t a, uint16_t b)
{
}
static void
compile_expand_apply_argument (scm_jit_state *j)
{
}
static void
compile_bind_kwargs (scm_jit_state *j, uint32_t a, uint8_t b, uint32_t c, uint32_t d, int32_t offset)
{
@ -917,6 +917,8 @@ compile_f64_set (scm_jit_state *j, uint8_t a, uint8_t b, uint8_t c)
COMPILE_X8_C12_C12 (j, comp)
#define COMPILE_X8_S12_S12(j, comp) \
COMPILE_X8_C12_C12 (j, comp)
#define COMPILE_X8_F12_F12(j, comp) \
COMPILE_X8_C12_C12 (j, comp)
#define COMPILE_X8_S12_Z12(j, comp) \
{ \
@ -953,6 +955,13 @@ compile_f64_set (scm_jit_state *j, uint8_t a, uint8_t b, uint8_t c)
j->ip += 2; \
}
#define COMPILE_X32__L32(j, comp) \
{ \
int32_t a = j->ip[1]; \
comp (j, a); \
j->ip += 1; \
}
#define COMPILE_X8_C24__L32(j, comp) \
{ \
uint32_t a; \