United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6969569 assert(is_static() && is_constant()) failed: illegal call to constant_value()
JDK-6969569 : assert(is_static() && is_constant()) failed: illegal call to constant_value()

Details
Type:
Bug
Submit Date:
2010-07-15
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
hotspot
OS:
generic,solaris_10
Sub-Component:
compiler
CPU:
x86,sparc
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs19
Fixed Versions:
hs19 (b06)

Related Reports
Backport:
Backport:
Backport:
Backport:
Duplicate:

Sub Tasks

Description
Failure during compilation of sun.dyn.FromGeneric.of():

% /java/re/jdk/7/latest/binaries/solaris-amd64/fastdebug/bin/java -d64 -version
java version "1.7.0-ea-fastdebug"
Java(TM) SE Runtime Environment (build 1.7.0-ea-fastdebug-b100)
Java HotSpot(TM) 64-Bit Server VM (build 19.0-b03-fastdebug, mixed mode)

% /java/re/jdk/7/latest/binaries/solaris-amd64/fastdebug/bin/java -d64 -Xcomp -XX:CompileThreshold=100 -XX:+AggressiveOpts -XX:+UseCompressedOops -XX:+CompileTheWorld -XX:CompileTheWorldStartAt=13001 -XX:CompileTheWorldStopAt=14000 -XX:MaxPermSize=384M -Xmx512M -Xbootclasspath/p:/java/re/jdk/7/latest/binaries/solaris-amd64/jre/lib/rt.jar

CompileTheWorld (13228) : Skipping sun/dyn/FromGeneric$Adapter
CompileTheWorld (13229) : sun/dyn/FromGeneric
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/ciField.hpp:141
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/BUILD_AREA/jdk7/hotspot/src/share/vm/ci/ciField.hpp:141), pid=23179, tid=51
#  assert(is_static() && is_constant()) failed: illegal call to constant_value()
#
# JRE version: 7.0
# Java VM: Java HotSpot(TM) 64-Bit Server VM (19.0-b03-fastdebug compiled mode solaris-amd64 compressed oops)
# An error report file with more information is saved as:
# /export/kvn/ctw/hs_err_pid23179.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#

 
---------------  T H R E A D  --------------- 
 
Current thread (0x000000000329e000):  JavaThread "CompilerThread1" daemon [_thread_in_native, id=51, stack(0xfffffd7ff7fcb000,0xfffffd7ff80cb000)] 
 
Stack: [0xfffffd7ff7fcb000,0xfffffd7ff80cb000],  sp=0xfffffd7ff80c1ff0,  free space=3db0000000000000001k 
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) 
V  [libjvm.so+0x20c523c] void VMError::report(outputStream*) + 0x6ac
V  [libjvm.so+0x20c6288] void VMError::report_and_die() + 0x4d8
V  [libjvm.so+0xafc05b] void report_vm_error(const char*,int,const char*,const char*) + 0x5bb
V  [libjvm.so+0x181a64e] bool PhaseMacroExpand::scalar_replacement(AllocateNode*,GrowableArray<SafePointNode*>&) + 0x1f0e
V  [libjvm.so+0x181c283] bool PhaseMacroExpand::eliminate_allocate_node(AllocateNode*) + 0x4c3
V  [libjvm.so+0x18372f9] bool PhaseMacroExpand::expand_macro_nodes() + 0x3a9
V  [libjvm.so+0x98ea1b] void Compile::Optimize() + 0x13cb
V  [libjvm.so+0x986376] Compile::Compile(ciEnv*,C2Compiler*,ciMethod*,int,bool,bool) + 0x1676
V  [libjvm.so+0x73962b] void C2Compiler::compile_method(ciEnv*,ciMethod*,int) + 0x10b
V  [libjvm.so+0x9a5de9] void CompileBroker::invoke_compiler_on_method(CompileTask*) + 0x11e9
V  [libjvm.so+0x9a3f08] void CompileBroker::compiler_thread_loop() + 0xdb8
V  [libjvm.so+0x1f90a14] void JavaThread::thread_main_inner() + 0x1b4
V  [libjvm.so+0x1f90651] void JavaThread::run() + 0x621
V  [libjvm.so+0x1af1daa] java_start + 0x66a
C  [libc.so.1+0x114ad4]  _thrp_setup+0xbc _thrp_setup + 0xbc
C  [libc.so.1+0x114d90]  _lwp_start+0x0 _lwp_start + 0x0
 
 
Current CompileTask: 
C2:14264   b  sun.dyn.FromGeneric.of(Ljava/dyn/MethodType;)Lsun/dyn/FromGeneric; (33 bytes) 


An other one is sun.dyn.SpreadGeneric.of() method. Change -XX:CompileTheWorldStartAt=13001 to -XX:CompileTheWorldStartAt=13230.

                                    

Comments
SUGGESTED FIX

diff --git a/src/share/vm/opto/macro.cpp b/src/share/vm/opto/macro.cpp
--- a/src/share/vm/opto/macro.cpp
+++ b/src/share/vm/opto/macro.cpp
@@ -722,7 +722,7 @@
       if (basic_elem_type == T_OBJECT || basic_elem_type == T_ARRAY) {
         if (!elem_type->is_loaded()) {
           field_type = TypeInstPtr::BOTTOM;
-        } else if (field != NULL && field->is_constant()) {
+        } else if (field != NULL && field->is_constant() && field->is_static()) {
           // This can happen if the constant oop is non-perm.
           ciObject* con = field->constant_value().as_object();
           // Do not "join" in the previous type; it doesn't add value,
                                     
2010-07-23
EVALUATION

All callers of ciField::constant_value must be guarded by both is_constant and is_static.

For non-static fields, the correct accessor is ciField::constant_value_of.

A quick grep over the sources shows that only macros.cpp has a missing guard.

See suggested fix, and compare with similar code in c1_Canonicalizer.cpp (near line 232).
                                     
2010-07-23
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/e5dfb3ccb88b
                                     
2010-07-23
PUBLIC COMMENTS

PhaseMacroExpand::scalar_replacement() and ciField::print()
have a missing is_static guard.

Solution:
Add missing is_static guard.
                                     
2010-07-23
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/e5dfb3ccb88b
                                     
2010-08-14



Hardware and Software, Engineered to Work Together