JDK-7032306 : Fastdebug build failure on Solaris with SS11 compilers
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: hs21
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris
  • CPU: generic
  • Submitted: 2011-03-29
  • Updated: 2011-04-24
  • Resolved: 2011-04-24
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
Related Reports
Relates :  
Description
Compiling /tmp/jprt/P1/B/011046.coleenp/source/src/share/vm/oops/instanceRefKlass.cpp
rm -f instanceRefKlass.o
CC -DSOLARIS -DSPARC_WORKS -DSPARC -DASSERT -DFASTDEBUG
  -DCHECK_UNHANDLED_OOPS
  -I/tmp/jprt/P1/B/011046.coleenp/source/src/share/vm/prims
  -I/tmp/jprt/P1/B/011046.coleenp/source/src/closed/share/vm
  -I/tmp/jprt/P1/B/011046.coleenp/source/src/share/vm
  -I/tmp/jprt/P1/B/011046.coleenp/source/src/cpu/sparc/vm
  -I/tmp/jprt/P1/B/011046.coleenp/source/src/os_cpu/solaris_sparc/vm
  -I/tmp/jprt/P1/B/011046.coleenp/source/src/os/solaris/vm
  -I/tmp/jprt/P1/B/011046.coleenp/source/src/closed/os/posix/vm
  -I/tmp/jprt/P1/B/011046.coleenp/source/src/os/posix/vm -I../generated

-DHOTSPOT_RELEASE_VERSION="\"21.0-b05-internal-201103270110.coleenp.rt_test\""
  -DHOTSPOT_BUILD_TARGET="\"fastdebug\"" -DHOTSPOT_BUILD_USER="\"jprtadm\""
  -DHOTSPOT_LIB_ARCH=\"sparc\" -DJRE_RELEASE_VERSION="\"1.7.0\""
  -DHOTSPOT_VM_DISTRO="\"Java HotSpot(TM)\"" -DTARGET_OS_FAMILY_solaris
  -DTARGET_ARCH_sparc -DTARGET_ARCH_MODEL_sparc
  -DTARGET_OS_ARCH_solaris_sparc -DTARGET_OS_ARCH_MODEL_solaris_sparc
  -DTARGET_COMPILER_sparcWorks -DCOMPILER2 -DCOMPILER1 -DSOLARIS_7_OR_LATER
  -DDONT_USE_PRECOMPILED_HEADER -xmemalign=4s -xarch=v8plus

/tmp/jprt/P1/B/011046.coleenp/source/src/os_cpu/solaris_sparc/vm/solaris_sparc.il
  -template=no%extdef -features=no%split_init -D_Crun_inline_placement
  -library=%none   -mt  -xO4  -g0  -features=no%except
  -I/opt/SUNWdtrd/include -DDTRACE_ENABLED -c  -o instanceRefKlass.o

/tmp/jprt/P1/B/011046.coleenp/source/src/share/vm/oops/instanceRefKlass.cpp
"/tmp/jprt/P1/B/011046.coleenp/source/src/share/vm/oops/instanceKlass.cpp",
  line 2340: Error: Overloading ambiguity between "klassOop::operator
  klassOopDesc*() const" and "oop::operator void*() const".
1 Error(s) detected. 


Failure occurs at code added as part of:

7017732: move static fields into Class to prepare for perm gen removal

http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/c7f3d0b4570f

Failing code:

2340  if (real_klass && real_klass->klass_part()->oop_is_instance()) {

Likely cause:

real_klass needs to be a pointer-type in the "if" expression. In non-debug it is. In debug it's not and so we need to apply a conversion operator. The compiler is complaining that there are two possible conversion operators that apply.

Suggested fix:

Both cast operators are functionally equivalent so forcing resolution to either should be fine. It should be easier to force (void*) as it doesn't depend on whether it is a fastdebug build or not. So suggested trying:

  if ( ((void*)real_klass) && ... )

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/2cd0180da6e1
30-03-2011

SUGGESTED FIX --- old/src/share/vm/oops/instanceKlass.cpp Tue Mar 29 17:23:37 2011 +++ new/src/share/vm/oops/instanceKlass.cpp Tue Mar 29 17:23:36 2011 @@ -2337,7 +2337,7 @@ st->print_cr(BULLET"fake entry for oop_size: %d", java_lang_Class::oop_size(obj)); st->print_cr(BULLET"fake entry for static_oop_field_count: %d", java_lang_Class::static_oop_field_count(obj)); klassOop real_klass = java_lang_Class::as_klassOop(obj); - if (real_klass && real_klass->klass_part()->oop_is_instance()) { + if (real_klass != NULL && real_klass->klass_part()->oop_is_instance()) { instanceKlass::cast(real_klass)->do_local_static_fields(&print_field); } } else if (as_klassOop() == SystemDictionary::MethodType_klass()) {
30-03-2011

EVALUATION CHECK_UNHANDLED_OOPS make some expressions ambiguous with older compilers. The fix is to make the test against NULL explicit. Tested by building fastdebug with SS11 compilers.
30-03-2011

PUBLIC COMMENTS It's unclear why SS11 (and SS12) sees an ambiguity here and the later SS12u1 does not.
29-03-2011