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

Update resolve code to support OpenJDK MH #10893

Merged
merged 5 commits into from
Nov 13, 2020

Conversation

fengxue-IS
Copy link
Contributor

@fengxue-IS fengxue-IS commented Oct 14, 2020

  • Rename methodTypes table to invokeCache table
  • new sendResolveOpenJDKInvokeHandle
  • new resolveInvokeHandle
  • update resolveInvokeDynamic
  • update resolveVirtualMethodRefInto
  • update resolveStaticMethodRefInto
  • Modify Interpreter code to support the new single slot design
  • update old_slow_jitResolveHandleMethod

Related: #7352

Co-authored-by: Babneet Singh sbabneet@ca.ibm.com
Signed-off-by: Jack Lu Jack.S.Lu@ibm.com

@DanHeidinga
Copy link
Member

@fengxue-IS can you @ me when this is ready to be reviewed?

@DanHeidinga
Copy link
Member

@fengxue-IS is this ready for another review cycle?

@DanHeidinga DanHeidinga self-assigned this Oct 30, 2020
@fengxue-IS
Copy link
Contributor Author

@DanHeidinga Apology for the late reply, I have been trying to resolve a crash when testing this change locally enabling OpenJDK_MethodHandle flag. With Tobi & Babneet's help, the problem is because of java code called during memberName resolution and triggered GC which moved the heap object and need to be refetched.

This is ready for review, can you please take a look?

FYI @babsingh @liqunl @nbhuiyan

@fengxue-IS fengxue-IS marked this pull request as ready for review November 4, 2020 18:34
@fengxue-IS fengxue-IS changed the title [WIP] Update resolve code to support OpenJDK MH Update resolve code to support OpenJDK MH Nov 4, 2020
@DanHeidinga
Copy link
Member

Thanks for the update Jack. I'm aiming to review this later this week

Copy link
Contributor

@babsingh babsingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A mixture of functional and formatting issues are identified.

runtime/bcutil/ConstantPoolMap.hpp Outdated Show resolved Hide resolved
runtime/bcutil/ConstantPoolMap.hpp Show resolved Hide resolved
runtime/codert_vm/cnathelp.cpp Outdated Show resolved Hide resolved
runtime/codert_vm/cnathelp.cpp Show resolved Hide resolved
runtime/vm/BytecodeInterpreter.hpp Outdated Show resolved Hide resolved
runtime/vm/resolvesupport.cpp Outdated Show resolved Hide resolved
runtime/vm/resolvesupport.cpp Outdated Show resolved Hide resolved
runtime/vm/resolvesupport.cpp Outdated Show resolved Hide resolved
runtime/vm/resolvesupport.cpp Outdated Show resolved Hide resolved
runtime/vm/resolvesupport.cpp Outdated Show resolved Hide resolved
@fengxue-IS fengxue-IS force-pushed the jsr292_resolve2 branch 2 times, most recently from b959b48 to 8e73fef Compare November 5, 2020 22:58
runtime/bcutil/ConstantPoolMap.hpp Outdated Show resolved Hide resolved
runtime/codert_vm/cnathelp.cpp Show resolved Hide resolved
runtime/codert_vm/cnathelp.cpp Outdated Show resolved Hide resolved
@@ -85,7 +85,11 @@ class GC_ClassIterator {
, _classStaticsIterator(env, clazz)
, _constantPoolObjectSlotIterator((J9JavaVM *)env->getLanguageVM(), clazz)
, _callSitesIterator(clazz)
#if defined(J9VM_OPT_OPENJDK_METHODHANDLE)
, _methodTypesIterator(clazz->romClass->invokeCacheCount, clazz->invokeCache)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this iterator be renamed given it's 1) not iterating MTs anymore, 2) it's now dealing with the invokeCache?

@amicic opinions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems reasonable, but since I don't fully understand relationship between MH and invokeCache, I'll add @dmitripivkine

Copy link
Contributor

@amicic amicic Nov 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(from my narrow perspective) I'm wondering why the ifdef build flag has METHODHANDLE in the name, and should it be INVOKECACHE ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ifdef is for the other all feature which is using the OpenJDK MH implementation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fengxue-IS Can you open an issue to track renaming the GC_MethodTypesIterator to something like GC_InvokeCacheIterator? We need to track it as a cleanup task that should be done before the final cutover but doesn't need to be included in this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created #11168 to track this cleanup work

runtime/oti/j9nonbuilder.h Outdated Show resolved Hide resolved
runtime/vm/resolvesupport.cpp Outdated Show resolved Hide resolved
runtime/vm/resolvesupport.cpp Outdated Show resolved Hide resolved
runtime/vm/resolvesupport.cpp Outdated Show resolved Hide resolved
runtime/vm/resolvesupport.cpp Outdated Show resolved Hide resolved
runtime/vm/resolvesupport.cpp Outdated Show resolved Hide resolved
@DanHeidinga
Copy link
Member

@fengxue-IS ping me when the review has been addressed and I'll give this another look

@fengxue-IS
Copy link
Contributor Author

fengxue-IS commented Nov 12, 2020

  • Fixed formating/comments as suggested in review
  • rename resolveInvokeHandle to resolveOpenJDKInvokeHandle for consistency
  • new Trc_VM_Assert_ShouldNeverHappen for unreachable code path
  • added writeBarrier before CAS on the result array to ensure array elements are written before the array can be accessed
  • modified method lookup to use J9_LOOK_DIRECT_NAS flag

@DanHeidinga thanks for the feedback, can you please take another look?

@DanHeidinga
Copy link
Member

@liqunl are you OK with the JIT helper change?

@DanHeidinga
Copy link
Member

Jenkins test sanity zlinux jdk8

@DanHeidinga
Copy link
Member

Jenkins test sanity win jdk11

@DanHeidinga
Copy link
Member

Jenkins test sanity osx jdk15

@fengxue-IS fengxue-IS force-pushed the jsr292_resolve2 branch 2 times, most recently from 955d40f to 2a3dd87 Compare November 12, 2020 21:05
@fengxue-IS
Copy link
Contributor Author

Fixed compiler warning about unused variable nullSignature, local linux Java 11 compile passed.
@DanHeidinga can you restart the pr build

@DanHeidinga
Copy link
Member

Jenkins test sanity osx jdk15

@DanHeidinga
Copy link
Member

Jenkins test sanity win jdk11

@DanHeidinga
Copy link
Member

Jenkins test sanity zlinux jdk8

@DanHeidinga
Copy link
Member

Note, all the builds have passed now. I'm ready to merge this once the conflict is resolved.

Any remaining concerns @babsingh @liqunl?

@fengxue-IS can you resolve the conflict in jvm.tdf?

@babsingh
Copy link
Contributor

No more concerns.

fengxue-IS and others added 5 commits November 13, 2020 11:47
Co-authored-by: Babneet Singh <sbabneet@ca.ibm.com>
Signed-off-by: Jack Lu <Jack.S.Lu@ibm.com>
- new sendResolveOpenJDKInvokeHandle
- new resolveOpenJDKInvokeHandle
- update resolveInvokeDynamic
- update resolveVirtualMethodRefInto
- update resolveStaticMethodRefInto

Co-authored-by: Babneet Singh <sbabneet@ca.ibm.com>
Signed-off-by: Jack Lu <Jack.S.Lu@ibm.com>
Modify Interpreter code to support the new single slot design

Co-authored-by: Babneet Singh <sbabneet@ca.ibm.com>
Signed-off-by: Jack Lu <Jack.S.Lu@ibm.com>
- update old_slow_jitResolveHandleMethod

Co-authored-by: Babneet Singh <sbabneet@ca.ibm.com>
Signed-off-by: Jack Lu <Jack.S.Lu@ibm.com>
Signed-off-by: Jack Lu <Jack.S.Lu@ibm.com>
@fengxue-IS
Copy link
Contributor Author

Fixed conflict in j9vm.tdf, local compile passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:vm project:MH Used to track Method Handles related work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants