JDK-8255718 : Zero: VM should know it runs in interpreter-only mode
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 8,11,15,16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-11-01
  • Updated: 2021-09-03
  • Resolved: 2020-11-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 16
11.0.13Fixed 16 b23Fixed
Related Reports
Relates :  
Description
There are many tests in tier1 that fail with Zero, because they supply -XX:+TieredCompilation, and that makes VM code believe it runs in "mixed" mode. 

Can be reproduced trivially by running anything with -XX:+TieredCompilation. Then Zero fails when runtime asks it to produce a native wrapper for MH intrinsics. That code is normally protected by Arguments::is_interpreter_only.

Method* SystemDictionary::find_method_handle_intrinsic(vmIntrinsics::ID iid,
                                                       Symbol* signature,
                                                       TRAPS) {
    ...
    if (!Arguments::is_interpreter_only()) {  // <--- checks here
      // Generate a compiled form of the MH intrinsic.
      AdapterHandlerLibrary::create_native_wrapper(m); // <--- fails through here
    }

...

sharedRuntime_zero.cpp:

nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
                                                const methodHandle& method,
                                                int compile_id,
                                                BasicType *sig_bt,
                                                VMRegPair *regs,
                                                BasicType ret_type,
                                                address critical_entry) {
  ShouldNotCallThis();  // <--- crashes here
  return NULL;
}

$ build/linux-x86_64-zero-fastdebug/images/jdk/bin/java -XX:+TieredCompilation 
OpenJDK 64-Bit Zero VM warning: -XX:+TieredCompilation not supported in this VM
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/sharedRuntime_zero.cpp:80
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/shade/trunks/jdk/src/hotspot/cpu/zero/sharedRuntime_zero.cpp:80), pid=404967, tid=404968
#  Error: ShouldNotCall()
#
# JRE version: OpenJDK Runtime Environment (16.0) (fastdebug build 16-internal+0-adhoc.shade.jdk)
# Java VM: OpenJDK 64-Bit Zero VM (fastdebug 16-internal+0-adhoc.shade.jdk, mixed mode, serial gc, linux-amd64)
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P %E" (or dumping to /home/shade/trunks/jdk/core.404967)
#
# An error report file with more information is saved as:
# /home/shade/trunks/jdk/hs_err_pid404967.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

Comments
Fix Request (11u) This fixes Zero with -XX:+TieredCompilation. Patch applies cleanly, Zero now starts well.
02-07-2021

Changeset: f0eeca90 Author: Aleksey Shipilev <shade@openjdk.org> Date: 2020-11-03 07:04:28 +0000 URL: https://github.com/openjdk/jdk/commit/f0eeca90
03-11-2020