Thu, 26 Sep 2013 10:25:02 -0400
7195622: CheckUnhandledOops has limited usefulness now
Summary: Enable CHECK_UNHANDLED_OOPS in fastdebug builds across all supported platforms.
Reviewed-by: coleenp, hseigel, dholmes, stefank, twisti, ihse, rdurbin
Contributed-by: lois.foltan@oracle.com
1.1 --- a/make/bsd/makefiles/fastdebug.make Wed Sep 25 17:47:51 2013 +0200 1.2 +++ b/make/bsd/makefiles/fastdebug.make Thu Sep 26 10:25:02 2013 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 # 1.5 -# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 +# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 # 1.9 # This code is free software; you can redistribute it and/or modify it 1.10 @@ -59,5 +59,5 @@ 1.11 MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug 1.12 1.13 VERSION = fastdebug 1.14 -SYSDEFS += -DASSERT 1.15 +SYSDEFS += -DASSERT -DCHECK_UNHANDLED_OOPS 1.16 PICFLAGS = DEFAULT
2.1 --- a/make/linux/makefiles/fastdebug.make Wed Sep 25 17:47:51 2013 +0200 2.2 +++ b/make/linux/makefiles/fastdebug.make Thu Sep 26 10:25:02 2013 -0400 2.3 @@ -59,5 +59,5 @@ 2.4 MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug 2.5 2.6 VERSION = optimized 2.7 -SYSDEFS += -DASSERT 2.8 +SYSDEFS += -DASSERT -DCHECK_UNHANDLED_OOPS 2.9 PICFLAGS = DEFAULT
3.1 --- a/make/windows/makefiles/fastdebug.make Wed Sep 25 17:47:51 2013 +0200 3.2 +++ b/make/windows/makefiles/fastdebug.make Thu Sep 26 10:25:02 2013 -0400 3.3 @@ -1,5 +1,5 @@ 3.4 # 3.5 -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 3.6 +# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 3.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 # 3.9 # This code is free software; you can redistribute it and/or modify it 3.10 @@ -38,7 +38,7 @@ 3.11 !include ../local.make 3.12 !include compile.make 3.13 3.14 -CXX_FLAGS=$(CXX_FLAGS) $(FASTDEBUG_OPT_OPTION) 3.15 +CXX_FLAGS=$(CXX_FLAGS) $(FASTDEBUG_OPT_OPTION) /D "CHECK_UNHANDLED_OOPS" 3.16 3.17 !include $(WorkSpace)/make/windows/makefiles/vm.make 3.18 !include local.make
4.1 --- a/src/cpu/sparc/vm/frame_sparc.cpp Wed Sep 25 17:47:51 2013 +0200 4.2 +++ b/src/cpu/sparc/vm/frame_sparc.cpp Thu Sep 26 10:25:02 2013 -0400 4.3 @@ -764,7 +764,7 @@ 4.4 #ifdef CC_INTERP 4.5 *oop_result = istate->_oop_temp; 4.6 #else 4.7 - oop obj = (oop) at(interpreter_frame_oop_temp_offset); 4.8 + oop obj = cast_to_oop(at(interpreter_frame_oop_temp_offset)); 4.9 assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check"); 4.10 *oop_result = obj; 4.11 #endif // CC_INTERP 4.12 @@ -788,7 +788,7 @@ 4.13 switch(type) { 4.14 case T_OBJECT: 4.15 case T_ARRAY: { 4.16 - oop obj = (oop)*tos_addr; 4.17 + oop obj = cast_to_oop(*tos_addr); 4.18 assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check"); 4.19 *oop_result = obj; 4.20 break;
5.1 --- a/src/cpu/sparc/vm/nativeInst_sparc.cpp Wed Sep 25 17:47:51 2013 +0200 5.2 +++ b/src/cpu/sparc/vm/nativeInst_sparc.cpp Thu Sep 26 10:25:02 2013 -0400 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -358,7 +358,7 @@ 5.11 oop_Relocation *r = iter.oop_reloc(); 5.12 if (oop_addr == NULL) { 5.13 oop_addr = r->oop_addr(); 5.14 - *oop_addr = (oop)x; 5.15 + *oop_addr = cast_to_oop(x); 5.16 } else { 5.17 assert(oop_addr == r->oop_addr(), "must be only one set-oop here"); 5.18 } 5.19 @@ -478,7 +478,7 @@ 5.20 oop_Relocation *r = iter.oop_reloc(); 5.21 if (oop_addr == NULL) { 5.22 oop_addr = r->oop_addr(); 5.23 - *oop_addr = (oop)x; 5.24 + *oop_addr = cast_to_oop(x); 5.25 } else { 5.26 assert(oop_addr == r->oop_addr(), "must be only one set-oop here"); 5.27 }
6.1 --- a/src/cpu/x86/vm/frame_x86.cpp Wed Sep 25 17:47:51 2013 +0200 6.2 +++ b/src/cpu/x86/vm/frame_x86.cpp Thu Sep 26 10:25:02 2013 -0400 6.3 @@ -639,7 +639,7 @@ 6.4 #ifdef CC_INTERP 6.5 obj = istate->_oop_temp; 6.6 #else 6.7 - obj = (oop) at(interpreter_frame_oop_temp_offset); 6.8 + obj = cast_to_oop(at(interpreter_frame_oop_temp_offset)); 6.9 #endif // CC_INTERP 6.10 } else { 6.11 oop* obj_p = (oop*)tos_addr;
7.1 --- a/src/cpu/x86/vm/methodHandles_x86.cpp Wed Sep 25 17:47:51 2013 +0200 7.2 +++ b/src/cpu/x86/vm/methodHandles_x86.cpp Thu Sep 26 10:25:02 2013 -0400 7.3 @@ -1,5 +1,5 @@ 7.4 /* 7.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 7.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 7.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.8 * 7.9 * This code is free software; you can redistribute it and/or modify it 7.10 @@ -475,7 +475,7 @@ 7.11 const char* mh_reg_name = has_mh ? "rcx_mh" : "rcx"; 7.12 tty->print_cr("MH %s %s="PTR_FORMAT" sp="PTR_FORMAT, 7.13 adaptername, mh_reg_name, 7.14 - mh, entry_sp); 7.15 + (void *)mh, entry_sp); 7.16 7.17 if (Verbose) { 7.18 tty->print_cr("Registers:");
8.1 --- a/src/cpu/x86/vm/x86_32.ad Wed Sep 25 17:47:51 2013 +0200 8.2 +++ b/src/cpu/x86/vm/x86_32.ad Thu Sep 26 10:25:02 2013 -0400 8.3 @@ -351,7 +351,7 @@ 8.4 int format) { 8.5 #ifdef ASSERT 8.6 if (rspec.reloc()->type() == relocInfo::oop_type && d32 != 0 && d32 != (int)Universe::non_oop_word()) { 8.7 - assert(oop(d32)->is_oop() && (ScavengeRootsInCode || !oop(d32)->is_scavengable()), "cannot embed scavengable oops in code"); 8.8 + assert(cast_to_oop(d32)->is_oop() && (ScavengeRootsInCode || !cast_to_oop(d32)->is_scavengable()), "cannot embed scavengable oops in code"); 8.9 } 8.10 #endif 8.11 cbuf.relocate(cbuf.insts_mark(), rspec, format);
9.1 --- a/src/cpu/x86/vm/x86_64.ad Wed Sep 25 17:47:51 2013 +0200 9.2 +++ b/src/cpu/x86/vm/x86_64.ad Thu Sep 26 10:25:02 2013 -0400 9.3 @@ -529,7 +529,7 @@ 9.4 if (rspec.reloc()->type() == relocInfo::oop_type && 9.5 d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) { 9.6 assert(Universe::heap()->is_in_reserved((address)(intptr_t)d32), "should be real oop"); 9.7 - assert(oop((intptr_t)d32)->is_oop() && (ScavengeRootsInCode || !oop((intptr_t)d32)->is_scavengable()), "cannot embed scavengable oops in code"); 9.8 + assert(cast_to_oop((intptr_t)d32)->is_oop() && (ScavengeRootsInCode || !cast_to_oop((intptr_t)d32)->is_scavengable()), "cannot embed scavengable oops in code"); 9.9 } 9.10 #endif 9.11 cbuf.relocate(cbuf.insts_mark(), rspec, format); 9.12 @@ -556,7 +556,7 @@ 9.13 if (rspec.reloc()->type() == relocInfo::oop_type && 9.14 d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) { 9.15 assert(Universe::heap()->is_in_reserved((address)d64), "should be real oop"); 9.16 - assert(oop(d64)->is_oop() && (ScavengeRootsInCode || !oop(d64)->is_scavengable()), 9.17 + assert(cast_to_oop(d64)->is_oop() && (ScavengeRootsInCode || !cast_to_oop(d64)->is_scavengable()), 9.18 "cannot embed scavengable oops in code"); 9.19 } 9.20 #endif
10.1 --- a/src/share/vm/c1/c1_Runtime1.cpp Wed Sep 25 17:47:51 2013 +0200 10.2 +++ b/src/share/vm/c1/c1_Runtime1.cpp Thu Sep 26 10:25:02 2013 -0400 10.3 @@ -1019,7 +1019,7 @@ 10.4 n_copy->set_data((intx) (load_klass())); 10.5 } else { 10.6 assert(mirror() != NULL, "klass not set"); 10.7 - n_copy->set_data((intx) (mirror())); 10.8 + n_copy->set_data(cast_from_oop<intx>(mirror())); 10.9 } 10.10 10.11 if (TracePatching) { 10.12 @@ -1031,7 +1031,7 @@ 10.13 assert(n_copy->data() == 0 || 10.14 n_copy->data() == (intptr_t)Universe::non_oop_word(), 10.15 "illegal init value"); 10.16 - n_copy->set_data((intx) (appendix())); 10.17 + n_copy->set_data(cast_from_oop<intx>(appendix())); 10.18 10.19 if (TracePatching) { 10.20 Disassembler::decode(copy_buff, copy_buff + *byte_count, tty);
11.1 --- a/src/share/vm/classfile/classLoaderData.cpp Wed Sep 25 17:47:51 2013 +0200 11.2 +++ b/src/share/vm/classfile/classLoaderData.cpp Thu Sep 26 10:25:02 2013 -0400 11.3 @@ -261,7 +261,7 @@ 11.4 k, 11.5 k->external_name(), 11.6 k->class_loader_data(), 11.7 - k->class_loader(), 11.8 + (void *)k->class_loader(), 11.9 loader_name()); 11.10 } 11.11 } 11.12 @@ -297,7 +297,7 @@ 11.13 if (TraceClassLoaderData) { 11.14 ResourceMark rm; 11.15 tty->print("[ClassLoaderData: unload loader data "PTR_FORMAT, this); 11.16 - tty->print(" for instance "PTR_FORMAT" of %s", class_loader(), 11.17 + tty->print(" for instance "PTR_FORMAT" of %s", (void *)class_loader(), 11.18 loader_name()); 11.19 if (is_anonymous()) { 11.20 tty->print(" for anonymous class "PTR_FORMAT " ", _klasses); 11.21 @@ -458,7 +458,7 @@ 11.22 void ClassLoaderData::dump(outputStream * const out) { 11.23 ResourceMark rm; 11.24 out->print("ClassLoaderData CLD: "PTR_FORMAT", loader: "PTR_FORMAT", loader_klass: "PTR_FORMAT" %s {", 11.25 - this, class_loader(), 11.26 + this, (void *)class_loader(), 11.27 class_loader() != NULL ? class_loader()->klass() : NULL, loader_name()); 11.28 if (claimed()) out->print(" claimed "); 11.29 if (is_unloading()) out->print(" unloading "); 11.30 @@ -553,7 +553,7 @@ 11.31 ResourceMark rm; 11.32 tty->print("[ClassLoaderData: "); 11.33 tty->print("create class loader data "PTR_FORMAT, cld); 11.34 - tty->print(" for instance "PTR_FORMAT" of %s", cld->class_loader(), 11.35 + tty->print(" for instance "PTR_FORMAT" of %s", (void *)cld->class_loader(), 11.36 cld->loader_name()); 11.37 tty->print_cr("]"); 11.38 }
12.1 --- a/src/share/vm/classfile/dictionary.hpp Wed Sep 25 17:47:51 2013 +0200 12.2 +++ b/src/share/vm/classfile/dictionary.hpp Thu Sep 26 10:25:02 2013 -0400 12.3 @@ -1,5 +1,5 @@ 12.4 /* 12.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 12.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 12.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.8 * 12.9 * This code is free software; you can redistribute it and/or modify it 12.10 @@ -264,7 +264,7 @@ 12.11 } 12.12 if (method_type() != NULL) { 12.13 if (printed) st->print(" and "); 12.14 - st->print(INTPTR_FORMAT, method_type()); 12.15 + st->print(INTPTR_FORMAT, (void *)method_type()); 12.16 printed = true; 12.17 } 12.18 st->print_cr(printed ? "" : "(empty)");
13.1 --- a/src/share/vm/classfile/symbolTable.cpp Wed Sep 25 17:47:51 2013 +0200 13.2 +++ b/src/share/vm/classfile/symbolTable.cpp Thu Sep 26 10:25:02 2013 -0400 13.3 @@ -840,7 +840,7 @@ 13.4 if (str1 == str2) { 13.5 tty->print_cr("ERROR: identical oop values (0x" PTR_FORMAT ") " 13.6 "in entry @ bucket[%d][%d] and entry @ bucket[%d][%d]", 13.7 - str1, bkt1, e_cnt1, bkt2, e_cnt2); 13.8 + (void *)str1, bkt1, e_cnt1, bkt2, e_cnt2); 13.9 return _verify_fail_continue; 13.10 } 13.11
14.1 --- a/src/share/vm/code/nmethod.cpp Wed Sep 25 17:47:51 2013 +0200 14.2 +++ b/src/share/vm/code/nmethod.cpp Thu Sep 26 10:25:02 2013 -0400 14.3 @@ -1965,7 +1965,7 @@ 14.4 if (!_detected_scavenge_root) _print_nm->print_on(tty, "new scavenge root"); 14.5 tty->print_cr(""PTR_FORMAT"[offset=%d] detected scavengable oop "PTR_FORMAT" (found at "PTR_FORMAT")", 14.6 _print_nm, (int)((intptr_t)p - (intptr_t)_print_nm), 14.7 - (intptr_t)(*p), (intptr_t)p); 14.8 + (void *)(*p), (intptr_t)p); 14.9 (*p)->print(); 14.10 } 14.11 #endif //PRODUCT 14.12 @@ -2345,7 +2345,7 @@ 14.13 _ok = false; 14.14 } 14.15 tty->print_cr("*** non-oop "PTR_FORMAT" found at "PTR_FORMAT" (offset %d)", 14.16 - (intptr_t)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm)); 14.17 + (void *)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm)); 14.18 } 14.19 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); } 14.20 }; 14.21 @@ -2466,7 +2466,7 @@ 14.22 _ok = false; 14.23 } 14.24 tty->print_cr("*** scavengable oop "PTR_FORMAT" found at "PTR_FORMAT" (offset %d)", 14.25 - (intptr_t)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm)); 14.26 + (void *)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm)); 14.27 (*p)->print(); 14.28 } 14.29 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
15.1 --- a/src/share/vm/compiler/oopMap.cpp Wed Sep 25 17:47:51 2013 +0200 15.2 +++ b/src/share/vm/compiler/oopMap.cpp Thu Sep 26 10:25:02 2013 -0400 15.3 @@ -1,5 +1,5 @@ 15.4 /* 15.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 15.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 15.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.8 * 15.9 * This code is free software; you can redistribute it and/or modify it 15.10 @@ -628,7 +628,7 @@ 15.11 15.12 15.13 // Returns value of location as an int 15.14 -intptr_t value_of_loc(oop *pointer) { return (intptr_t)(*pointer); } 15.15 +intptr_t value_of_loc(oop *pointer) { return cast_from_oop<intptr_t>((*pointer)); } 15.16 15.17 15.18 void DerivedPointerTable::add(oop *derived_loc, oop *base_loc) {
16.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Wed Sep 25 17:47:51 2013 +0200 16.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Thu Sep 26 10:25:02 2013 -0400 16.3 @@ -9065,7 +9065,7 @@ 16.4 return !stack->isEmpty(); 16.5 } 16.6 16.7 -#define BUSY (oop(0x1aff1aff)) 16.8 +#define BUSY (cast_to_oop<intptr_t>(0x1aff1aff)) 16.9 // (MT-safe) Get a prefix of at most "num" from the list. 16.10 // The overflow list is chained through the mark word of 16.11 // each object in the list. We fetch the entire list, 16.12 @@ -9098,7 +9098,7 @@ 16.13 return false; 16.14 } 16.15 // Grab the entire list; we'll put back a suffix 16.16 - oop prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list); 16.17 + oop prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list)); 16.18 Thread* tid = Thread::current(); 16.19 // Before "no_of_gc_threads" was introduced CMSOverflowSpinCount was 16.20 // set to ParallelGCThreads. 16.21 @@ -9113,7 +9113,7 @@ 16.22 return false; 16.23 } else if (_overflow_list != BUSY) { 16.24 // Try and grab the prefix 16.25 - prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list); 16.26 + prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list)); 16.27 } 16.28 } 16.29 // If the list was found to be empty, or we spun long
17.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp Wed Sep 25 17:47:51 2013 +0200 17.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp Thu Sep 26 10:25:02 2013 -0400 17.3 @@ -2694,7 +2694,7 @@ 17.4 17.5 if (print_it) { 17.6 _out->print_cr(" "PTR_FORMAT"%s", 17.7 - o, (over_tams) ? " >" : (marked) ? " M" : ""); 17.8 + (void *)o, (over_tams) ? " >" : (marked) ? " M" : ""); 17.9 PrintReachableOopClosure oopCl(_out, _vo, _all); 17.10 o->oop_iterate_no_header(&oopCl); 17.11 }
18.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Sep 25 17:47:51 2013 +0200 18.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Sep 26 10:25:02 2013 -0400 18.3 @@ -4615,7 +4615,7 @@ 18.4 assert(!has_partial_array_mask(ref), err_msg("ref=" PTR_FORMAT, ref)); 18.5 oop p = oopDesc::load_decode_heap_oop(ref); 18.6 assert(_g1h->is_in_g1_reserved(p), 18.7 - err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, intptr_t(p))); 18.8 + err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, (void *)p)); 18.9 return true; 18.10 } 18.11 18.12 @@ -4625,11 +4625,11 @@ 18.13 // Must be in the collection set--it's already been copied. 18.14 oop p = clear_partial_array_mask(ref); 18.15 assert(_g1h->obj_in_cs(p), 18.16 - err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, intptr_t(p))); 18.17 + err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, (void *)p)); 18.18 } else { 18.19 oop p = oopDesc::load_decode_heap_oop(ref); 18.20 assert(_g1h->is_in_g1_reserved(p), 18.21 - err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, intptr_t(p))); 18.22 + err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, (void *)p)); 18.23 } 18.24 return true; 18.25 }
19.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Wed Sep 25 17:47:51 2013 +0200 19.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Thu Sep 26 10:25:02 2013 -0400 19.3 @@ -703,7 +703,7 @@ 19.4 if (_g1_committed.contains((HeapWord*) obj)) { 19.5 // no need to subtract the bottom of the heap from obj, 19.6 // _in_cset_fast_test is biased 19.7 - uintx index = (uintx) obj >> HeapRegion::LogOfHRGrainBytes; 19.8 + uintx index = cast_from_oop<uintx>(obj) >> HeapRegion::LogOfHRGrainBytes; 19.9 bool ret = _in_cset_fast_test[index]; 19.10 // let's make sure the result is consistent with what the slower 19.11 // test returns
20.1 --- a/src/share/vm/gc_implementation/g1/g1OopClosures.hpp Wed Sep 25 17:47:51 2013 +0200 20.2 +++ b/src/share/vm/gc_implementation/g1/g1OopClosures.hpp Thu Sep 26 10:25:02 2013 -0400 20.3 @@ -1,5 +1,5 @@ 20.4 /* 20.5 - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 20.6 + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 20.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.8 * 20.9 * This code is free software; you can redistribute it and/or modify it 20.10 @@ -91,12 +91,12 @@ 20.11 } 20.12 20.13 template <class T> inline T* set_partial_array_mask(T obj) { 20.14 - assert(((uintptr_t)obj & G1_PARTIAL_ARRAY_MASK) == 0, "Information loss!"); 20.15 - return (T*) ((uintptr_t)obj | G1_PARTIAL_ARRAY_MASK); 20.16 + assert(((uintptr_t)(void *)obj & G1_PARTIAL_ARRAY_MASK) == 0, "Information loss!"); 20.17 + return (T*) ((uintptr_t)(void *)obj | G1_PARTIAL_ARRAY_MASK); 20.18 } 20.19 20.20 template <class T> inline oop clear_partial_array_mask(T* ref) { 20.21 - return oop((intptr_t)ref & ~G1_PARTIAL_ARRAY_MASK); 20.22 + return cast_to_oop((intptr_t)ref & ~G1_PARTIAL_ARRAY_MASK); 20.23 } 20.24 20.25 class G1ParScanPartialArrayClosure : public G1ParClosureSuper {
21.1 --- a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Wed Sep 25 17:47:51 2013 +0200 21.2 +++ b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Thu Sep 26 10:25:02 2013 -0400 21.3 @@ -1,5 +1,5 @@ 21.4 /* 21.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. 21.6 + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 21.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.8 * 21.9 * This code is free software; you can redistribute it and/or modify it 21.10 @@ -95,7 +95,7 @@ 21.11 G1SATBCardTableLoggingModRefBS::write_ref_field_static(void* field, 21.12 oop new_val) { 21.13 uintptr_t field_uint = (uintptr_t)field; 21.14 - uintptr_t new_val_uint = (uintptr_t)new_val; 21.15 + uintptr_t new_val_uint = cast_from_oop<uintptr_t>(new_val); 21.16 uintptr_t comb = field_uint ^ new_val_uint; 21.17 comb = comb >> HeapRegion::LogOfHRGrainBytes; 21.18 if (comb == 0) return;
22.1 --- a/src/share/vm/gc_implementation/g1/heapRegion.cpp Wed Sep 25 17:47:51 2013 +0200 22.2 +++ b/src/share/vm/gc_implementation/g1/heapRegion.cpp Thu Sep 26 10:25:02 2013 -0400 22.3 @@ -637,7 +637,7 @@ 22.4 gclog_or_tty->print_cr("Object "PTR_FORMAT" in region " 22.5 "["PTR_FORMAT", "PTR_FORMAT") is above " 22.6 "top "PTR_FORMAT, 22.7 - obj, _hr->bottom(), _hr->end(), _hr->top()); 22.8 + (void *)obj, _hr->bottom(), _hr->end(), _hr->top()); 22.9 _failures = true; 22.10 return; 22.11 } 22.12 @@ -951,12 +951,12 @@ 22.13 Klass* klass = obj->klass(); 22.14 if (!klass->is_metaspace_object()) { 22.15 gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " 22.16 - "not metadata", klass, obj); 22.17 + "not metadata", klass, (void *)obj); 22.18 *failures = true; 22.19 return; 22.20 } else if (!klass->is_klass()) { 22.21 gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " 22.22 - "not a klass", klass, obj); 22.23 + "not a klass", klass, (void *)obj); 22.24 *failures = true; 22.25 return; 22.26 } else { 22.27 @@ -971,7 +971,7 @@ 22.28 } 22.29 } 22.30 } else { 22.31 - gclog_or_tty->print_cr(PTR_FORMAT" no an oop", obj); 22.32 + gclog_or_tty->print_cr(PTR_FORMAT" no an oop", (void *)obj); 22.33 *failures = true; 22.34 return; 22.35 }
23.1 --- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Wed Sep 25 17:47:51 2013 +0200 23.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Thu Sep 26 10:25:02 2013 -0400 23.3 @@ -91,8 +91,8 @@ 23.4 gclog_or_tty->print_cr(" PRT::Add_reference_work(" PTR_FORMAT "->" PTR_FORMAT").", 23.5 from, 23.6 UseCompressedOops 23.7 - ? oopDesc::load_decode_heap_oop((narrowOop*)from) 23.8 - : oopDesc::load_decode_heap_oop((oop*)from)); 23.9 + ? (void *)oopDesc::load_decode_heap_oop((narrowOop*)from) 23.10 + : (void *)oopDesc::load_decode_heap_oop((oop*)from)); 23.11 } 23.12 23.13 HeapRegion* loc_hr = hr(); 23.14 @@ -403,8 +403,8 @@ 23.15 gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").", 23.16 from, 23.17 UseCompressedOops 23.18 - ? oopDesc::load_decode_heap_oop((narrowOop*)from) 23.19 - : oopDesc::load_decode_heap_oop((oop*)from)); 23.20 + ? (void *)oopDesc::load_decode_heap_oop((narrowOop*)from) 23.21 + : (void *)oopDesc::load_decode_heap_oop((oop*)from)); 23.22 } 23.23 23.24 int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift);
24.1 --- a/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp Wed Sep 25 17:47:51 2013 +0200 24.2 +++ b/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp Thu Sep 26 10:25:02 2013 -0400 24.3 @@ -1103,7 +1103,7 @@ 24.4 } 24.5 } 24.6 24.7 -static const oop ClaimedForwardPtr = oop(0x4); 24.8 +static const oop ClaimedForwardPtr = cast_to_oop<intptr_t>(0x4); 24.9 24.10 // Because of concurrency, there are times where an object for which 24.11 // "is_forwarded()" is true contains an "interim" forwarding pointer 24.12 @@ -1226,7 +1226,7 @@ 24.13 if (TraceScavenge) { 24.14 gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", 24.15 is_in_reserved(new_obj) ? "copying" : "tenuring", 24.16 - new_obj->klass()->internal_name(), old, new_obj, new_obj->size()); 24.17 + new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size()); 24.18 } 24.19 #endif 24.20 24.21 @@ -1347,7 +1347,7 @@ 24.22 if (TraceScavenge) { 24.23 gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", 24.24 is_in_reserved(new_obj) ? "copying" : "tenuring", 24.25 - new_obj->klass()->internal_name(), old, new_obj, new_obj->size()); 24.26 + new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size()); 24.27 } 24.28 #endif 24.29 24.30 @@ -1436,7 +1436,7 @@ 24.31 // (although some performance comparisons would be useful since 24.32 // single global lists have their own performance disadvantages 24.33 // as we were made painfully aware not long ago, see 6786503). 24.34 -#define BUSY (oop(0x1aff1aff)) 24.35 +#define BUSY (cast_to_oop<intptr_t>(0x1aff1aff)) 24.36 void ParNewGeneration::push_on_overflow_list(oop from_space_obj, ParScanThreadState* par_scan_state) { 24.37 assert(is_in_reserved(from_space_obj), "Should be from this generation"); 24.38 if (ParGCUseLocalOverflow) { 24.39 @@ -1512,7 +1512,7 @@ 24.40 if (_overflow_list == NULL) return false; 24.41 24.42 // Otherwise, there was something there; try claiming the list. 24.43 - oop prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list); 24.44 + oop prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list)); 24.45 // Trim off a prefix of at most objsFromOverflow items 24.46 Thread* tid = Thread::current(); 24.47 size_t spin_count = (size_t)ParallelGCThreads; 24.48 @@ -1526,7 +1526,7 @@ 24.49 return false; 24.50 } else if (_overflow_list != BUSY) { 24.51 // try and grab the prefix 24.52 - prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list); 24.53 + prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list)); 24.54 } 24.55 } 24.56 if (prefix == NULL || prefix == BUSY) {
25.1 --- a/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp Wed Sep 25 17:47:51 2013 +0200 25.2 +++ b/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp Thu Sep 26 10:25:02 2013 -0400 25.3 @@ -1,5 +1,5 @@ 25.4 /* 25.5 - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 25.6 + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. 25.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.8 * 25.9 * This code is free software; you can redistribute it and/or modify it 25.10 @@ -84,7 +84,7 @@ 25.11 Space* sp = gch->space_containing(p); 25.12 oop obj = oop(sp->block_start(p)); 25.13 assert((HeapWord*)obj < (HeapWord*)p, "Error"); 25.14 - tty->print_cr("Object: " PTR_FORMAT, obj); 25.15 + tty->print_cr("Object: " PTR_FORMAT, (void *)obj); 25.16 tty->print_cr("-------"); 25.17 obj->print(); 25.18 tty->print_cr("-----"); 25.19 @@ -110,7 +110,7 @@ 25.20 if (TraceScavenge) { 25.21 gclog_or_tty->print_cr("{%s %s ( " PTR_FORMAT " ) " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", 25.22 "forwarded ", 25.23 - new_obj->klass()->internal_name(), p, obj, new_obj, new_obj->size()); 25.24 + new_obj->klass()->internal_name(), p, (void *)obj, (void *)new_obj, new_obj->size()); 25.25 } 25.26 #endif 25.27
26.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp Wed Sep 25 17:47:51 2013 +0200 26.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp Thu Sep 26 10:25:02 2013 -0400 26.3 @@ -333,7 +333,7 @@ 26.4 gclog_or_tty->print_cr("{%s %s 0x%x (%d)}", 26.5 "promotion-failure", 26.6 obj->klass()->internal_name(), 26.7 - obj, obj->size()); 26.8 + (void *)obj, obj->size()); 26.9 26.10 } 26.11 #endif
27.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp Wed Sep 25 17:47:51 2013 +0200 27.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp Thu Sep 26 10:25:02 2013 -0400 27.3 @@ -126,7 +126,7 @@ 27.4 27.5 oop* mask_chunked_array_oop(oop obj) { 27.6 assert(!is_oop_masked((oop*) obj), "invariant"); 27.7 - oop* ret = (oop*) ((uintptr_t)obj | PS_CHUNKED_ARRAY_OOP_MASK); 27.8 + oop* ret = (oop*) (cast_from_oop<uintptr_t>(obj) | PS_CHUNKED_ARRAY_OOP_MASK); 27.9 assert(is_oop_masked(ret), "invariant"); 27.10 return ret; 27.11 }
28.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp Wed Sep 25 17:47:51 2013 +0200 28.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp Thu Sep 26 10:25:02 2013 -0400 28.3 @@ -225,7 +225,7 @@ 28.4 if (TraceScavenge) { 28.5 gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", 28.6 PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring", 28.7 - new_obj->klass()->internal_name(), o, new_obj, new_obj->size()); 28.8 + new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size()); 28.9 } 28.10 #endif 28.11
29.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp Wed Sep 25 17:47:51 2013 +0200 29.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp Thu Sep 26 10:25:02 2013 -0400 29.3 @@ -1,5 +1,5 @@ 29.4 /* 29.5 - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 29.6 + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. 29.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 29.8 * 29.9 * This code is free software; you can redistribute it and/or modify it 29.10 @@ -81,7 +81,7 @@ 29.11 if (TraceScavenge && o->is_forwarded()) { 29.12 gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", 29.13 "forwarding", 29.14 - new_obj->klass()->internal_name(), o, new_obj, new_obj->size()); 29.15 + new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size()); 29.16 } 29.17 #endif 29.18
30.1 --- a/src/share/vm/interpreter/bytecodeTracer.cpp Wed Sep 25 17:47:51 2013 +0200 30.2 +++ b/src/share/vm/interpreter/bytecodeTracer.cpp Thu Sep 26 10:25:02 2013 -0400 30.3 @@ -215,7 +215,7 @@ 30.4 st->print_cr(" %s", buf); 30.5 } 30.6 } else { 30.7 - st->print_cr(" " PTR_FORMAT, (intptr_t) value); 30.8 + st->print_cr(" " PTR_FORMAT, (void *)value); 30.9 } 30.10 } 30.11
31.1 --- a/src/share/vm/interpreter/linkResolver.cpp Wed Sep 25 17:47:51 2013 +0200 31.2 +++ b/src/share/vm/interpreter/linkResolver.cpp Thu Sep 26 10:25:02 2013 -0400 31.3 @@ -1384,7 +1384,7 @@ 31.4 THREAD); 31.5 if (HAS_PENDING_EXCEPTION) { 31.6 if (TraceMethodHandles) { 31.7 - tty->print_cr("invokedynamic throws BSME for "INTPTR_FORMAT, PENDING_EXCEPTION); 31.8 + tty->print_cr("invokedynamic throws BSME for "INTPTR_FORMAT, (void *)PENDING_EXCEPTION); 31.9 PENDING_EXCEPTION->print(); 31.10 } 31.11 if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) {
32.1 --- a/src/share/vm/memory/heapInspection.hpp Wed Sep 25 17:47:51 2013 +0200 32.2 +++ b/src/share/vm/memory/heapInspection.hpp Thu Sep 26 10:25:02 2013 -0400 32.3 @@ -150,11 +150,11 @@ 32.4 HEAP_INSPECTION_COLUMNS_DO(DECLARE_KLASS_SIZE_STATS_FIELD) 32.5 32.6 static int count(oop x) { 32.7 - return (HeapWordSize * ((x) ? (x)->size() : 0)); 32.8 + return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0)); 32.9 } 32.10 32.11 static int count_array(objArrayOop x) { 32.12 - return (HeapWordSize * ((x) ? (x)->size() : 0)); 32.13 + return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0)); 32.14 } 32.15 32.16 template <class T> static int count(T* x) {
33.1 --- a/src/share/vm/memory/referenceProcessor.cpp Wed Sep 25 17:47:51 2013 +0200 33.2 +++ b/src/share/vm/memory/referenceProcessor.cpp Thu Sep 26 10:25:02 2013 -0400 33.3 @@ -367,7 +367,7 @@ 33.4 next_d = java_lang_ref_Reference::discovered(obj); 33.5 if (TraceReferenceGC && PrintGCDetails) { 33.6 gclog_or_tty->print_cr(" obj " INTPTR_FORMAT "/next_d " INTPTR_FORMAT, 33.7 - obj, next_d); 33.8 + (void *)obj, (void *)next_d); 33.9 } 33.10 assert(java_lang_ref_Reference::next(obj) == NULL, 33.11 "Reference not active; should not be discovered"); 33.12 @@ -392,7 +392,7 @@ 33.13 next_d = java_lang_ref_Reference::discovered(obj); 33.14 if (TraceReferenceGC && PrintGCDetails) { 33.15 gclog_or_tty->print_cr(" obj " INTPTR_FORMAT "/next_d " INTPTR_FORMAT, 33.16 - obj, next_d); 33.17 + (void *)obj, (void *)next_d); 33.18 } 33.19 assert(java_lang_ref_Reference::next(obj) == NULL, 33.20 "The reference should not be enqueued"); 33.21 @@ -562,7 +562,7 @@ 33.22 !policy->should_clear_reference(iter.obj(), _soft_ref_timestamp_clock)) { 33.23 if (TraceReferenceGC) { 33.24 gclog_or_tty->print_cr("Dropping reference (" INTPTR_FORMAT ": %s" ") by policy", 33.25 - iter.obj(), iter.obj()->klass()->internal_name()); 33.26 + (void *)iter.obj(), iter.obj()->klass()->internal_name()); 33.27 } 33.28 // Remove Reference object from list 33.29 iter.remove(); 33.30 @@ -601,7 +601,7 @@ 33.31 if (iter.is_referent_alive()) { 33.32 if (TraceReferenceGC) { 33.33 gclog_or_tty->print_cr("Dropping strongly reachable reference (" INTPTR_FORMAT ": %s)", 33.34 - iter.obj(), iter.obj()->klass()->internal_name()); 33.35 + (void *)iter.obj(), iter.obj()->klass()->internal_name()); 33.36 } 33.37 // The referent is reachable after all. 33.38 // Remove Reference object from list. 33.39 @@ -687,7 +687,7 @@ 33.40 if (TraceReferenceGC) { 33.41 gclog_or_tty->print_cr("Adding %sreference (" INTPTR_FORMAT ": %s) as pending", 33.42 clear_referent ? "cleared " : "", 33.43 - iter.obj(), iter.obj()->klass()->internal_name()); 33.44 + (void *)iter.obj(), iter.obj()->klass()->internal_name()); 33.45 } 33.46 assert(iter.obj()->is_oop(UseConcMarkSweepGC), "Adding a bad reference"); 33.47 iter.next(); 33.48 @@ -1003,7 +1003,7 @@ 33.49 gclog_or_tty->print_cr("clean_up_discovered_list: Dropping Reference: " 33.50 INTPTR_FORMAT " with next field: " INTPTR_FORMAT 33.51 " and referent: " INTPTR_FORMAT, 33.52 - iter.obj(), next, iter.referent()); 33.53 + (void *)iter.obj(), (void *)next, (void *)iter.referent()); 33.54 } 33.55 ) 33.56 // Remove Reference object from list 33.57 @@ -1103,14 +1103,14 @@ 33.58 33.59 if (TraceReferenceGC) { 33.60 gclog_or_tty->print_cr("Discovered reference (mt) (" INTPTR_FORMAT ": %s)", 33.61 - obj, obj->klass()->internal_name()); 33.62 + (void *)obj, obj->klass()->internal_name()); 33.63 } 33.64 } else { 33.65 // If retest was non NULL, another thread beat us to it: 33.66 // The reference has already been discovered... 33.67 if (TraceReferenceGC) { 33.68 gclog_or_tty->print_cr("Already discovered reference (" INTPTR_FORMAT ": %s)", 33.69 - obj, obj->klass()->internal_name()); 33.70 + (void *)obj, obj->klass()->internal_name()); 33.71 } 33.72 } 33.73 } 33.74 @@ -1125,7 +1125,7 @@ 33.75 assert(da ? referent->is_oop() : referent->is_oop_or_null(), 33.76 err_msg("Bad referent " INTPTR_FORMAT " found in Reference " 33.77 INTPTR_FORMAT " during %satomic discovery ", 33.78 - (intptr_t)referent, (intptr_t)obj, da ? "" : "non-")); 33.79 + (void *)referent, (void *)obj, da ? "" : "non-")); 33.80 } 33.81 #endif 33.82 33.83 @@ -1205,7 +1205,7 @@ 33.84 // The reference has already been discovered... 33.85 if (TraceReferenceGC) { 33.86 gclog_or_tty->print_cr("Already discovered reference (" INTPTR_FORMAT ": %s)", 33.87 - obj, obj->klass()->internal_name()); 33.88 + (void *)obj, obj->klass()->internal_name()); 33.89 } 33.90 if (RefDiscoveryPolicy == ReferentBasedDiscovery) { 33.91 // assumes that an object is not processed twice; 33.92 @@ -1273,7 +1273,7 @@ 33.93 33.94 if (TraceReferenceGC) { 33.95 gclog_or_tty->print_cr("Discovered reference (" INTPTR_FORMAT ": %s)", 33.96 - obj, obj->klass()->internal_name()); 33.97 + (void *)obj, obj->klass()->internal_name()); 33.98 } 33.99 } 33.100 assert(obj->is_oop(), "Discovered a bad reference"); 33.101 @@ -1372,7 +1372,7 @@ 33.102 // active; we need to trace and mark its cohort. 33.103 if (TraceReferenceGC) { 33.104 gclog_or_tty->print_cr("Precleaning Reference (" INTPTR_FORMAT ": %s)", 33.105 - iter.obj(), iter.obj()->klass()->internal_name()); 33.106 + (void *)iter.obj(), iter.obj()->klass()->internal_name()); 33.107 } 33.108 // Remove Reference object from list 33.109 iter.remove();
34.1 --- a/src/share/vm/oops/constantPool.cpp Wed Sep 25 17:47:51 2013 +0200 34.2 +++ b/src/share/vm/oops/constantPool.cpp Thu Sep 26 10:25:02 2013 -0400 34.3 @@ -1918,7 +1918,7 @@ 34.4 st->print_cr(" - holder: " INTPTR_FORMAT, pool_holder()); 34.5 } 34.6 st->print_cr(" - cache: " INTPTR_FORMAT, cache()); 34.7 - st->print_cr(" - resolved_references: " INTPTR_FORMAT, resolved_references()); 34.8 + st->print_cr(" - resolved_references: " INTPTR_FORMAT, (void *)resolved_references()); 34.9 st->print_cr(" - reference_map: " INTPTR_FORMAT, reference_map()); 34.10 34.11 for (int index = 1; index < length(); index++) { // Index 0 is unused
35.1 --- a/src/share/vm/oops/cpCache.cpp Wed Sep 25 17:47:51 2013 +0200 35.2 +++ b/src/share/vm/oops/cpCache.cpp Thu Sep 26 10:25:02 2013 -0400 35.3 @@ -306,8 +306,8 @@ 35.4 if (TraceInvokeDynamic) { 35.5 tty->print_cr("set_method_handle bc=%d appendix="PTR_FORMAT"%s method_type="PTR_FORMAT"%s method="PTR_FORMAT" ", 35.6 invoke_code, 35.7 - (intptr_t)appendix(), (has_appendix ? "" : " (unused)"), 35.8 - (intptr_t)method_type(), (has_method_type ? "" : " (unused)"), 35.9 + (void *)appendix(), (has_appendix ? "" : " (unused)"), 35.10 + (void *)method_type(), (has_method_type ? "" : " (unused)"), 35.11 (intptr_t)adapter()); 35.12 adapter->print(); 35.13 if (has_appendix) appendix()->print();
36.1 --- a/src/share/vm/oops/instanceKlass.cpp Wed Sep 25 17:47:51 2013 +0200 36.2 +++ b/src/share/vm/oops/instanceKlass.cpp Thu Sep 26 10:25:02 2013 -0400 36.3 @@ -106,7 +106,7 @@ 36.4 len = name->utf8_length(); \ 36.5 } \ 36.6 HS_DTRACE_PROBE4(hotspot, class__initialization__##type, \ 36.7 - data, len, (clss)->class_loader(), thread_type); \ 36.8 + data, len, SOLARIS_ONLY((void *))(clss)->class_loader(), thread_type); \ 36.9 } 36.10 36.11 #define DTRACE_CLASSINIT_PROBE_WAIT(type, clss, thread_type, wait) \ 36.12 @@ -119,7 +119,7 @@ 36.13 len = name->utf8_length(); \ 36.14 } \ 36.15 HS_DTRACE_PROBE5(hotspot, class__initialization__##type, \ 36.16 - data, len, (clss)->class_loader(), thread_type, wait); \ 36.17 + data, len, SOLARIS_ONLY((void *))(clss)->class_loader(), thread_type, wait); \ 36.18 } 36.19 #else /* USDT2 */ 36.20 36.21 @@ -2303,7 +2303,7 @@ 36.22 } 36.23 36.24 address InstanceKlass::static_field_addr(int offset) { 36.25 - return (address)(offset + InstanceMirrorKlass::offset_of_static_fields() + (intptr_t)java_mirror()); 36.26 + return (address)(offset + InstanceMirrorKlass::offset_of_static_fields() + cast_from_oop<intptr_t>(java_mirror())); 36.27 } 36.28 36.29
37.1 --- a/src/share/vm/oops/instanceMirrorKlass.hpp Wed Sep 25 17:47:51 2013 +0200 37.2 +++ b/src/share/vm/oops/instanceMirrorKlass.hpp Thu Sep 26 10:25:02 2013 -0400 37.3 @@ -1,5 +1,5 @@ 37.4 /* 37.5 - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 37.6 + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 37.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 37.8 * 37.9 * This code is free software; you can redistribute it and/or modify it 37.10 @@ -66,7 +66,7 @@ 37.11 // Static field offset is an offset into the Heap, should be converted by 37.12 // based on UseCompressedOop for traversal 37.13 static HeapWord* start_of_static_fields(oop obj) { 37.14 - return (HeapWord*)((intptr_t)obj + offset_of_static_fields()); 37.15 + return (HeapWord*)(cast_from_oop<intptr_t>(obj) + offset_of_static_fields()); 37.16 } 37.17 37.18 static void init_offset_of_static_fields() {
38.1 --- a/src/share/vm/oops/instanceRefKlass.cpp Wed Sep 25 17:47:51 2013 +0200 38.2 +++ b/src/share/vm/oops/instanceRefKlass.cpp Thu Sep 26 10:25:02 2013 -0400 38.3 @@ -1,5 +1,5 @@ 38.4 /* 38.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 38.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 38.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 38.8 * 38.9 * This code is free software; you can redistribute it and/or modify it 38.10 @@ -51,7 +51,7 @@ 38.11 T heap_oop = oopDesc::load_heap_oop(referent_addr); 38.12 debug_only( 38.13 if(TraceReferenceGC && PrintGCDetails) { 38.14 - gclog_or_tty->print_cr("InstanceRefKlass::oop_follow_contents " INTPTR_FORMAT, obj); 38.15 + gclog_or_tty->print_cr("InstanceRefKlass::oop_follow_contents " INTPTR_FORMAT, (void *)obj); 38.16 } 38.17 ) 38.18 if (!oopDesc::is_null(heap_oop)) { 38.19 @@ -62,7 +62,7 @@ 38.20 ref->InstanceKlass::oop_follow_contents(obj); 38.21 debug_only( 38.22 if(TraceReferenceGC && PrintGCDetails) { 38.23 - gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, obj); 38.24 + gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, (void *)obj); 38.25 } 38.26 ) 38.27 return; 38.28 @@ -70,7 +70,7 @@ 38.29 // treat referent as normal oop 38.30 debug_only( 38.31 if(TraceReferenceGC && PrintGCDetails) { 38.32 - gclog_or_tty->print_cr(" Non NULL normal " INTPTR_FORMAT, obj); 38.33 + gclog_or_tty->print_cr(" Non NULL normal " INTPTR_FORMAT, (void *)obj); 38.34 } 38.35 ) 38.36 MarkSweep::mark_and_push(referent_addr); 38.37 @@ -130,7 +130,7 @@ 38.38 T heap_oop = oopDesc::load_heap_oop(referent_addr); 38.39 debug_only( 38.40 if(TraceReferenceGC && PrintGCDetails) { 38.41 - gclog_or_tty->print_cr("InstanceRefKlass::oop_follow_contents " INTPTR_FORMAT, obj); 38.42 + gclog_or_tty->print_cr("InstanceRefKlass::oop_follow_contents " INTPTR_FORMAT, (void *)obj); 38.43 } 38.44 ) 38.45 if (!oopDesc::is_null(heap_oop)) { 38.46 @@ -142,7 +142,7 @@ 38.47 ref->InstanceKlass::oop_follow_contents(cm, obj); 38.48 debug_only( 38.49 if(TraceReferenceGC && PrintGCDetails) { 38.50 - gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, obj); 38.51 + gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, (void *)obj); 38.52 } 38.53 ) 38.54 return; 38.55 @@ -150,7 +150,7 @@ 38.56 // treat referent as normal oop 38.57 debug_only( 38.58 if(TraceReferenceGC && PrintGCDetails) { 38.59 - gclog_or_tty->print_cr(" Non NULL normal " INTPTR_FORMAT, obj); 38.60 + gclog_or_tty->print_cr(" Non NULL normal " INTPTR_FORMAT, (void *)obj); 38.61 } 38.62 ) 38.63 PSParallelCompact::mark_and_push(cm, referent_addr);
39.1 --- a/src/share/vm/oops/methodData.hpp Wed Sep 25 17:47:51 2013 +0200 39.2 +++ b/src/share/vm/oops/methodData.hpp Thu Sep 26 10:25:02 2013 -0400 39.3 @@ -333,10 +333,10 @@ 39.4 return (int)data()->cell_at(index); 39.5 } 39.6 void set_oop_at(int index, oop value) { 39.7 - set_intptr_at(index, (intptr_t) value); 39.8 + set_intptr_at(index, cast_from_oop<intptr_t>(value)); 39.9 } 39.10 oop oop_at(int index) { 39.11 - return (oop)intptr_at(index); 39.12 + return cast_to_oop(intptr_at(index)); 39.13 } 39.14 39.15 void set_flag_at(int flag_number) {
40.1 --- a/src/share/vm/oops/oop.inline.hpp Wed Sep 25 17:47:51 2013 +0200 40.2 +++ b/src/share/vm/oops/oop.inline.hpp Thu Sep 26 10:25:02 2013 -0400 40.3 @@ -183,7 +183,7 @@ 40.4 // in inner GC loops so these are separated. 40.5 40.6 inline bool check_obj_alignment(oop obj) { 40.7 - return (intptr_t)obj % MinObjAlignmentInBytes == 0; 40.8 + return cast_from_oop<intptr_t>(obj) % MinObjAlignmentInBytes == 0; 40.9 } 40.10 40.11 inline narrowOop oopDesc::encode_heap_oop_not_null(oop v) {
41.1 --- a/src/share/vm/oops/oopsHierarchy.hpp Wed Sep 25 17:47:51 2013 +0200 41.2 +++ b/src/share/vm/oops/oopsHierarchy.hpp Thu Sep 26 10:25:02 2013 -0400 41.3 @@ -55,11 +55,16 @@ 41.4 // to and from the underlying oopDesc pointer type. 41.5 // 41.6 // Because oop and its subclasses <type>Oop are class types, arbitrary 41.7 -// conversions are not accepted by the compiler, and you may get a message 41.8 -// about overloading ambiguity (between long and int is common when converting 41.9 -// from a constant in 64 bit mode), or unable to convert from type to 'oop'. 41.10 -// Applying a cast to one of these conversion operators first will get to the 41.11 -// underlying oopDesc* type if appropriate. 41.12 +// conversions are not accepted by the compiler. Applying a cast to 41.13 +// an oop will cause the best matched conversion operator to be 41.14 +// invoked returning the underlying oopDesc* type if appropriate. 41.15 +// No copy constructors, explicit user conversions or operators of 41.16 +// numerical type should be defined within the oop class. Most C++ 41.17 +// compilers will issue a compile time error concerning the overloading 41.18 +// ambiguity between operators of numerical and pointer types. If 41.19 +// a conversion to or from an oop to a numerical type is needed, 41.20 +// use the inline template methods, cast_*_oop, defined below. 41.21 +// 41.22 // Converting NULL to oop to Handle implicit is no longer accepted by the 41.23 // compiler because there are too many steps in the conversion. Use Handle() 41.24 // instead, which generates less code anyway. 41.25 @@ -83,12 +88,9 @@ 41.26 void raw_set_obj(const void* p) { _o = (oopDesc*)p; } 41.27 41.28 oop() { set_obj(NULL); } 41.29 + oop(const oop& o) { set_obj(o.obj()); } 41.30 oop(const volatile oop& o) { set_obj(o.obj()); } 41.31 oop(const void* p) { set_obj(p); } 41.32 - oop(intptr_t i) { set_obj((void *)i); } 41.33 -#ifdef _LP64 41.34 - oop(int i) { set_obj((void *)i); } 41.35 -#endif 41.36 ~oop() { 41.37 if (CheckUnhandledOops) unregister_oop(); 41.38 } 41.39 @@ -101,8 +103,6 @@ 41.40 bool operator==(void *p) const { return obj() == p; } 41.41 bool operator!=(const volatile oop o) const { return obj() != o.obj(); } 41.42 bool operator!=(void *p) const { return obj() != p; } 41.43 - bool operator==(intptr_t p) const { return obj() == (oopDesc*)p; } 41.44 - bool operator!=(intptr_t p) const { return obj() != (oopDesc*)p; } 41.45 41.46 bool operator<(oop o) const { return obj() < o.obj(); } 41.47 bool operator>(oop o) const { return obj() > o.obj(); } 41.48 @@ -110,8 +110,18 @@ 41.49 bool operator>=(oop o) const { return obj() >= o.obj(); } 41.50 bool operator!() const { return !obj(); } 41.51 41.52 - // Cast 41.53 + // Assignment 41.54 + oop& operator=(const oop& o) { _o = o.obj(); return *this; } 41.55 +#ifndef SOLARIS 41.56 + volatile oop& operator=(const oop& o) volatile { _o = o.obj(); return *this; } 41.57 +#endif 41.58 + volatile oop& operator=(const volatile oop& o) volatile { _o = o.obj(); return *this; } 41.59 + 41.60 + // Explict user conversions 41.61 operator void* () const { return (void *)obj(); } 41.62 +#ifndef SOLARIS 41.63 + operator void* () const volatile { return (void *)obj(); } 41.64 +#endif 41.65 operator HeapWord* () const { return (HeapWord*)obj(); } 41.66 operator oopDesc* () const { return obj(); } 41.67 operator intptr_t* () const { return (intptr_t*)obj(); } 41.68 @@ -119,7 +129,6 @@ 41.69 operator markOop () const { return markOop(obj()); } 41.70 41.71 operator address () const { return (address)obj(); } 41.72 - operator intptr_t () const volatile { return (intptr_t)obj(); } 41.73 41.74 // from javaCalls.cpp 41.75 operator jobject () const { return (jobject)obj(); } 41.76 @@ -141,12 +150,26 @@ 41.77 class type##Oop : public oop { \ 41.78 public: \ 41.79 type##Oop() : oop() {} \ 41.80 + type##Oop(const oop& o) : oop(o) {} \ 41.81 type##Oop(const volatile oop& o) : oop(o) {} \ 41.82 type##Oop(const void* p) : oop(p) {} \ 41.83 operator type##OopDesc* () const { return (type##OopDesc*)obj(); } \ 41.84 type##OopDesc* operator->() const { \ 41.85 return (type##OopDesc*)obj(); \ 41.86 } \ 41.87 + type##Oop& operator=(const type##Oop& o) { \ 41.88 + oop::operator=(o); \ 41.89 + return *this; \ 41.90 + } \ 41.91 + NOT_SOLARIS( \ 41.92 + volatile type##Oop& operator=(const type##Oop& o) volatile { \ 41.93 + (void)const_cast<oop&>(oop::operator=(o)); \ 41.94 + return *this; \ 41.95 + }) \ 41.96 + volatile type##Oop& operator=(const volatile type##Oop& o) volatile {\ 41.97 + (void)const_cast<oop&>(oop::operator=(o)); \ 41.98 + return *this; \ 41.99 + } \ 41.100 }; 41.101 41.102 DEF_OOP(instance); 41.103 @@ -156,6 +179,16 @@ 41.104 41.105 #endif // CHECK_UNHANDLED_OOPS 41.106 41.107 +// For CHECK_UNHANDLED_OOPS, it is ambiguous C++ behavior to have the oop 41.108 +// structure contain explicit user defined conversions of both numerical 41.109 +// and pointer type. Define inline methods to provide the numerical conversions. 41.110 +template <class T> inline oop cast_to_oop(T value) { 41.111 + return (oop)(CHECK_UNHANDLED_OOPS_ONLY((void *))(value)); 41.112 +} 41.113 +template <class T> inline T cast_from_oop(oop o) { 41.114 + return (T)(CHECK_UNHANDLED_OOPS_ONLY((void*))o); 41.115 +} 41.116 + 41.117 // The metadata hierarchy is separate from the oop hierarchy 41.118 41.119 // class MetaspaceObj
42.1 --- a/src/share/vm/opto/machnode.cpp Wed Sep 25 17:47:51 2013 +0200 42.2 +++ b/src/share/vm/opto/machnode.cpp Thu Sep 26 10:25:02 2013 -0400 42.3 @@ -1,5 +1,5 @@ 42.4 /* 42.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 42.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 42.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 42.8 * 42.9 * This code is free software; you can redistribute it and/or modify it 42.10 @@ -341,7 +341,7 @@ 42.11 return TypePtr::BOTTOM; 42.12 } 42.13 // %%% make offset be intptr_t 42.14 - assert(!Universe::heap()->is_in_reserved((oop)offset), "must be a raw ptr"); 42.15 + assert(!Universe::heap()->is_in_reserved(cast_to_oop(offset)), "must be a raw ptr"); 42.16 return TypeRawPtr::BOTTOM; 42.17 } 42.18
43.1 --- a/src/share/vm/prims/jvmtiTagMap.cpp Wed Sep 25 17:47:51 2013 +0200 43.2 +++ b/src/share/vm/prims/jvmtiTagMap.cpp Thu Sep 26 10:25:02 2013 -0400 43.3 @@ -165,7 +165,7 @@ 43.4 static unsigned int hash(oop key, int size) { 43.5 // shift right to get better distribution (as these bits will be zero 43.6 // with aligned addresses) 43.7 - unsigned int addr = (unsigned int)((intptr_t)key); 43.8 + unsigned int addr = (unsigned int)(cast_from_oop<intptr_t>(key)); 43.9 #ifdef _LP64 43.10 return (addr >> 3) % size; 43.11 #else
44.1 --- a/src/share/vm/prims/unsafe.cpp Wed Sep 25 17:47:51 2013 +0200 44.2 +++ b/src/share/vm/prims/unsafe.cpp Thu Sep 26 10:25:02 2013 -0400 44.3 @@ -292,9 +292,9 @@ 44.4 volatile oop v; 44.5 if (UseCompressedOops) { 44.6 volatile narrowOop n = *(volatile narrowOop*) addr; 44.7 - v = oopDesc::decode_heap_oop(n); 44.8 + (void)const_cast<oop&>(v = oopDesc::decode_heap_oop(n)); 44.9 } else { 44.10 - v = *(volatile oop*) addr; 44.11 + (void)const_cast<oop&>(v = *(volatile oop*) addr); 44.12 } 44.13 OrderAccess::acquire(); 44.14 return JNIHandles::make_local(env, v); 44.15 @@ -1222,9 +1222,9 @@ 44.16 #endif /* USDT2 */ 44.17 if (event.should_commit()) { 44.18 oop obj = thread->current_park_blocker(); 44.19 - event.set_klass(obj ? obj->klass() : NULL); 44.20 + event.set_klass((obj != NULL) ? obj->klass() : NULL); 44.21 event.set_timeout(time); 44.22 - event.set_address(obj ? (TYPE_ADDRESS) (uintptr_t) obj : 0); 44.23 + event.set_address((obj != NULL) ? (TYPE_ADDRESS) cast_from_oop<uintptr_t>(obj) : 0); 44.24 event.commit(); 44.25 } 44.26 UNSAFE_END
45.1 --- a/src/share/vm/runtime/biasedLocking.cpp Wed Sep 25 17:47:51 2013 +0200 45.2 +++ b/src/share/vm/runtime/biasedLocking.cpp Thu Sep 26 10:25:02 2013 -0400 45.3 @@ -1,5 +1,5 @@ 45.4 /* 45.5 - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 45.6 + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 45.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 45.8 * 45.9 * This code is free software; you can redistribute it and/or modify it 45.10 @@ -161,7 +161,7 @@ 45.11 if (TraceBiasedLocking && (Verbose || !is_bulk)) { 45.12 ResourceMark rm; 45.13 tty->print_cr("Revoking bias of object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s , prototype header " INTPTR_FORMAT " , allow rebias %d , requesting thread " INTPTR_FORMAT, 45.14 - (intptr_t) obj, (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread); 45.15 + (void *)obj, (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread); 45.16 } 45.17 45.18 JavaThread* biased_thread = mark->biased_locker(); 45.19 @@ -214,8 +214,8 @@ 45.20 if (mon_info->owner() == obj) { 45.21 if (TraceBiasedLocking && Verbose) { 45.22 tty->print_cr(" mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")", 45.23 - (intptr_t) mon_info->owner(), 45.24 - (intptr_t) obj); 45.25 + (void *) mon_info->owner(), 45.26 + (void *) obj); 45.27 } 45.28 // Assume recursive case and fix up highest lock later 45.29 markOop mark = markOopDesc::encode((BasicLock*) NULL); 45.30 @@ -224,8 +224,8 @@ 45.31 } else { 45.32 if (TraceBiasedLocking && Verbose) { 45.33 tty->print_cr(" mon_info->owner (" PTR_FORMAT ") != obj (" PTR_FORMAT ")", 45.34 - (intptr_t) mon_info->owner(), 45.35 - (intptr_t) obj); 45.36 + (void *) mon_info->owner(), 45.37 + (void *) obj); 45.38 } 45.39 } 45.40 } 45.41 @@ -326,7 +326,7 @@ 45.42 tty->print_cr("* Beginning bulk revocation (kind == %s) because of object " 45.43 INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s", 45.44 (bulk_rebias ? "rebias" : "revoke"), 45.45 - (intptr_t) o, (intptr_t) o->mark(), o->klass()->external_name()); 45.46 + (void *) o, (intptr_t) o->mark(), o->klass()->external_name()); 45.47 } 45.48 45.49 jlong cur_time = os::javaTimeMillis();
46.1 --- a/src/share/vm/runtime/deoptimization.cpp Wed Sep 25 17:47:51 2013 +0200 46.2 +++ b/src/share/vm/runtime/deoptimization.cpp Thu Sep 26 10:25:02 2013 -0400 46.3 @@ -1,5 +1,5 @@ 46.4 /* 46.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 46.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 46.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 46.8 * 46.9 * This code is free software; you can redistribute it and/or modify it 46.10 @@ -234,7 +234,7 @@ 46.11 assert(Universe::heap()->is_in_or_null(result), "must be heap pointer"); 46.12 if (TraceDeoptimization) { 46.13 ttyLocker ttyl; 46.14 - tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, result, thread); 46.15 + tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, (void *)result, thread); 46.16 } 46.17 } 46.18 bool reallocated = false; 46.19 @@ -278,7 +278,7 @@ 46.20 first = false; 46.21 tty->print_cr("RELOCK OBJECTS in thread " INTPTR_FORMAT, thread); 46.22 } 46.23 - tty->print_cr(" object <" INTPTR_FORMAT "> locked", mi->owner()); 46.24 + tty->print_cr(" object <" INTPTR_FORMAT "> locked", (void *)mi->owner()); 46.25 } 46.26 } 46.27 } 46.28 @@ -977,7 +977,7 @@ 46.29 KlassHandle k(java_lang_Class::as_Klass(sv->klass()->as_ConstantOopReadValue()->value()())); 46.30 Handle obj = sv->value(); 46.31 46.32 - tty->print(" object <" INTPTR_FORMAT "> of type ", sv->value()()); 46.33 + tty->print(" object <" INTPTR_FORMAT "> of type ", (void *)sv->value()()); 46.34 k->print_value(); 46.35 tty->print(" allocated (%d bytes)", obj->size() * HeapWordSize); 46.36 tty->cr();
47.1 --- a/src/share/vm/runtime/frame.cpp Wed Sep 25 17:47:51 2013 +0200 47.2 +++ b/src/share/vm/runtime/frame.cpp Thu Sep 26 10:25:02 2013 -0400 47.3 @@ -1,5 +1,5 @@ 47.4 /* 47.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 47.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 47.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 47.8 * 47.9 * This code is free software; you can redistribute it and/or modify it 47.10 @@ -1097,7 +1097,7 @@ 47.11 return NULL; 47.12 } 47.13 oop r = *oop_adr; 47.14 - assert(Universe::heap()->is_in_or_null(r), err_msg("bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", (intptr_t) r, (intptr_t) r)); 47.15 + assert(Universe::heap()->is_in_or_null(r), err_msg("bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", (void *) r, (void *) r)); 47.16 return r; 47.17 } 47.18 47.19 @@ -1228,9 +1228,7 @@ 47.20 47.21 void frame::ZapDeadClosure::do_oop(oop* p) { 47.22 if (TraceZapDeadLocals) tty->print_cr("zapping @ " INTPTR_FORMAT " containing " INTPTR_FORMAT, p, (address)*p); 47.23 - // Need cast because on _LP64 the conversion to oop is ambiguous. Constant 47.24 - // can be either long or int. 47.25 - *p = (oop)(int)0xbabebabe; 47.26 + *p = cast_to_oop<intptr_t>(0xbabebabe); 47.27 } 47.28 frame::ZapDeadClosure frame::_zap_dead; 47.29
48.1 --- a/src/share/vm/runtime/javaCalls.cpp Wed Sep 25 17:47:51 2013 +0200 48.2 +++ b/src/share/vm/runtime/javaCalls.cpp Thu Sep 26 10:25:02 2013 -0400 48.3 @@ -1,5 +1,5 @@ 48.4 /* 48.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 48.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 48.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 48.8 * 48.9 * This code is free software; you can redistribute it and/or modify it 48.10 @@ -430,7 +430,7 @@ 48.11 for(int i = 0; i < _size; i++) { 48.12 if (_is_oop[i]) { 48.13 // Handle conversion 48.14 - _value[i] = (intptr_t)Handle::raw_resolve((oop *)_value[i]); 48.15 + _value[i] = cast_from_oop<intptr_t>(Handle::raw_resolve((oop *)_value[i])); 48.16 } 48.17 } 48.18 // Return argument vector
49.1 --- a/src/share/vm/runtime/safepoint.cpp Wed Sep 25 17:47:51 2013 +0200 49.2 +++ b/src/share/vm/runtime/safepoint.cpp Thu Sep 26 10:25:02 2013 -0400 49.3 @@ -1,5 +1,5 @@ 49.4 /* 49.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 49.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 49.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 49.8 * 49.9 * This code is free software; you can redistribute it and/or modify it 49.10 @@ -745,14 +745,14 @@ 49.11 #endif 49.12 49.13 static void print_ptrs(intptr_t oldptr, intptr_t newptr, bool wasoop) { 49.14 - bool is_oop = newptr ? ((oop)newptr)->is_oop() : false; 49.15 + bool is_oop = newptr ? (cast_to_oop(newptr))->is_oop() : false; 49.16 tty->print_cr(PTR_FORMAT PTR_PAD " %s %c " PTR_FORMAT PTR_PAD " %s %s", 49.17 oldptr, wasoop?"oop":" ", oldptr == newptr ? ' ' : '!', 49.18 newptr, is_oop?"oop":" ", (wasoop && !is_oop) ? "STALE" : ((wasoop==false&&is_oop==false&&oldptr !=newptr)?"STOMP":" ")); 49.19 } 49.20 49.21 static void print_longs(jlong oldptr, jlong newptr, bool wasoop) { 49.22 - bool is_oop = newptr ? ((oop)(intptr_t)newptr)->is_oop() : false; 49.23 + bool is_oop = newptr ? (cast_to_oop(newptr))->is_oop() : false; 49.24 tty->print_cr(PTR64_FORMAT " %s %c " PTR64_FORMAT " %s %s", 49.25 oldptr, wasoop?"oop":" ", oldptr == newptr ? ' ' : '!', 49.26 newptr, is_oop?"oop":" ", (wasoop && !is_oop) ? "STALE" : ((wasoop==false&&is_oop==false&&oldptr !=newptr)?"STOMP":" "));
50.1 --- a/src/share/vm/runtime/sharedRuntime.cpp Wed Sep 25 17:47:51 2013 +0200 50.2 +++ b/src/share/vm/runtime/sharedRuntime.cpp Thu Sep 26 10:25:02 2013 -0400 50.3 @@ -1,5 +1,5 @@ 50.4 /* 50.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 50.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 50.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 50.8 * 50.9 * This code is free software; you can redistribute it and/or modify it 50.10 @@ -577,7 +577,7 @@ 50.11 assert(caller.is_interpreted_frame(), ""); 50.12 int args_size = ArgumentSizeComputer(sig).size() + 1; 50.13 assert(args_size <= caller.interpreter_frame_expression_stack_size(), "receiver must be on interpreter stack"); 50.14 - oop result = (oop) *caller.interpreter_frame_tos_at(args_size - 1); 50.15 + oop result = cast_to_oop(*caller.interpreter_frame_tos_at(args_size - 1)); 50.16 assert(Universe::heap()->is_in(result) && result->is_oop(), "receiver must be an oop"); 50.17 return result; 50.18 } 50.19 @@ -2872,7 +2872,7 @@ 50.20 ObjectSynchronizer::inflate_helper(kptr2->obj()); 50.21 // Now the displaced header is free to move 50.22 buf[i++] = (intptr_t)lock->displaced_header(); 50.23 - buf[i++] = (intptr_t)kptr2->obj(); 50.24 + buf[i++] = cast_from_oop<intptr_t>(kptr2->obj()); 50.25 } 50.26 } 50.27 assert( i - max_locals == active_monitor_count*2, "found the expected number of monitors" );
51.1 --- a/src/share/vm/runtime/synchronizer.cpp Wed Sep 25 17:47:51 2013 +0200 51.2 +++ b/src/share/vm/runtime/synchronizer.cpp Thu Sep 26 10:25:02 2013 -0400 51.3 @@ -154,7 +154,7 @@ 51.4 static volatile intptr_t ListLock = 0 ; // protects global monitor free-list cache 51.5 static volatile int MonitorFreeCount = 0 ; // # on gFreeList 51.6 static volatile int MonitorPopulation = 0 ; // # Extant -- in circulation 51.7 -#define CHAINMARKER ((oop)-1) 51.8 +#define CHAINMARKER (cast_to_oop<intptr_t>(-1)) 51.9 51.10 // ----------------------------------------------------------------------------- 51.11 // Fast Monitor Enter/Exit 51.12 @@ -510,7 +510,7 @@ 51.13 // then for each thread on the list, set the flag and unpark() the thread. 51.14 // This is conceptually similar to muxAcquire-muxRelease, except that muxRelease 51.15 // wakes at most one thread whereas we need to wake the entire list. 51.16 - int ix = (intptr_t(obj) >> 5) & (NINFLATIONLOCKS-1) ; 51.17 + int ix = (cast_from_oop<intptr_t>(obj) >> 5) & (NINFLATIONLOCKS-1) ; 51.18 int YieldThenBlock = 0 ; 51.19 assert (ix >= 0 && ix < NINFLATIONLOCKS, "invariant") ; 51.20 assert ((NINFLATIONLOCKS & (NINFLATIONLOCKS-1)) == 0, "invariant") ; 51.21 @@ -565,7 +565,7 @@ 51.22 // This variation has the property of being stable (idempotent) 51.23 // between STW operations. This can be useful in some of the 1-0 51.24 // synchronization schemes. 51.25 - intptr_t addrBits = intptr_t(obj) >> 3 ; 51.26 + intptr_t addrBits = cast_from_oop<intptr_t>(obj) >> 3 ; 51.27 value = addrBits ^ (addrBits >> 5) ^ GVars.stwRandom ; 51.28 } else 51.29 if (hashCode == 2) { 51.30 @@ -575,7 +575,7 @@ 51.31 value = ++GVars.hcSequence ; 51.32 } else 51.33 if (hashCode == 4) { 51.34 - value = intptr_t(obj) ; 51.35 + value = cast_from_oop<intptr_t>(obj) ; 51.36 } else { 51.37 // Marsaglia's xor-shift scheme with thread-specific state 51.38 // This is probably the best overall implementation -- we'll 51.39 @@ -1321,7 +1321,7 @@ 51.40 if (object->is_instance()) { 51.41 ResourceMark rm; 51.42 tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s", 51.43 - (intptr_t) object, (intptr_t) object->mark(), 51.44 + (void *) object, (intptr_t) object->mark(), 51.45 object->klass()->external_name()); 51.46 } 51.47 } 51.48 @@ -1371,7 +1371,7 @@ 51.49 if (object->is_instance()) { 51.50 ResourceMark rm; 51.51 tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s", 51.52 - (intptr_t) object, (intptr_t) object->mark(), 51.53 + (void *) object, (intptr_t) object->mark(), 51.54 object->klass()->external_name()); 51.55 } 51.56 } 51.57 @@ -1439,7 +1439,7 @@ 51.58 if (obj->is_instance()) { 51.59 ResourceMark rm; 51.60 tty->print_cr("Deflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s", 51.61 - (intptr_t) obj, (intptr_t) obj->mark(), obj->klass()->external_name()); 51.62 + (void *) obj, (intptr_t) obj->mark(), obj->klass()->external_name()); 51.63 } 51.64 } 51.65
52.1 --- a/src/share/vm/runtime/thread.cpp Wed Sep 25 17:47:51 2013 +0200 52.2 +++ b/src/share/vm/runtime/thread.cpp Thu Sep 26 10:25:02 2013 -0400 52.3 @@ -1444,7 +1444,7 @@ 52.4 _in_deopt_handler = 0; 52.5 _doing_unsafe_access = false; 52.6 _stack_guard_state = stack_guard_unused; 52.7 - _exception_oop = NULL; 52.8 + (void)const_cast<oop&>(_exception_oop = NULL); 52.9 _exception_pc = 0; 52.10 _exception_handler_pc = 0; 52.11 _is_method_handle_return = 0;
53.1 --- a/src/share/vm/runtime/thread.hpp Wed Sep 25 17:47:51 2013 +0200 53.2 +++ b/src/share/vm/runtime/thread.hpp Thu Sep 26 10:25:02 2013 -0400 53.3 @@ -1278,7 +1278,7 @@ 53.4 address exception_handler_pc() const { return _exception_handler_pc; } 53.5 bool is_method_handle_return() const { return _is_method_handle_return == 1; } 53.6 53.7 - void set_exception_oop(oop o) { _exception_oop = o; } 53.8 + void set_exception_oop(oop o) { (void)const_cast<oop&>(_exception_oop = o); } 53.9 void set_exception_pc(address a) { _exception_pc = a; } 53.10 void set_exception_handler_pc(address a) { _exception_handler_pc = a; } 53.11 void set_is_method_handle_return(bool value) { _is_method_handle_return = value ? 1 : 0; }
54.1 --- a/src/share/vm/runtime/vframeArray.cpp Wed Sep 25 17:47:51 2013 +0200 54.2 +++ b/src/share/vm/runtime/vframeArray.cpp Thu Sep 26 10:25:02 2013 -0400 54.3 @@ -1,5 +1,5 @@ 54.4 /* 54.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 54.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 54.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 54.8 * 54.9 * This code is free software; you can redistribute it and/or modify it 54.10 @@ -111,7 +111,7 @@ 54.11 case T_OBJECT: 54.12 assert(!value->obj_is_scalar_replaced(), "object should be reallocated already"); 54.13 // preserve object type 54.14 - _locals->add( new StackValue((intptr_t) (value->get_obj()()), T_OBJECT )); 54.15 + _locals->add( new StackValue(cast_from_oop<intptr_t>((value->get_obj()())), T_OBJECT )); 54.16 break; 54.17 case T_CONFLICT: 54.18 // A dead local. Will be initialized to null/zero. 54.19 @@ -136,7 +136,7 @@ 54.20 case T_OBJECT: 54.21 assert(!value->obj_is_scalar_replaced(), "object should be reallocated already"); 54.22 // preserve object type 54.23 - _expressions->add( new StackValue((intptr_t) (value->get_obj()()), T_OBJECT )); 54.24 + _expressions->add( new StackValue(cast_from_oop<intptr_t>((value->get_obj()())), T_OBJECT )); 54.25 break; 54.26 case T_CONFLICT: 54.27 // A dead stack element. Will be initialized to null/zero.
55.1 --- a/src/share/vm/services/classLoadingService.cpp Wed Sep 25 17:47:51 2013 +0200 55.2 +++ b/src/share/vm/services/classLoadingService.cpp Thu Sep 26 10:25:02 2013 -0400 55.3 @@ -1,5 +1,5 @@ 55.4 /* 55.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 55.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 55.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 55.8 * 55.9 * This code is free software; you can redistribute it and/or modify it 55.10 @@ -52,7 +52,7 @@ 55.11 len = name->utf8_length(); \ 55.12 } \ 55.13 HS_DTRACE_PROBE4(hotspot, class__##type, \ 55.14 - data, len, (clss)->class_loader(), (shared)); \ 55.15 + data, len, SOLARIS_ONLY((void *))(clss)->class_loader(), (shared)); \ 55.16 } 55.17 55.18 #else /* USDT2 */
56.1 --- a/src/share/vm/services/heapDumper.cpp Wed Sep 25 17:47:51 2013 +0200 56.2 +++ b/src/share/vm/services/heapDumper.cpp Thu Sep 26 10:25:02 2013 -0400 56.3 @@ -563,7 +563,7 @@ 56.4 } 56.5 56.6 void DumpWriter::write_objectID(oop o) { 56.7 - address a = (address)((uintptr_t)o); 56.8 + address a = (address)o; 56.9 #ifdef _LP64 56.10 write_u8((u8)a); 56.11 #else
57.1 --- a/src/share/vm/services/memoryManager.cpp Wed Sep 25 17:47:51 2013 +0200 57.2 +++ b/src/share/vm/services/memoryManager.cpp Thu Sep 26 10:25:02 2013 -0400 57.3 @@ -1,5 +1,5 @@ 57.4 /* 57.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 57.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 57.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 57.8 * 57.9 * This code is free software; you can redistribute it and/or modify it 57.10 @@ -45,7 +45,7 @@ 57.11 57.12 MemoryManager::MemoryManager() { 57.13 _num_pools = 0; 57.14 - _memory_mgr_obj = NULL; 57.15 + (void)const_cast<instanceOop&>(_memory_mgr_obj = NULL); 57.16 } 57.17 57.18 void MemoryManager::add_pool(MemoryPool* pool) {
58.1 --- a/src/share/vm/services/memoryPool.cpp Wed Sep 25 17:47:51 2013 +0200 58.2 +++ b/src/share/vm/services/memoryPool.cpp Thu Sep 26 10:25:02 2013 -0400 58.3 @@ -1,5 +1,5 @@ 58.4 /* 58.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 58.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 58.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 58.8 * 58.9 * This code is free software; you can redistribute it and/or modify it 58.10 @@ -45,7 +45,7 @@ 58.11 _name = name; 58.12 _initial_size = init_size; 58.13 _max_size = max_size; 58.14 - _memory_pool_obj = NULL; 58.15 + (void)const_cast<instanceOop&>(_memory_pool_obj = NULL); 58.16 _available_for_allocation = true; 58.17 _num_managers = 0; 58.18 _type = type;
59.1 --- a/src/share/vm/utilities/globalDefinitions.hpp Wed Sep 25 17:47:51 2013 +0200 59.2 +++ b/src/share/vm/utilities/globalDefinitions.hpp Thu Sep 26 10:25:02 2013 -0400 59.3 @@ -967,9 +967,9 @@ 59.4 // (These must be implemented as #defines because C++ compilers are 59.5 // not obligated to inline non-integral constants!) 59.6 #define badAddress ((address)::badAddressVal) 59.7 -#define badOop ((oop)::badOopVal) 59.8 +#define badOop (cast_to_oop(::badOopVal)) 59.9 #define badHeapWord (::badHeapWordVal) 59.10 -#define badJNIHandle ((oop)::badJNIHandleVal) 59.11 +#define badJNIHandle (cast_to_oop(::badJNIHandleVal)) 59.12 59.13 // Default TaskQueue size is 16K (32-bit) or 128K (64-bit) 59.14 #define TASKQUEUE_SIZE (NOT_LP64(1<<14) LP64_ONLY(1<<17))
60.1 --- a/src/share/vm/utilities/globalDefinitions_visCPP.hpp Wed Sep 25 17:47:51 2013 +0200 60.2 +++ b/src/share/vm/utilities/globalDefinitions_visCPP.hpp Thu Sep 26 10:25:02 2013 -0400 60.3 @@ -189,6 +189,10 @@ 60.4 #pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union (needed in windows.h) 60.5 #pragma warning( disable : 4511 ) // copy constructor could not be generated 60.6 #pragma warning( disable : 4291 ) // no matching operator delete found; memory will not be freed if initialization thows an exception 60.7 +#ifdef CHECK_UNHANDLED_OOPS 60.8 +#pragma warning( disable : 4521 ) // class has multiple copy ctors of a single type 60.9 +#pragma warning( disable : 4522 ) // class has multiple assignment operators of a single type 60.10 +#endif // CHECK_UNHANDLED_OOPS 60.11 #if _MSC_VER >= 1400 60.12 #pragma warning( disable : 4996 ) // unsafe string functions. Same as define _CRT_SECURE_NO_WARNINGS/_CRT_SECURE_NO_DEPRICATE 60.13 #endif
61.1 --- a/src/share/vm/utilities/hashtable.cpp Wed Sep 25 17:47:51 2013 +0200 61.2 +++ b/src/share/vm/utilities/hashtable.cpp Thu Sep 26 10:25:02 2013 -0400 61.3 @@ -1,5 +1,5 @@ 61.4 /* 61.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 61.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 61.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 61.8 * 61.9 * This code is free software; you can redistribute it and/or modify it 61.10 @@ -356,9 +356,9 @@ 61.11 template class Hashtable<Symbol*, mtSymbol>; 61.12 template class Hashtable<Klass*, mtClass>; 61.13 template class Hashtable<oop, mtClass>; 61.14 -#ifdef SOLARIS 61.15 +#if defined(SOLARIS) || defined(CHECK_UNHANDLED_OOPS) 61.16 template class Hashtable<oop, mtSymbol>; 61.17 -#endif 61.18 +#endif // SOLARIS || CHECK_UNHANDLED_OOPS 61.19 template class Hashtable<oopDesc*, mtSymbol>; 61.20 template class Hashtable<Symbol*, mtClass>; 61.21 template class HashtableEntry<Symbol*, mtSymbol>;
62.1 --- a/src/share/vm/utilities/taskqueue.hpp Wed Sep 25 17:47:51 2013 +0200 62.2 +++ b/src/share/vm/utilities/taskqueue.hpp Thu Sep 26 10:25:02 2013 -0400 62.3 @@ -322,11 +322,11 @@ 62.4 // Attempts to claim a task from the "local" end of the queue (the most 62.5 // recently pushed). If successful, returns true and sets t to the task; 62.6 // otherwise, returns false (the queue is empty). 62.7 - inline bool pop_local(E& t); 62.8 + inline bool pop_local(volatile E& t); 62.9 62.10 // Like pop_local(), but uses the "global" end of the queue (the least 62.11 // recently pushed). 62.12 - bool pop_global(E& t); 62.13 + bool pop_global(volatile E& t); 62.14 62.15 // Delete any resource associated with the queue. 62.16 ~GenericTaskQueue(); 62.17 @@ -424,7 +424,7 @@ 62.18 } 62.19 62.20 template<class E, MEMFLAGS F, unsigned int N> 62.21 -bool GenericTaskQueue<E, F, N>::pop_global(E& t) { 62.22 +bool GenericTaskQueue<E, F, N>::pop_global(volatile E& t) { 62.23 Age oldAge = _age.get(); 62.24 // Architectures with weak memory model require a barrier here 62.25 // to guarantee that bottom is not older than age, 62.26 @@ -701,7 +701,7 @@ 62.27 } 62.28 62.29 template<class E, MEMFLAGS F, unsigned int N> inline bool 62.30 -GenericTaskQueue<E, F, N>::pop_local(E& t) { 62.31 +GenericTaskQueue<E, F, N>::pop_local(volatile E& t) { 62.32 uint localBot = _bottom; 62.33 // This value cannot be N-1. That can only occur as a result of 62.34 // the assignment to bottom in this method. If it does, this method 62.35 @@ -799,7 +799,7 @@ 62.36 } 62.37 volatile ObjArrayTask& 62.38 operator =(const volatile ObjArrayTask& t) volatile { 62.39 - _obj = t._obj; 62.40 + (void)const_cast<oop&>(_obj = t._obj); 62.41 _index = t._index; 62.42 return *this; 62.43 }