Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AOT support for Method Handles #11442

Closed

Conversation

harryyu1994
Copy link
Contributor

@harryyu1994 harryyu1994 commented Dec 10, 2020

NonSVM implementation summary:

AOT compile run

  • our record needs these 4 pieces of information
InlinedSiteIndex
cpIndex
constantPool (not sure why this pointer is needed as we can get constantPool from inlinedSiteIndex)
classChain of j9class of arbitrary object
  • introduce TR_ResolvedRelocatableJ9Method::validateArbitraryObjectClassFromConstantPool which will handle adding both SVM and NonSVM validation records
  • looking to reuse storeValidationRecordIfNecessary, add new type TR_ValidateArbitraryObjectClass

AOT load run

  • TR_RelocationRecordValidateArbitraryObjectClass::applyRelocation() should contain the special logic for the AOT load run validation
    • use InlinedSiteIndex to find J9Method then from J9Method we can find J9ConstantPool
    • J9ConstantPool[cpIndex] gives us the arbitrary object
    • from the arbitrary object we can get J9Class
    • check the J9Class against classChain for the shape check
    • call getClassFromSignature() on classChain head name for the visibility check
  • TR_RelocationRecordValidateArbitraryObjectClass will need to be created, could extend from TR_RelocationRecordValidateClass, only applyRelocation() need to be overriden
  • initializeCommonAOTRelocationHeader and dumpRelocationHeaderData and TR_RelocationRecord::create all need a new case (TR_ValidateArbitraryObjectClass)
  • Issue: AOT Support for Method Handles #4850
  • depends on: Add method handle AOT support eclipse-omr/omr#5750

Signed-off-by: Harry Yu [email protected]

@harryyu1994
Copy link
Contributor Author

For the getClassFromSignature() visibility check part, how does one extract the first class from the classChain? @dsouzai
For this part i think we are trying to get a J9Class pointer using the class name of the patched object (first item in the classChain) and then compare that J9Class pointer to the J9Class of the current patched object.

@harryyu1994
Copy link
Contributor Author

For the getClassFromSignature() visibility check part, how does one extract the first class from the classChain? @dsouzai
For this part i think we are trying to get a J9Class pointer using the class name of the patched object (first item in the classChain) and then compare that J9Class pointer to the J9Class of the current patched object.

I think I have found it: J9ROMClass *romClass = _fej9->sharedCache()->startingROMClassOfClassChain(classChain);

@harryyu1994 harryyu1994 force-pushed the methodhandle_aot branch 2 times, most recently from 3fe3fe6 to 074c64b Compare December 12, 2020 01:57
@harryyu1994
Copy link
Contributor Author

NonSVM implementation is finished.
I still have a few things to sort out for the SVM implementation. (I want to revisit a few concepts regarding SVM)
Another thing, wondering if you know how we can disable inlining for method handle AOT compile so that this implementation can be tested.

@harryyu1994 harryyu1994 force-pushed the methodhandle_aot branch 13 times, most recently from 6ad8d6c to 4011ef1 Compare January 6, 2021 00:39
@harryyu1994
Copy link
Contributor Author

harryyu1994 commented Jan 13, 2021

Build MethodHandle JDK

Testing

cd openj9/test
git clone https://github.com/AdoptOpenJDK/TKG.git
cd TKG
export TEST_JDK_HOME=<path to JDK directory that you wish to test>
export BUILD_LIST=functional
make compile
make _sanity.regular EXTRA_OPTIONS="-Xshare:off"

@harryyu1994 harryyu1994 force-pushed the methodhandle_aot branch 4 times, most recently from c26e10d to c91a250 Compare January 14, 2021 20:49
@harryyu1994 harryyu1994 force-pushed the methodhandle_aot branch 3 times, most recently from a61fe1e to 3e73591 Compare January 21, 2021 23:29
@harryyu1994 harryyu1994 force-pushed the methodhandle_aot branch 2 times, most recently from 3cea0ec to 61b1138 Compare February 3, 2021 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants