Skip to content

Commit

Permalink
Add jit.tracebarrier() primitive
Browse files Browse the repository at this point in the history
Create an execution barrier that a JIT trace cannot cross. During
recording, the current trace must end when it reaches a barrier and
then a new root trace starts immediately afterwards.

This is implemented as a simple "nop" C library function. The existing
"trace stitching" mechanism provides the required semantics i.e. stop
current trace, call nop function, start new trace with linkage.
  • Loading branch information
lukego committed Nov 5, 2017
1 parent d400946 commit e182ae8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib_jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ LJLIB_CF(jit_status)
return (int)(L->top - L->base);
}

/* Calling this forces a trace stitch. */
LJLIB_CF(jit_tracebarrier)
{
return 0;
}

LJLIB_PUSH(top-5) LJLIB_SET(os)
LJLIB_PUSH(top-4) LJLIB_SET(arch)
LJLIB_PUSH(top-3) LJLIB_SET(version_num)
Expand Down

0 comments on commit e182ae8

Please sign in to comment.