Created
December 8, 2018 09:08
-
-
Save lschuetze/019d1eaba1ba0551e6e7d2a7052bcec3 to your computer and use it in GitHub Desktop.
This file contains 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
// The invokeDynamic bootstrap links a | |
// (BaseType, args*)RetType to (RoleType, args*)RetType | |
// where there are many different such RoleType which are inner classes of a TeamType | |
// On the stack we have an BaseType object and args* | |
// Iterate over all active Teams | |
while (teamIterator.hasNext()) { | |
ITeam currentTeam = teamIterator.next(); | |
Class<?> teamClass = currentTeam.getClass(); | |
// Find the MethodHandle of the role method (before/after/replace callin) | |
// with the signature (RoleType, args*)RetType | |
MethodHandle roleMethod = ObjectTeamsLookup.findRoleMethod(desc.getLookup(), binding, teamClass); | |
// Find the lifting method that maps each BaseType object to its RoleType object | |
// with the signature (TeamType, BaseType)RoleType | |
MethodHandle liftRoleHandle = ObjectTeamsLookup.findLifting(desc.getLookup(), binding, teamClass); | |
// Bind the currentTeam of type TeamType so the liftRoleHandle signature fits | |
MethodHandle liftRole = liftRoleHandle.bindTo(currentTeam); | |
// filter the argument such that the signature of liftRole will be adapted from | |
// (BaseType, args*) to (RoleType, args*) | |
MethodHandle callinHandle = MethodHandles.filterArguments(roleMethod, 0, liftRole); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment