United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7170053 crash in C2 when using -XX:+CountCompiledCalls
JDK-7170053 : crash in C2 when using -XX:+CountCompiledCalls

Details
Type:
Bug
Submit Date:
2012-05-18
Status:
Resolved
Updated Date:
2013-04-30
Project Name:
JDK
Resolved Date:
2012-05-26
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs23
Fixed Versions:
hs24 (b12)

Related Reports
Backport:
Backport:
Backport:

Sub Tasks

Description
http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2012-May/007689.html

Krystal Mok wrote:

Hi all,

Could I get some reviews for this patch, please?
https://gist.github.com/2710000#file_count_compiled_calls.patch

Description:

C2 may crash when compiling methods with -XX:+CountCompiledCalls turned on.
The cause is in Parse::count_compiled_calls(), where it made a TypeInstPtr
from a ciMethod:

const TypeInstPtr* addr_type = TypeInstPtr::make(method());

Since the klass of a ciMethod is a ciMethodKlass, which isn't a
ciInstanceKlass, an assertion is hit later in
Compile::flatten_alias_type(), where it's expecting a TypeInstPtr to have a
ciInstanceKlass:

ciInstanceKlass *k = to->klass()->as_instance_klass();

An example of the crash is available here: https://gist.github.com/2710000
In the example, I started a Groovy shell with -XX:+CountCompiledCalls set,
and it crashed quickly when compiling java.lang.String.charAt().

The fix is to use TypeOopPtr::make_from_constant(method()) instead
of TypeInstPtr::make(method()).
I did check the hg history, and looks like it's been like this since
duke at 0.Wonder if there's any history behind this.

Note that this fix may have to be changed again when methodOopDesc's are
moved out of PermGen.

Regards,
Kris

                                    

Comments
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/cdd249497b34
                                     
2012-05-18
EVALUATION

http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/cdd249497b34
                                     
2012-06-29



Hardware and Software, Engineered to Work Together