Running the following program:
-------------------------------
public class InfiniteList {
InfiniteList next;
public static void main(String[] args) throws Exception {
System.out.print("Starting ... ");
InfiniteList p, q;
p = new InfiniteList ();
try {
while (p != null) {
q = new InfiniteList ();
q.next = p;
p = q;
}
throw new Exception ("OutOfMemoryError not thrown as expected.");
} catch (OutOfMemoryError e) {
p = null;
q = null;
System.out.println("success");
}
}
}
-------------------------------
causes a compiler crash in debug mode (in about 1 out of 4 runs).
If the crash does not happens in less than 10 seconds the program will
run to completion, which takes a minute or so.
The crash occurs in the OSR compilation of the while loop:
Node::in(unsigned int 6) line 160 + 47 bytes
Compile::start() line 309 + 10 bytes
Matcher::Matcher(Compile * 0x0e5dfc94, Node_List & {...}, long 0) line 117 + 8 bytes
Compile::Code_Gen(long 0) line 386
Compile::Compile(CompilationScope * 0x00cbfce4, int 19) line 190
MethodCompiler::compile_helper(methodOopDesc * 0x0c5590c8, int 19) line 121
VM_MethodCompiler::doit() line 255 + 19 bytes
VM_Operation::evaluate() line 34
VMThread::evaluate_operation(VM_Operation * 0x00861f78) line 446
VMThread::loop() line 578
VMThread::vm_thread_main(Monitor * 0x007d2538) line 339
<<<thread switch>>>
VMThread::execute(VM_Operation * 0x00861f78) line 654
MethodCompiler::osr_compile(methodHandle {...}, int 19, Thread * 0x007d3278) line 39 + 9 bytes
OnStackReplacement::get_osr_code(methodHandle {...}, int 19, Thread * 0x007d3278) line 151 + 17 bytes
OnStackReplacement::do_replacement(JavaThread * 0x007d3278, methodHandle {...}, int 19, Thread * 0x007d3278) line 98 + 17 bytes
InterpreterRuntime::invocation_counter_overflow(JavaThread * 0x007d3278, long 1, int 5) line 574 + 21 bytes
If the crash occurs the bci is 19, which is the beginning of the while loop:
Starting ... {method}
- klass: {other class}
- method holder: 'InfiniteList'
- access: 1000009 public static
- name: 'main'
- signature: '([Ljava/lang/String;)V'
- max stack: 3
- max locals: 3
- code size: 62
- constants: {constant pool}
- exceptions: [I
- line numbers: [S
- local vars: [S
- exception indices: [S
0 get_static 1024
3 push_object Symbol: 'Starting ... '
5 invoke_virtual 1280 <print> <(Ljava/lang/String;)V>
8 new_object 4
11 dup
12 invoke_special 0 <<init>> <()V>
15 store_local_object #1
16 branch 34
19 new_object 4
22 dup
23 invoke_special 0 <<init>> <()V>
26 store_local_object #2
27 load_local_object #2
28 load_local_object #1
29 put_field 768 <next>
32 load_local_object #2
33 store_local_object #1
34 load_local_object #1
35 branch_if_nonnull 19
38 new_object 6
41 dup
42 push_object Symbol: 'OutOfMemoryError not thrown as expected.'
44 invoke_special 512 <<init>> <(Ljava/lang/String;)V>
47 throw_exception
48 pop
49 push_object NULL
50 store_local_object #1
51 push_object NULL
52 store_local_object #2
53 get_static 1024
56 push_object Symbol: 'success'
58 invoke_virtual 1536 <println> <(Ljava/lang/String;)V>
61 return_void
-------------------------------
public class InfiniteList {
InfiniteList next;
public static void main(String[] args) throws Exception {
System.out.print("Starting ... ");
InfiniteList p, q;
p = new InfiniteList ();
try {
while (p != null) {
q = new InfiniteList ();
q.next = p;
p = q;
}
throw new Exception ("OutOfMemoryError not thrown as expected.");
} catch (OutOfMemoryError e) {
p = null;
q = null;
System.out.println("success");
}
}
}
-------------------------------
causes a compiler crash in debug mode (in about 1 out of 4 runs).
If the crash does not happens in less than 10 seconds the program will
run to completion, which takes a minute or so.
The crash occurs in the OSR compilation of the while loop:
Node::in(unsigned int 6) line 160 + 47 bytes
Compile::start() line 309 + 10 bytes
Matcher::Matcher(Compile * 0x0e5dfc94, Node_List & {...}, long 0) line 117 + 8 bytes
Compile::Code_Gen(long 0) line 386
Compile::Compile(CompilationScope * 0x00cbfce4, int 19) line 190
MethodCompiler::compile_helper(methodOopDesc * 0x0c5590c8, int 19) line 121
VM_MethodCompiler::doit() line 255 + 19 bytes
VM_Operation::evaluate() line 34
VMThread::evaluate_operation(VM_Operation * 0x00861f78) line 446
VMThread::loop() line 578
VMThread::vm_thread_main(Monitor * 0x007d2538) line 339
<<<thread switch>>>
VMThread::execute(VM_Operation * 0x00861f78) line 654
MethodCompiler::osr_compile(methodHandle {...}, int 19, Thread * 0x007d3278) line 39 + 9 bytes
OnStackReplacement::get_osr_code(methodHandle {...}, int 19, Thread * 0x007d3278) line 151 + 17 bytes
OnStackReplacement::do_replacement(JavaThread * 0x007d3278, methodHandle {...}, int 19, Thread * 0x007d3278) line 98 + 17 bytes
InterpreterRuntime::invocation_counter_overflow(JavaThread * 0x007d3278, long 1, int 5) line 574 + 21 bytes
If the crash occurs the bci is 19, which is the beginning of the while loop:
Starting ... {method}
- klass: {other class}
- method holder: 'InfiniteList'
- access: 1000009 public static
- name: 'main'
- signature: '([Ljava/lang/String;)V'
- max stack: 3
- max locals: 3
- code size: 62
- constants: {constant pool}
- exceptions: [I
- line numbers: [S
- local vars: [S
- exception indices: [S
0 get_static 1024
3 push_object Symbol: 'Starting ... '
5 invoke_virtual 1280 <print> <(Ljava/lang/String;)V>
8 new_object 4
11 dup
12 invoke_special 0 <<init>> <()V>
15 store_local_object #1
16 branch 34
19 new_object 4
22 dup
23 invoke_special 0 <<init>> <()V>
26 store_local_object #2
27 load_local_object #2
28 load_local_object #1
29 put_field 768 <next>
32 load_local_object #2
33 store_local_object #1
34 load_local_object #1
35 branch_if_nonnull 19
38 new_object 6
41 dup
42 push_object Symbol: 'OutOfMemoryError not thrown as expected.'
44 invoke_special 512 <<init>> <(Ljava/lang/String;)V>
47 throw_exception
48 pop
49 push_object NULL
50 store_local_object #1
51 push_object NULL
52 store_local_object #2
53 get_static 1024
56 push_object Symbol: 'success'
58 invoke_virtual 1536 <println> <(Ljava/lang/String;)V>
61 return_void
- relates to
-
JDK-4271494 VM crashes with Segmentation violation=20
-
- Resolved
-