Add first-gate listener override handling#977
Merged
masesdevelopers merged 9 commits intomasterfrom Apr 25, 2026
Conversation
Introduce a first-gate mechanism to optimize and detect CLR-side listener overrides. - InternalMethods.cs: added builder/strings to emit listener "first gate" parameter type lists and wiring to replace a new template placeholder; track event handler index and insert a first-gate block before listener handlers so listener dispatch can quickly test if the CLR override exists. - Templates: added GetMethodIsOverridden helper and a readonly flag in the generated class template to detect if ListenerShallManageEvent is overridden (second gate). Added new template placeholders/constants and formats (SINGLE_LISTENER_FIRST_GATE_FORMAT and BLOCK_LISTENER_FIRST_GATE_FORMAT). Updated single-listener template to store handler index, check override presence, and short-circuit when no override is present. - Misc: switched listener execution helper to use a readonly _hasOverride flag and pass listener parameter type info for the first-gate checks. This change reduces unnecessary event processing by quickly determining whether the CLR implementation overrides the listener before doing heavier event analysis.
…range the replace sequence
| { | ||
| var listenerBlock = string.Format(AllPackageClasses.ClassStub.MethodStub.BLOCK_LISTENER_HANDLER_FORMAT, classDefinition.JVMClassName(null, false, false), subListenerHandlerBlock.ToString()); | ||
| returnStr = listenerBlock + returnStr; | ||
| var firstGateBlock = string.Format(AllPackageClasses.ClassStub.MethodStub.BLOCK_LISTENER_FIRST_GATE_FORMAT, subListenerFirstGateBlock.ToString()); |
This was referenced Apr 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Introduce a first-gate mechanism to optimize and detect CLR-side listener overrides.
This change reduces unnecessary event processing by quickly determining whether the CLR implementation overrides the listener before doing heavier event analysis.
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: