JDK-6988308 : assert((cnt > 0.0f) && (prob > 0.0f)) failed: Bad frequency assignment in if
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs19
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: x86
  • Submitted: 2010-09-29
  • Updated: 2011-09-22
  • Resolved: 2011-04-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 Other
7Fixed hs21Fixed
Description
The applcation crashes VM.  (-d64 -server -XX:-UseCompressedOops -XX:+UseParallelGC -XX:+AggressiveOpts -XX:CompileThreshold=100 -XX:+UseCodeCacheFlushing)
See comments for details.
; Using jvm: "/export/local/common/jdk/baseline/solaris-amd64/jre/lib/amd64/server/libjvm.so"
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/BUILD_AREA/jdk7/hotspot/src/share/vm/opto/parse2.cpp:826), pid=21949, tid=16
#  assert((cnt> 0.0f) && (prob> 0.0f)) failed: Bad frequency assignment in if
#
# JRE version: 7.0
# Java VM: Java HotSpot(TM) 64-Bit Server VM (19.0-b06-fastdebug mixed mode solaris-amd64 )
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#

---------------  T H R E A D  ---------------

Current thread (0x0000000000ece000):  JavaThread "CompilerThread1" daemon [_thread_in_native, id=16, stack(0xfffffd7df1540000,0xfffffd7df1640000)]

Stack: [0xfffffd7df1540000,0xfffffd7df1640000],  sp=0xfffffd7df163c920,  free space=1010k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x222fe05];;  void VMError::report(outputStream*)+0x6c5
V  [libjvm.so+0x2230eac];;  void VMError::report_and_die()+0x4d8
V  [libjvm.so+0xb8d14b];;  void report_vm_error(const char*,int,const char*,const char*)+0x55f
V  [libjvm.so+0x1cfbe00];;  float Parse::branch_prediction(float&,BoolTest::mask,int)+0xb5c
V  [libjvm.so+0x1cfdece];;  void Parse::do_if(BoolTest::mask,Node*)+0xe6
V  [libjvm.so+0x1d00fb5];;  void Parse::do_one_bytecode()+0x2e1
V  [libjvm.so+0x1cd4fea];;  void Parse::do_one_block()+0x576
V  [libjvm.so+0x1cc7196];;  void Parse::do_all_blocks()+0xede
V  [libjvm.so+0x1cc5ca5];;  Parse::Parse(JVMState*,ciMethod*,float)+0xa2d
V  [libjvm.so+0x78e672];;  JVMState*ParseGenerator::generate(JVMState*)+0x102
V  [libjvm.so+0x9fad7c];;  Compile::Compile(ciEnv*,C2Compiler*,ciMethod*,int,bool,bool)+0xfe0
V  [libjvm.so+0x78d38b];;  void C2Compiler::compile_method(ciEnv*,ciMethod*,int)+0x117
V  [libjvm.so+0xa1d26f];;  void CompileBroker::invoke_compiler_on_method(CompileTask*)+0x1213
V  [libjvm.so+0xa1b202];;  void CompileBroker::compiler_thread_loop()+0xea2
V  [libjvm.so+0x20ede65];;  void JavaThread::thread_main_inner()+0x195
V  [libjvm.so+0x20edab6];;  void JavaThread::run()+0x61e
V  [libjvm.so+0x1c5475e];;  java_start+0x6a6
C  [libc.so.1+0xd6e3b]  _thr_slot_offset+0x31b;;  _thr_setup+0x5b
C  [libc.so.1+0xd7070]  _thr_slot_offset+0x550;;  _lwp_start+0x0

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/3a808be061ff
23-04-2011

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/3a808be061ff
14-04-2011

EVALUATION The problem can occur in Parse::dynamic_branch_prediction(), where cnt can become negative if the block count is larger than max int. This is because the "sum" variable is an int and Block::count() returns uint, which if large enough will make "sum" become negative, causing in turn "cnt" to become negative. I treated this problem by making the "sum" a float. Also, added guards to detect overflows of "taken" and "not_taken", protecting therefore against overflowing an int twice when they are added together. Webrev: http://cr.openjdk.java.net/~iveresov/6988308/webrev.00/
13-04-2011