United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-8000263 JSR 292: signature types may appear to be unloaded
JDK-8000263 : JSR 292: signature types may appear to be unloaded

Details
Type:
Bug
Submit Date:
2012-09-28
Status:
Resolved
Updated Date:
2013-04-30
Project Name:
JDK
Resolved Date:
2012-10-09
Component:
hotspot
OS:
Sub-Component:
compiler
CPU:
Priority:
P3
Resolution:
Fixed
Affected Versions:
Fixed Versions:
hs25 (b05)

Related Reports
Backport:
Backport:
Backport:
Backport:
Relates:

Sub Tasks

Description
In certain situations signature types like java/lang/Object may appear to be unloaded which leads to deoptimizations and recompilations.
                                    

Comments
In this particular case the type of a pointer field was not initialized and we have to call ciField::compute_type to get the type.  The class loader of the field holder is a non-boot class loader and this loader doesn't know about java/lang/Object.

(dbx) where
current thread: t@30
=>[1] ciEnv::get_klass_by_name_impl(this = 0x73b7da98, accessing_klass = 0x8c70cc0, cpool = CLASS, name = 0x81331d8, require_local = false), line 447 in "ciEnv.cpp"
  [2] ciEnv::get_klass_by_name_impl(this = 0x73b7da98, accessing_klass = 0x8c70cc0, cpool = CLASS, name = 0x8136118, require_local = false), line 358 in "ciEnv.cpp"
  [3] ciField::compute_type_impl(this = 0x87b2e08), line 290 in "ciField.cpp"
  [4] ciField::compute_type(this = 0x87b2e08), line 286 in "ciField.cpp"
  [5] ciField::type(this = 0x87b2e08), line 105 in "ciField.hpp"
  [6] LibraryCallKit::sharpen_unsafe_type(this = 0x73b78d0c, alias_type = 0x87869d4, adr_type = 0x8bbf954, is_native_ptr = false), line 2366 in "library_call.cpp"
  [7] LibraryCallKit::inline_unsafe_access(this = 0x73b78d0c, is_native_ptr = false, is_store = false, type = T_OBJECT, is_volatile = false), line 2525 in "library_call.cpp"
  [8] LibraryCallKit::try_to_inline(this = 0x73b78d0c), line 548 in "library_call.cpp"
  [9] LibraryIntrinsic::generate(this = 0x8be1b70, jvms = 0x8b42cf8), line 468 in "library_call.cpp"
  [10] Parse::do_call(this = 0x73b79728), line 451 in "doCall.cpp"
  [11] Parse::do_one_bytecode(this = 0x73b79728), line 2286 in "parse2.cpp"
  [12] Parse::do_one_block(this = 0x73b79728), line 1405 in "parse1.cpp"
  [13] Parse::do_all_blocks(this = 0x73b79728), line 680 in "parse1.cpp"
  [14] Parse::Parse(this = 0x73b79728, caller = 0x8b41d60, parse_method = 0x87b0820, expected_uses = 47224.0), line 589 in "parse1.cpp"
  [15] ParseGenerator::generate(this = 0x8be19d0, jvms = 0x8b41d60), line 83 in "callGenerator.cpp"
  [16] Parse::do_call(this = 0x73b7a1dc), line 451 in "doCall.cpp"
  [17] Parse::do_one_bytecode(this = 0x73b7a1dc), line 2286 in "parse2.cpp"
  [18] Parse::do_one_block(this = 0x73b7a1dc), line 1405 in "parse1.cpp"
  [19] Parse::do_all_blocks(this = 0x73b7a1dc), line 680 in "parse1.cpp"
  [20] Parse::Parse(this = 0x73b7a1dc, caller = 0x8b3fde8, parse_method = 0x8c6fd88, expected_uses = 7706.0), line 589 in "parse1.cpp"
  [21] ParseGenerator::generate(this = 0x8be12b0, jvms = 0x8b3fde8), line 83 in "callGenerator.cpp"
  [22] Parse::do_call(this = 0x73b7ac90), line 451 in "doCall.cpp"
  [23] Parse::do_one_bytecode(this = 0x73b7ac90), line 2286 in "parse2.cpp"
  [24] Parse::do_one_block(this = 0x73b7ac90), line 1405 in "parse1.cpp"
  [25] Parse::do_all_blocks(this = 0x73b7ac90), line 680 in "parse1.cpp"
  [26] Parse::Parse(this = 0x73b7ac90, caller = 0x8b3d710, parse_method = 0x8c6f220, expected_uses = -1.0), line 589 in "parse1.cpp"
  [27] ParseGenerator::generate(this = 0x8be1170, jvms = 0x8b3d710), line 83 in "callGenerator.cpp"
  [28] Parse::do_call(this = 0x73b7b744), line 451 in "doCall.cpp"
  [29] Parse::do_one_bytecode(this = 0x73b7b744), line 2286 in "parse2.cpp"
  [30] Parse::do_one_block(this = 0x73b7b744), line 1405 in "parse1.cpp"
  [31] Parse::do_all_blocks(this = 0x73b7b744), line 680 in "parse1.cpp"
  [32] Parse::Parse(this = 0x73b7b744, caller = 0x8b3cda8, parse_method = 0x8baa580, expected_uses = 10547.0), line 589 in "parse1.cpp"
  [33] ParseGenerator::generate(this = 0x8be0b38, jvms = 0x8b3cda8), line 83 in "callGenerator.cpp"
  [34] Parse::do_call(this = 0x73b7c1f8), line 451 in "doCall.cpp"
  [35] Parse::do_one_bytecode(this = 0x73b7c1f8), line 2286 in "parse2.cpp"
  [36] Parse::do_one_block(this = 0x73b7c1f8), line 1405 in "parse1.cpp"
  [37] Parse::do_all_blocks(this = 0x73b7c1f8), line 680 in "parse1.cpp"
  [38] Parse::Parse(this = 0x73b7c1f8, caller = 0x8b3cae0, parse_method = 0x8ba5a48, expected_uses = 5142.0), line 589 in "parse1.cpp"
  [39] ParseGenerator::generate(this = 0x8be0918, jvms = 0x8b3cae0), line 83 in "callGenerator.cpp"
  [40] Parse::do_call(this = 0x73b7ccac), line 451 in "doCall.cpp"
  [41] Parse::do_one_bytecode(this = 0x73b7ccac), line 2286 in "parse2.cpp"
  [42] Parse::do_one_block(this = 0x73b7ccac), line 1405 in "parse1.cpp"
  [43] Parse::do_all_blocks(this = 0x73b7ccac), line 680 in "parse1.cpp"
  [44] Parse::Parse(this = 0x73b7ccac, caller = 0x8786b08, parse_method = 0x8ba4540, expected_uses = 5159.0), line 589 in "parse1.cpp"
  [45] ParseGenerator::generate(this = 0x8be0798, jvms = 0x8786b08), line 83 in "callGenerator.cpp"
  [46] Compile::Compile(this = 0x73b7d474, ci_env = 0x73b7da98, compiler = 0x872fe90, target = 0x8ba4540, osr_bci = -1, subsume_loads = true, do_escape_analysis = true), line 692 in "compile.cpp"
  [47] C2Compiler::compile_method(this = 0x872fe90, env = 0x73b7da98, target = 0x8ba4540, entry_bci = -1), line 130 in "c2compiler.cpp"
  [48] CompileBroker::invoke_compiler_on_method(task = 0x89baf58), line 1792 in "compileBroker.cpp"
  [49] CompileBroker::compiler_thread_loop(), line 1631 in "compileBroker.cpp"
  [50] compiler_thread_entry(thread = 0x8734800, __the_thread__ = 0x8734800), line 3117 in "thread.cpp"
  [51] JavaThread::thread_main_inner(this = 0x8734800), line 1607 in "thread.cpp"
  [52] JavaThread::run(this = 0x8734800), line 1587 in "thread.cpp"
  [53] java_start(thread_addr = 0x8734800), line 1072 in "os_solaris.cpp"
  [54] _thrp_setup(0xfd14e240), at 0xfee53adc 
  [55] _lwp_start(0xfeb25208, 0xfdd34075, 0x0, 0xfeb25208, 0xfeb25208, 0xfdd3e33e), at 0xfee53d80 
