> Odds are you'll get per-op event checking if you enable debugging, since
> the debugging oploop will really be a generic "check event every op" loop
> that happens to have the "pending debugging event" bit permanently set.
> Dunno whether we want to force this at compile time or consider some way to
> set it at runtime. I'd really like to be able to switch oploops
> dynamically, but I can't think of a good way to do that efficiently.

If you're looking to dynamically "insert statis checks every op", then
that sounds like picking a different runops function.  We've already got a
trace varient.  We could farm out a couple of these and have execution
flags specify which one to use.  If you wanted every 5'th op to check
flags, you could trivially do:

while(code) {
  DO_OP(..)

  if(code) DO_OP(..)

  if(code) DO_OP(..)

  if(code) DO_OP(..)

  if(code) DO_OP(..)

  CHECK_EVENTS(interp)
}

The inner loop is a little bigger, but aside from cache-issues, has no
performance overhead.  This would prevent having to interleave check-ops
everywhere (more importantly, it would reduce the complexity of the
compiler which would have to garuntee the injection of check-events inside
all code-paths (especially for complex flow-control like "last FOO".
You could use asynchronous timers to set various flags in the check-events
section (such as gc every so-often).  Of course this requires using a more
sophisticated "alarm/sleep" control system than the simple wrapper around
alarm/sleep and $SIG{X}, etc.

Other methods might be whenever a dynamic variable referencee is
reassigned / derefed, an event flag is set to Q the gc, etc.

-Michael

Reply via email to