-
Bug
-
Resolution: Fixed
-
P2
-
24, 26
-
b10
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8366220 | 25.0.2 | Aleksey Shipilev | P2 | Resolved | Fixed | master |
# Internal Error (/home/shade/trunks/jdk/src/hotspot/share/oops/compressedKlass.inline.hpp:80), pid=3869033, tid=3869052
# assert(is_encodable(addr)) failed: Address 0x000070470c568fa0 is not encodable (Klass range: [0x000000002c001000 - 0x000000006d000000), (1090514944 bytes), klass alignment: 8)
Current CompileTask:
C2:2968 2272 !b 4 org.apache.cassandra.auth.Auth::setupDefaultSuperuser (74 bytes)
Stack: [0x000070473c1f9000,0x000070473c2f9000], sp=0x000070473c2f47c0, free space=1005k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x15e1e1a] CompressedKlassPointers::encode_not_null(Klass*)+0xba (compressedKlass.inline.hpp:80)
V [libjvm.so+0x15ba5f7] MacroAssembler::cmp_narrow_klass(Register, Klass*)+0xb7 (compressedKlass.inline.hpp:73)
V [libjvm.so+0x17ba912] PhaseOutput::scratch_emit_size(Node const*)+0x4a2 (output.cpp:3388)
V [libjvm.so+0x17b2852] PhaseOutput::shorten_branches(unsigned int*)+0x382 (output.cpp:540)
V [libjvm.so+0x17c5458] PhaseOutput::Output()+0xad8 (output.cpp:340)
V [libjvm.so+0xb68c90] Compile::Code_Gen()+0xa20 (compile.cpp:3109)
V [libjvm.so+0xb6df93] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x2023 (compile.cpp:891)
V [libjvm.so+0x99ee90] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x450 (c2compiler.cpp:141)
V [libjvm.so+0xb7d432] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xb22 (compileBroker.cpp:2323)
V [libjvm.so+0xb7e458] CompileBroker::compiler_thread_loop()+0x5a8 (compileBroker.cpp:1967)
V [libjvm.so+0x10d3d4f] JavaThread::thread_main_inner()+0x12f (javaThread.cpp:773)
V [libjvm.so+0x1cdde3a] Thread::call_run()+0xba (thread.cpp:243)
V [libjvm.so+0x17983a8] thread_native_entry(Thread*)+0x128 (os_linux.cpp:868)
C [libc.so.6+0x9caa4]
It is fairly reproducible on one of the internal JARs, and only with specific StressSeed-s. So there must be some high-level optimization in play.
Adding the assert like this:
+TypeNarrowKlass::TypeNarrowKlass(const TypePtr* ptrtype): TypeNarrowPtr(NarrowKlass, ptrtype) {
+ if (ptrtype->ptr() == TypePtr::Constant) {
+ CompressedKlassPointers::check_encodable((void*)ptrtype->get_con());
+ }
+}
Starts to fail here:
Stack: [0x000071208d300000,0x000071208d400000], sp=0x000071208d3fac50, free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x1d0eb32] TypeNarrowKlass::TypeNarrowKlass(TypePtr const*) [clone .part.0]+0xa2 (compressedKlass.inline.hpp:80)
V [libjvm.so+0x1d193ae] TypeNarrowKlass::make(TypePtr const*)+0xae (type.cpp:5322)
V [libjvm.so+0xb594dd] Compile::final_graph_reshaping_main_switch(Node*, Final_Reshape_Counts&, unsigned int, Unique_Node_List&)+0x1e9d (compile.cpp:3589)
V [libjvm.so+0xb59adf] Compile::final_graph_reshaping_impl(Node*, Final_Reshape_Counts&, Unique_Node_List&) [clone .part.0]+0x15f (compile.cpp:3204)
V [libjvm.so+0xb5a47b] Compile::final_graph_reshaping_walk(Node_Stack&, Node*, Final_Reshape_Counts&, Unique_Node_List&)+0x1fb (compile.cpp:3153)
V [libjvm.so+0xb6426d] Compile::final_graph_reshaping()+0x66d (compile.cpp:4019)
V [libjvm.so+0xb6b0d1] Compile::Optimize()+0x1051 (compile.cpp:2568)
V [libjvm.so+0xb6de93] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1f23 (compile.cpp:858)
V [libjvm.so+0x99ee90] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x450 (c2compiler.cpp:141)
V [libjvm.so+0xb7d432] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xb22 (compileBroker.cpp:2323)
V [libjvm.so+0xb7e458] CompileBroker::compiler_thread_loop()+0x5a8 (compileBroker.cpp:1967)
V [libjvm.so+0x10d3d4f] JavaThread::thread_main_inner()+0x12f (javaThread.cpp:773)
V [libjvm.so+0x1cdde3a] Thread::call_run()+0xba (thread.cpp:243)
V [libjvm.so+0x17983a8] thread_native_entry(Thread*)+0x128 (os_linux.cpp:868)
In other words, here:
https://github.com/openjdk/jdk/blob/38f59f84c98dfd974eec0c05541b2138b149def7/src/hotspot/share/opto/compile.cpp#L3588-L3590
} else if (t->isa_klassptr()) {
new_in2 = ConNode::make(t->make_narrowklass());
}
That code seems to assume that if we are holding the klass pointer, it would always be encodeable as narrow klass pointer. But this is not true at least since
This issue looks like a missing case similar to
} else if (t->isa_klassptr()) {
ciKlass* klass = t->is_klassptr()->exact_klass();
assert(!klass->is_abstract() && !klass->is_interface(),
"Hey, is it really fine? abstract: %s; interface: %s",
BOOL_TO_STR(klass->is_abstract()), BOOL_TO_STR(klass->is_interface()));
new_in2 = ConNode::make(t->make_narrowklass());
}
...and see it failing:
# Internal Error (/home/shade/trunks/jdk/src/hotspot/share/opto/compile.cpp:3590), pid=3920890, tid=3920942
# assert(!klass->is_abstract() && !klass->is_interface()) failed: Hey, is it really fine? abstract: true; interface: false
- backported by
-
JDK-8366220 C2: Final graph reshaping generates unencodeable klass constants
-
- Resolved
-
- caused by
-
JDK-8338526 Don't store abstract and interface Klasses in class metaspace
-
- Resolved
-
- relates to
-
JDK-8343218 Add option to disable allocating interface and abstract classes in non-class metaspace
-
- Resolved
-
-
JDK-8343206 Final graph reshaping should not compress abstract or interface class pointers
-
- Resolved
-
-
JDK-8365823 Revert storing abstract and interface Klasses to non-class metaspace
-
- Open
-
-
JDK-8360557 CTW: Inline cold methods to reach more code
-
- Open
-
- links to
-
Commit(master) openjdk/jdk25u/7fe11cf1
-
Commit(master) openjdk/jdk/e304d379
-
Review(master) openjdk/jdk25u/128
-
Review(master) openjdk/jdk/26559