United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7010180 JSR 292 InvokeDynamicPrintArgs fails with: assert(_adapter == NULL) failed: init'd to NULL
JDK-7010180 : JSR 292 InvokeDynamicPrintArgs fails with: assert(_adapter == NULL) failed: init'd to NULL

Details
Type:
Bug
Submit Date:
2011-01-04
Status:
Closed
Updated Date:
2012-02-01
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs20
Fixed Versions:
hs20 (b07)

Related Reports
Backport:
Backport:
Duplicate:
Relates:

Sub Tasks

Description
InvokeDynamicPrintArgs fails on a 64-bit SPARC debug build with:

$ gamma -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic -cp /java/devtools/share/junit/latest/junit.jar:test/java/dyn/ indify.Indify --verify-specifier-count=3 --transitionalJSR292=false --expand-properties --classpath test/java/dyn/ --java InvokeDynamicPrintArgs --check-output 
VM option '+UnlockExperimentalVMOptions'
VM option '+EnableInvokeDynamic'
patching InvokeDynamicPrintArgs.main(L)V
16:invokestatic 6 INDY_nothing()L;...; 19:invokevirtual 7 => invokedynamic 376:InvokeDynamic[0, 374]
22:invokestatic 8 INDY_bar()L;...; 28:invokevirtual 10 => invokedynamic 383:InvokeDynamic[1, 381]
31:invokestatic 11 INDY_bar2()L;...; 39:invokevirtual 10 => invokedynamic 385:InvokeDynamic[1, 384]
42:invokestatic 13 INDY_baz()L;...; 51:invokevirtual 17 => invokedynamic 388:InvokeDynamic[2, 387]
54:invokestatic 18 INDY_foo()L;...; 59:invokevirtual 20 => invokedynamic 379:InvokeDynamic[0, 378]
patching InvokeDynamicPrintArgs.bsm(LLL)L
24:invokestatic 66 MH_printArgs()L => ldc 366:MethodHandle[6, 365]
patching InvokeDynamicPrintArgs.bsm2(LLLL)L
69:invokestatic 66 MH_printArgs()L => ldc 366:MethodHandle[6, 365]
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/methodOop.cpp:691
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/twisti/hotspot-comp/hotspot/src/share/vm/oops/methodOop.cpp:691), pid=2007, tid=2
#  assert(_adapter == NULL) failed: init'd to NULL
#
# JRE version: 7.0-b123
# Java VM: OpenJDK 64-Bit Server VM (20.0-b04-internal-jvmg mixed mode solaris-sparc compressed oops)

                                    

Comments
SUGGESTED FIX

Link sun.dyn.MethodHandleImpl class before generating the method handle adapters.  This ensures that the required c2i-adapter exists.
                                     
2011-01-04
EVALUATION

Part of the backtrace is:

  [7] report_vm_error(file = 0xffffffff7ed770f8 "/home/twisti/hotspot-comp/hotspot/src/share/vm/oops/methodOop.cpp", line = 691, error_msg = 0xffffffff7ed7713c "assert(_adapter == NULL) failed", detail_msg = 0xffffffff7ed7715c "init'd to NULL"), line 216 in "debug.cpp"
  [8] methodOopDesc::link_method(this = 0xfffffffe700984e8, h_method = CLASS, __the_thread__ = 0x100138800), line 691 in "methodOop.cpp"
  [9] Rewriter::Rewriter(this = 0xffffffff7c2fb808, klass = CLASS, cpool = CLASS, methods = CLASS, __the_thread__ = 0x100138800), line 376 in "rewriter.cpp"
  [10] Rewriter::rewrite(klass = CLASS, __the_thread__ = 0x100138800), line 316 in "rewriter.cpp"
  [11] instanceKlass::rewrite_class(this = 0xfffffffe700989b0, __the_thread__ = 0x100138800), line 385 in "instanceKlass.cpp"
<snip>

The failing methodOop is:

sun.dyn.MethodHandleImpl::raiseException

Since 7007377 during method handles adapter generation the adapters for sun.dyn.MethodHandleImpl::raiseException are also generated.  Later when the Rewriter wants to link the method the adapter entry already exists and the assert triggers.
*** (#1 of 1): [ UNSAVED ] ###@###.###
                                     
2011-01-04
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/d810e9a3fc33
                                     
2011-01-10



Hardware and Software, Engineered to Work Together