(dbx) fr 6
Current function is LibraryCallKit::sharpen_unsafe_type
 2366       if (alias_type->field()->type()->is_klass()) {
(dbx) p this->callee()->print() 
<ciMethod name=getObject holder=sun/misc/Unsafe signature=(Ljava/lang/Object;J)Ljava/lang/Object; loaded=true arg_size=4 flags=public,native ident=821 address=0x87b11a8>this->callee()->print() = (void)
(dbx) p alias_type->field()->print()
<ciField com/oracle/nashorn/scripts/JO$\u00adOSf\u00adOSbench\u00adOSb.OSb offset=52 type=(reference) is_constant=false>alias_type->field()->print() = (void)
(dbx) p alias_type->field()->holder()->print()
<ciInstanceKlass name=com/oracle/nashorn/scripts/JO$\u00adOSf\u00adOSbench\u00adOSb loader=0xce78ce60 loaded=true initialized=true finalized=false subklass=false size=56 flags=public,super super=com/oracle/nashorn/runtime/ScriptObject mirror=PRESENT ident=798 address=0x8c70cc0>alias_type->field()->holder()->print() = (void)

                                     
2012-09-29
(dbx) p this->jvms()->caller()->method()->print()
<ciMethod name=convert holder=java/lang/invoke/LambdaForm$MH signature=(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; loaded=true arg_size=2 flags=DEFAULT_ACCESS,static ident=826 address=0x8cf1fe0>this->jvms()->caller()->method()->print() = (void)
(dbx) p this->jvms()->caller()->method()->print_codes()
0 fast_aload_0
1 checkcast 12 <java/lang/invoke/BoundMethodHandle$Species_L>
  0   bci: 1    ReceiverTypeData    count(0) entries(1)
                                    'java/lang/invoke/BoundMethodHandle$Species_L'(96533 1.00)
4 fast_agetfield 16 <java/lang/invoke/BoundMethodHandle$Species_L.argL0/Ljava/lang/Object;> 
7 astore_2
8 fast_aldc CONSTANT_PLACEHOLDER_0
10 checkcast 20 <java/lang/invoke/MethodHandle>
  24  bci: 10   ReceiverTypeData    count(0) entries(1)
                                    'java/lang/invoke/BoundMethodHandle$Species_LL'(96533 1.00)
13 aload_2
14 invokehandle 24 <java/lang/invoke/MethodHandle.invokeBasic(Ljava/lang/Object;)Ljava/lang/Object;> 
  48  bci: 14   VirtualCallData     count(96533) entries(0)
17 astore_3
18 fast_aldc CONSTANT_PLACEHOLDER_1
20 checkcast 20 <java/lang/invoke/MethodHandle>
  72  bci: 20   ReceiverTypeData    count(0) entries(1)
                                    'java/lang/invoke/DirectMethodHandle$Accessor'(96533 1.00)
23 aload_3
24 fast_aldc CONSTANT_PLACEHOLDER_2
26 checkcast 30 <java/lang/Class>
  96  bci: 26   ReceiverTypeData    count(0) entries(1)
                                    'java/lang/Class'(96533 1.00)
29 swap
30 invokevirtual 33 <java/lang/Class.cast(Ljava/lang/Object;)Ljava/lang/Object;> 
  120 bci: 30   VirtualCallData     count(96533) entries(0)
33 invokehandle 24 <java/lang/invoke/MethodHandle.invokeBasic(Ljava/lang/Object;)Ljava/lang/Object;> 
  144 bci: 33   VirtualCallData     count(96533) entries(0)
36 areturn
this->jvms()->caller()->method()->print_codes() = (void)

(dbx) p this->jvms()->method()->print()                 
<ciMethod name=getObjectField holder=java/lang/invoke/LambdaForm$MH signature=(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; loaded=true arg_size=2 flags=DEFAULT_ACCESS,static ident=851 address=0x8c11410>this->jvms()->method()->print() = (void)
(dbx) p this->jvms()->method()->print_codes()
0 fast_aload_0
1 invokestatic 16 <java/lang/invoke/DirectMethodHandle.fieldOffset(Ljava/lang/Object;)J> 
  0   bci: 1    CounterData         count(18711)
4 lstore_2
5 aload_1
6 invokestatic 20 <java/lang/invoke/DirectMethodHandle.checkBase(Ljava/lang/Object;)Ljava/lang/Object;> 
  8   bci: 6    CounterData         count(18711)
9 astore #4
11 fast_aldc CONSTANT_PLACEHOLDER_0
13 checkcast 24 <sun/misc/Unsafe>
  16  bci: 13   ReceiverTypeData    count(0) entries(1)
                                    'sun/misc/Unsafe'(18711 1.00)
16 aload #4
18 lload_2
19 invokevirtual 28 <sun/misc/Unsafe.getObject(Ljava/lang/Object;J)Ljava/lang/Object;> 
  40  bci: 19   VirtualCallData     count(18711) entries(0)
22 areturn
this->jvms()->method()->print_codes() = (void)

                                     
2012-10-03
The problem is in the intrinsification code for Unsafe.getObject.  Usually field accesses with get/putfield resolve the field when parsing the bytecode.  ciBytecodeStream::get_field calls ciField::will_link which puts class loader constraints for the signature types in place.  In LibraryCallKit::inline_unsafe_access we create a ciField object for the field we are accessing but with the ciField's type left uninitialized.  When calling ciField::type we try to look up the field type lazily which fails because we never resolved the field and put class loader constraints in place.
                                     
2012-10-04
There are two ways to fix it.  The first one is two return java/lang/Object as field type if the computed type is unloaded.  The second fix is to turn on LinkWellKnowClasses by default.  LinkWellKnownClasses only works if the field type is java/lang/Object, for user types we need to other fix.
                                     
2012-10-04
URL:   http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/65d07d9ee446
User:  twisti
Date:  2012-10-09 03:18:38 +0000

                                     
2012-10-09
URL:   http://hg.openjdk.java.net/hsx/hsx25/hotspot/rev/65d07d9ee446
User:  amurillo
Date:  2012-10-12 23:14:51 +0000

                                     
2012-10-12
Setting component and subcomponent; please adjust as appropriate.
                                     
2012-10-17



Hardware and Software, Engineered to Work Together