Nicholas Clark wrote:
On Thu, Jul 17, 2003 at 08:40:44PM -0400, Benjamin Goldberg wrote:


Actually, I'm thinking of something like the following... suppose the
original code is like:

  label_foo:
  loop body
  branch_address:
  branch label_foo

Add in the following:

  e_handler_foo:
  .local PerlHash handlers_with_events
  .local int i_have_an_event
  handlers_with_events = ....
  i_have_an_event = handlers_with_events[cur_thread]
  unless i_have_an_event, label_foo
  bsr dequeue_events_and_handle_them_all
  branch label_foo

And then, when an event occurs, replace "branch label_foo" with "branch
e_handler_foo".

When there are no events queued, for any thread, then we change "branch
e_handler_foo" back into "branch label_foo", for speed.


Do we need to do this last bit explicitly? Or can we do it lazily -
each time we get called to e_handler when there are no longer events,
we change back that instruction.

Or is this already done this way?


Some issues related to this scheme:

1) In a highly secure mode, you don't want self modifing code.  we need
a way to lock down code into RO memory when security is important.  A
similar problem exists with modifing vtables on the fly.

2) Making that exception safe may be a problem.

3) Is parriot byte code suppose to be position independent?  Having
all code be PIC makes dynamic loading simpler.

4) As parriot ops are rather CISC anyway, maybe a special op
that checks for events and takes one of two branches could be used here.



--
[EMAIL PROTECTED]
[EMAIL PROTECTED]



Reply via email to