IR Event Handling #996

wants to merge 25 commits into


None yet

2 participants

JRuby Team member

As discussed with @enebo and @subbuss, I designed and implemented a simple mechanism, to listen to events on IR, CFG, ... changes/updates. To put it more in detail:

  • IRScopeListener listens to addInstr, when an (IR) Instruction is added to the IRScope
  • IRScopeListener keeps track of the IRBuilder#build method, so it adds a hook before building an (IR) Operand and a hook after building it
  • InstructionsListener abstracts over an List<Instr>, for instance a BasicBlock. It records all updates/adds/removals to the original list, to enable a fine granular diff mechanism

In addition:

  • fixed Imports for IRScope
  • add of IRScope.equals(Object) based on the scopeId field

If you need more information or I should update my PR, just ping me.

komax added some commits Sep 2, 2013
@komax komax Draft for a Listener Interface on IRScopes:
1. add of instr to the scope
2. begin and end (with its Operand result) of

1. enables traceability from scope to its instructions and 2. the mapping of an
IRScope to its (AST)Node
@komax komax Wrapper for notfications on a List<Instr> (used in BasicBlock) e5df7fc
@komax komax Listener on changes of a List<Instr> for instance inside of a basic b…

1. models the operation of modification
2. callback function to specify what going to change
@komax komax Merge remote-tracking branch 'upstream/master' into komax_ir_eventing d8794ac
@komax komax Stub for own listIterator with eventing 9741310
@komax komax Updating instrs to enable diffs on instruction listeners edec833
@komax komax Custom ListIterator without eventing, yet b8daade
@komax komax Add of listener to list iterator and as private field inside of the l…
…ist wrapper
@komax komax Add and remove on list with listener; Implementation for listIterator…
@komax komax Completed implementing the list with orthogonal calls into primitive …
…calls (listIterator, retainAll) with eventing as side effect
@komax komax Merge remote-tracking branch 'upstream/master' into komax_ir_eventing 25a013e
@komax komax addAll(Collection) emits events e13f93f
@komax komax Javadoc for instrChanged 73f90b9
@komax komax Injecting of InstructionListener to IRManager ae50f92
@komax komax getInstructionsListener() to request the listener 7a87789
@komax komax Wrap the instructions of basic blocks, plugin the listener 46a52b2
@komax komax Fixed imports 608b845
@komax komax Merge branch 'master' into komax_ir_eventing 4ca815d
@komax komax Fixed imports 0cfa5bb
@komax komax equals(Object) based on scopeId d47b64a
@komax komax Integration of the IRScopeListener f3fb629
@komax komax index for addedInstr 9748c2a
@komax komax Emit of events for addInstr 82805ea
@komax komax Correct hasListener to check, if listener is used b329787
@komax komax Moved build to own helper; build with eventing 0dc4915
JRuby Team member

I am not going to automerge this but I will cherry-pick and manually merge these. I would have preferred a PR which had rebased against master rather than did a series of merges. I am seeing lots of other diff output here and it always makes me nervous...

JRuby Team member

Ah, sorry for these inconveniences. I did not know I should have to rebase it. Thank you for manually merging it! Should I close therefore this PR?

@enebo enebo was assigned Sep 14, 2013
JRuby Team member

In truth, merging with what you had would have been ok but I saw a warning since this was not merged recently so I decided to manually do it to better review the PR since it was somewhat big. It was pretty simple to do manually.

@komax komax closed this Sep 16, 2013
JRuby Team member

Ok, I closed it, therefore :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment