RFR: 8269592: [JVMCI] Optimize c2v_iterateFrames [v2]

Andreas Woess aw at openjdk.java.net
Fri Jul 9 12:15:22 UTC 2021


> Several smaller optimizations and cleanups to JVMCI's iterateFrames:
> * Restructure the iterateFrames method for better readability and maintenance, with some parts extracted to helper functions.
> * Use vframeStream as the iterator for faster iteration in case not every vframe matches the method filter, so we can avoid creating javaVFrames for skipped vframes. We use vframeStream::asJavaVFrame() to get the current javaVFrame.
> * Extended vframeStream::asJavaVFrame() to also work with native frames, so that it works with all java frames returned by vframeStream. This way, native compiledVFrames will just work and do not need extra handling.
> Test coverage is provided via a newly added iterateFrames jtreg test that includes a JNI call on the stack.
> * Added two trivial getters to vframeStream: vframe_id() and decode_offset().
> These are used together with compiledVFrame::at_scope() to avoid going through vframeStream::asJavaVFrame() and recreating the scope objects for every matched inlined vframe of a compiled frame which would be more expensive than using javaVFrame::sender() (that shares the scope object pool).
> * Only resolve the callback interface method once per iterateFrames call.
> * Only resolve the Method* of the ResolvedJavaMethods to be matched once per iterateFrames call.
> * Only allocate localIsVirtual array if at least one local is virtual (the Java part already expects this).
> * Use matched ResolvedJavaMethod instances instead of going through JVMCIEnv::get_jvmci_method, if possible.

Andreas Woess has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains five new commits since the last revision:

 - Convert guarantee()s in asJavaVFrame() to assert()s.
 - [JVMCI] Test iterateFrames with native frames.
 - [JVMCI] Optimize iterateFrames.
 - Add support for native frames to vframeStreamCommon::asJavaVFrame().
 - Add getters to vframeStreamCommon.

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/4625/files
  - new: https://git.openjdk.java.net/jdk/pull/4625/files/b7b029c0..1d53feb5

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=4625&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=4625&range=00-01

  Stats: 12 lines in 3 files changed: 2 ins; 0 del; 10 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4625.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4625/head:pull/4625

PR: https://git.openjdk.java.net/jdk/pull/4625


More information about the hotspot-dev mailing list