1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-18 17:50:29 +02:00

Emit instrument-loop in loops.

* am/bootstrap.am (SOURCES):
* module/Makefile.am (SOURCES): Handle renamve of handle-interrupts.scm
  to loop-instrumentation.scm.
* libguile/jit.h (SCM_JIT_COUNTER_ENTRY_INCREMENT): Rename from
  SCM_JIT_COUNTER_CALL_INCREMENT.
* libguile/vm-engine.c (instrument-entry): Rename from instrument-call.
* module/language/cps/compile-bytecode.scm (compile-function): Add
  handle-interrupts code before calls and returns.  Compile the
  "instrument-loop" primcall to an "instrument-loop" instruction and a
  "handle-interrupts" instruction.
  (lower-cps): Adapt to add-loop-instrumentation name change.
* module/language/cps/loop-instrumentation.scm: Rename from
  handle-interrupts.scm and just add "instrument-loop" primcalls in
  loops.  The compiler will add handle-interrupts primcalls as
  appropriate.
* module/system/vm/assembler.scm (<jit-data>): New data type, for
  emitting embedded JIT data.
  (<meta>): Add field for current JIT data.
  (make-meta): Initialize current JIT data.
  (emit-instrument-entry*, emit-instrument-loop*): New instruction
  emitters that reference the current JIT data.
  (end-program): Now that all labels are known, arrange to serialize the
  JIT data.
  (link-data): Reserve space for JIT data, and add relocs to initialize
  the "start" / "end" fields.
This commit is contained in:
Andy Wingo 2018-07-25 13:08:05 +02:00
parent 87da1c8d20
commit a6b5049aa8
8 changed files with 82 additions and 47 deletions

View file

@ -468,14 +468,14 @@ VM_NAME (scm_thread *thread)
NEXT (0);
}
/* instrument-call _:24 data:32
/* instrument-entry _:24 data:32
*
* Increase execution counter for this function and potentially tier
* up to the next JIT level. DATA is an offset to raw profiler,
* recording execution counts and the next-level JIT code
* corresponding to this function. Also run the apply hook.
*/
VM_DEFINE_OP (5, instrument_call, "instrument-call", OP2 (X32, N32))
VM_DEFINE_OP (5, instrument_entry, "instrument-entry", OP2 (X32, N32))
{
int32_t data_offset = ip[1];
struct scm_jit_function_data *data;
@ -497,7 +497,7 @@ VM_NAME (scm_thread *thread)
}
}
else
data->counter += SCM_JIT_COUNTER_CALL_INCREMENT;
data->counter += SCM_JIT_COUNTER_ENTRY_INCREMENT;
NEXT (2);
}