7195622: CheckUnhandledOops has limited usefulness now

Enable CHECK_UNHANDLED_OOPS in fastdebug builds across all supported platforms.

Reviewed-by: coleenp, hseigel, dholmes, stefank, twisti, ihse, rdurbin
This commit is contained in:
Lois Foltan 2013-09-26 10:25:02 -04:00 committed by Harold Seigel
parent 18550f7774
commit 7bf953d005
62 changed files with 208 additions and 173 deletions

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -59,5 +59,5 @@ CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE)
MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug
VERSION = fastdebug VERSION = fastdebug
SYSDEFS += -DASSERT SYSDEFS += -DASSERT -DCHECK_UNHANDLED_OOPS
PICFLAGS = DEFAULT PICFLAGS = DEFAULT

View file

@ -59,5 +59,5 @@ CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE)
MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug
VERSION = optimized VERSION = optimized
SYSDEFS += -DASSERT SYSDEFS += -DASSERT -DCHECK_UNHANDLED_OOPS
PICFLAGS = DEFAULT PICFLAGS = DEFAULT

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -38,7 +38,7 @@ default:: $(BUILD_PCH_FILE) $(AOUT) checkAndBuildSA
!include ../local.make !include ../local.make
!include compile.make !include compile.make
CXX_FLAGS=$(CXX_FLAGS) $(FASTDEBUG_OPT_OPTION) CXX_FLAGS=$(CXX_FLAGS) $(FASTDEBUG_OPT_OPTION) /D "CHECK_UNHANDLED_OOPS"
!include $(WorkSpace)/make/windows/makefiles/vm.make !include $(WorkSpace)/make/windows/makefiles/vm.make
!include local.make !include local.make

View file

@ -764,7 +764,7 @@ BasicType frame::interpreter_frame_result(oop* oop_result, jvalue* value_result)
#ifdef CC_INTERP #ifdef CC_INTERP
*oop_result = istate->_oop_temp; *oop_result = istate->_oop_temp;
#else #else
oop obj = (oop) at(interpreter_frame_oop_temp_offset); oop obj = cast_to_oop(at(interpreter_frame_oop_temp_offset));
assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check"); assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check");
*oop_result = obj; *oop_result = obj;
#endif // CC_INTERP #endif // CC_INTERP
@ -788,7 +788,7 @@ BasicType frame::interpreter_frame_result(oop* oop_result, jvalue* value_result)
switch(type) { switch(type) {
case T_OBJECT: case T_OBJECT:
case T_ARRAY: { case T_ARRAY: {
oop obj = (oop)*tos_addr; oop obj = cast_to_oop(*tos_addr);
assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check"); assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check");
*oop_result = obj; *oop_result = obj;
break; break;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -358,7 +358,7 @@ void NativeMovConstReg::set_data(intptr_t x) {
oop_Relocation *r = iter.oop_reloc(); oop_Relocation *r = iter.oop_reloc();
if (oop_addr == NULL) { if (oop_addr == NULL) {
oop_addr = r->oop_addr(); oop_addr = r->oop_addr();
*oop_addr = (oop)x; *oop_addr = cast_to_oop(x);
} else { } else {
assert(oop_addr == r->oop_addr(), "must be only one set-oop here"); assert(oop_addr == r->oop_addr(), "must be only one set-oop here");
} }
@ -478,7 +478,7 @@ void NativeMovConstRegPatching::set_data(int x) {
oop_Relocation *r = iter.oop_reloc(); oop_Relocation *r = iter.oop_reloc();
if (oop_addr == NULL) { if (oop_addr == NULL) {
oop_addr = r->oop_addr(); oop_addr = r->oop_addr();
*oop_addr = (oop)x; *oop_addr = cast_to_oop(x);
} else { } else {
assert(oop_addr == r->oop_addr(), "must be only one set-oop here"); assert(oop_addr == r->oop_addr(), "must be only one set-oop here");
} }

View file

@ -639,7 +639,7 @@ BasicType frame::interpreter_frame_result(oop* oop_result, jvalue* value_result)
#ifdef CC_INTERP #ifdef CC_INTERP
obj = istate->_oop_temp; obj = istate->_oop_temp;
#else #else
obj = (oop) at(interpreter_frame_oop_temp_offset); obj = cast_to_oop(at(interpreter_frame_oop_temp_offset));
#endif // CC_INTERP #endif // CC_INTERP
} else { } else {
oop* obj_p = (oop*)tos_addr; oop* obj_p = (oop*)tos_addr;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -475,7 +475,7 @@ void trace_method_handle_stub(const char* adaptername,
const char* mh_reg_name = has_mh ? "rcx_mh" : "rcx"; const char* mh_reg_name = has_mh ? "rcx_mh" : "rcx";
tty->print_cr("MH %s %s="PTR_FORMAT" sp="PTR_FORMAT, tty->print_cr("MH %s %s="PTR_FORMAT" sp="PTR_FORMAT,
adaptername, mh_reg_name, adaptername, mh_reg_name,
mh, entry_sp); (void *)mh, entry_sp);
if (Verbose) { if (Verbose) {
tty->print_cr("Registers:"); tty->print_cr("Registers:");

View file

@ -351,7 +351,7 @@ void emit_d32_reloc(CodeBuffer &cbuf, int d32, RelocationHolder const& rspec,
int format) { int format) {
#ifdef ASSERT #ifdef ASSERT
if (rspec.reloc()->type() == relocInfo::oop_type && d32 != 0 && d32 != (int)Universe::non_oop_word()) { if (rspec.reloc()->type() == relocInfo::oop_type && d32 != 0 && d32 != (int)Universe::non_oop_word()) {
assert(oop(d32)->is_oop() && (ScavengeRootsInCode || !oop(d32)->is_scavengable()), "cannot embed scavengable oops in code"); assert(cast_to_oop(d32)->is_oop() && (ScavengeRootsInCode || !cast_to_oop(d32)->is_scavengable()), "cannot embed scavengable oops in code");
} }
#endif #endif
cbuf.relocate(cbuf.insts_mark(), rspec, format); cbuf.relocate(cbuf.insts_mark(), rspec, format);

View file

@ -529,7 +529,7 @@ void emit_d32_reloc(CodeBuffer& cbuf, int d32, RelocationHolder const& rspec, in
if (rspec.reloc()->type() == relocInfo::oop_type && if (rspec.reloc()->type() == relocInfo::oop_type &&
d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) { d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) {
assert(Universe::heap()->is_in_reserved((address)(intptr_t)d32), "should be real oop"); assert(Universe::heap()->is_in_reserved((address)(intptr_t)d32), "should be real oop");
assert(oop((intptr_t)d32)->is_oop() && (ScavengeRootsInCode || !oop((intptr_t)d32)->is_scavengable()), "cannot embed scavengable oops in code"); assert(cast_to_oop((intptr_t)d32)->is_oop() && (ScavengeRootsInCode || !cast_to_oop((intptr_t)d32)->is_scavengable()), "cannot embed scavengable oops in code");
} }
#endif #endif
cbuf.relocate(cbuf.insts_mark(), rspec, format); cbuf.relocate(cbuf.insts_mark(), rspec, format);
@ -556,7 +556,7 @@ void emit_d64_reloc(CodeBuffer& cbuf, int64_t d64, RelocationHolder const& rspec
if (rspec.reloc()->type() == relocInfo::oop_type && if (rspec.reloc()->type() == relocInfo::oop_type &&
d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) { d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) {
assert(Universe::heap()->is_in_reserved((address)d64), "should be real oop"); assert(Universe::heap()->is_in_reserved((address)d64), "should be real oop");
assert(oop(d64)->is_oop() && (ScavengeRootsInCode || !oop(d64)->is_scavengable()), assert(cast_to_oop(d64)->is_oop() && (ScavengeRootsInCode || !cast_to_oop(d64)->is_scavengable()),
"cannot embed scavengable oops in code"); "cannot embed scavengable oops in code");
} }
#endif #endif

View file

@ -1019,7 +1019,7 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
n_copy->set_data((intx) (load_klass())); n_copy->set_data((intx) (load_klass()));
} else { } else {
assert(mirror() != NULL, "klass not set"); assert(mirror() != NULL, "klass not set");
n_copy->set_data((intx) (mirror())); n_copy->set_data(cast_from_oop<intx>(mirror()));
} }
if (TracePatching) { if (TracePatching) {
@ -1031,7 +1031,7 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
assert(n_copy->data() == 0 || assert(n_copy->data() == 0 ||
n_copy->data() == (intptr_t)Universe::non_oop_word(), n_copy->data() == (intptr_t)Universe::non_oop_word(),
"illegal init value"); "illegal init value");
n_copy->set_data((intx) (appendix())); n_copy->set_data(cast_from_oop<intx>(appendix()));
if (TracePatching) { if (TracePatching) {
Disassembler::decode(copy_buff, copy_buff + *byte_count, tty); Disassembler::decode(copy_buff, copy_buff + *byte_count, tty);

View file

@ -261,7 +261,7 @@ void ClassLoaderData::add_class(Klass* k) {
k, k,
k->external_name(), k->external_name(),
k->class_loader_data(), k->class_loader_data(),
k->class_loader(), (void *)k->class_loader(),
loader_name()); loader_name());
} }
} }
@ -297,7 +297,7 @@ void ClassLoaderData::unload() {
if (TraceClassLoaderData) { if (TraceClassLoaderData) {
ResourceMark rm; ResourceMark rm;
tty->print("[ClassLoaderData: unload loader data "PTR_FORMAT, this); tty->print("[ClassLoaderData: unload loader data "PTR_FORMAT, this);
tty->print(" for instance "PTR_FORMAT" of %s", class_loader(), tty->print(" for instance "PTR_FORMAT" of %s", (void *)class_loader(),
loader_name()); loader_name());
if (is_anonymous()) { if (is_anonymous()) {
tty->print(" for anonymous class "PTR_FORMAT " ", _klasses); tty->print(" for anonymous class "PTR_FORMAT " ", _klasses);
@ -458,7 +458,7 @@ const char* ClassLoaderData::loader_name() {
void ClassLoaderData::dump(outputStream * const out) { void ClassLoaderData::dump(outputStream * const out) {
ResourceMark rm; ResourceMark rm;
out->print("ClassLoaderData CLD: "PTR_FORMAT", loader: "PTR_FORMAT", loader_klass: "PTR_FORMAT" %s {", out->print("ClassLoaderData CLD: "PTR_FORMAT", loader: "PTR_FORMAT", loader_klass: "PTR_FORMAT" %s {",
this, class_loader(), this, (void *)class_loader(),
class_loader() != NULL ? class_loader()->klass() : NULL, loader_name()); class_loader() != NULL ? class_loader()->klass() : NULL, loader_name());
if (claimed()) out->print(" claimed "); if (claimed()) out->print(" claimed ");
if (is_unloading()) out->print(" unloading "); if (is_unloading()) out->print(" unloading ");
@ -553,7 +553,7 @@ ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool is_anonymous, TRA
ResourceMark rm; ResourceMark rm;
tty->print("[ClassLoaderData: "); tty->print("[ClassLoaderData: ");
tty->print("create class loader data "PTR_FORMAT, cld); tty->print("create class loader data "PTR_FORMAT, cld);
tty->print(" for instance "PTR_FORMAT" of %s", cld->class_loader(), tty->print(" for instance "PTR_FORMAT" of %s", (void *)cld->class_loader(),
cld->loader_name()); cld->loader_name());
tty->print_cr("]"); tty->print_cr("]");
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -264,7 +264,7 @@ class SymbolPropertyEntry : public HashtableEntry<Symbol*, mtSymbol> {
} }
if (method_type() != NULL) { if (method_type() != NULL) {
if (printed) st->print(" and "); if (printed) st->print(" and ");
st->print(INTPTR_FORMAT, method_type()); st->print(INTPTR_FORMAT, (void *)method_type());
printed = true; printed = true;
} }
st->print_cr(printed ? "" : "(empty)"); st->print_cr(printed ? "" : "(empty)");

View file

@ -840,7 +840,7 @@ StringTable::VerifyRetTypes StringTable::compare_entries(
if (str1 == str2) { if (str1 == str2) {
tty->print_cr("ERROR: identical oop values (0x" PTR_FORMAT ") " tty->print_cr("ERROR: identical oop values (0x" PTR_FORMAT ") "
"in entry @ bucket[%d][%d] and entry @ bucket[%d][%d]", "in entry @ bucket[%d][%d] and entry @ bucket[%d][%d]",
str1, bkt1, e_cnt1, bkt2, e_cnt2); (void *)str1, bkt1, e_cnt1, bkt2, e_cnt2);
return _verify_fail_continue; return _verify_fail_continue;
} }

View file

@ -1965,7 +1965,7 @@ public:
if (!_detected_scavenge_root) _print_nm->print_on(tty, "new scavenge root"); if (!_detected_scavenge_root) _print_nm->print_on(tty, "new scavenge root");
tty->print_cr(""PTR_FORMAT"[offset=%d] detected scavengable oop "PTR_FORMAT" (found at "PTR_FORMAT")", tty->print_cr(""PTR_FORMAT"[offset=%d] detected scavengable oop "PTR_FORMAT" (found at "PTR_FORMAT")",
_print_nm, (int)((intptr_t)p - (intptr_t)_print_nm), _print_nm, (int)((intptr_t)p - (intptr_t)_print_nm),
(intptr_t)(*p), (intptr_t)p); (void *)(*p), (intptr_t)p);
(*p)->print(); (*p)->print();
} }
#endif //PRODUCT #endif //PRODUCT
@ -2345,7 +2345,7 @@ public:
_ok = false; _ok = false;
} }
tty->print_cr("*** non-oop "PTR_FORMAT" found at "PTR_FORMAT" (offset %d)", tty->print_cr("*** non-oop "PTR_FORMAT" found at "PTR_FORMAT" (offset %d)",
(intptr_t)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm)); (void *)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm));
} }
virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); } virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
}; };
@ -2466,7 +2466,7 @@ public:
_ok = false; _ok = false;
} }
tty->print_cr("*** scavengable oop "PTR_FORMAT" found at "PTR_FORMAT" (offset %d)", tty->print_cr("*** scavengable oop "PTR_FORMAT" found at "PTR_FORMAT" (offset %d)",
(intptr_t)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm)); (void *)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm));
(*p)->print(); (*p)->print();
} }
virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); } virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -628,7 +628,7 @@ void DerivedPointerTable::clear() {
// Returns value of location as an int // Returns value of location as an int
intptr_t value_of_loc(oop *pointer) { return (intptr_t)(*pointer); } intptr_t value_of_loc(oop *pointer) { return cast_from_oop<intptr_t>((*pointer)); }
void DerivedPointerTable::add(oop *derived_loc, oop *base_loc) { void DerivedPointerTable::add(oop *derived_loc, oop *base_loc) {

View file

@ -9065,7 +9065,7 @@ bool CMSCollector::take_from_overflow_list(size_t num, CMSMarkStack* stack) {
return !stack->isEmpty(); return !stack->isEmpty();
} }
#define BUSY (oop(0x1aff1aff)) #define BUSY (cast_to_oop<intptr_t>(0x1aff1aff))
// (MT-safe) Get a prefix of at most "num" from the list. // (MT-safe) Get a prefix of at most "num" from the list.
// The overflow list is chained through the mark word of // The overflow list is chained through the mark word of
// each object in the list. We fetch the entire list, // each object in the list. We fetch the entire list,
@ -9098,7 +9098,7 @@ bool CMSCollector::par_take_from_overflow_list(size_t num,
return false; return false;
} }
// Grab the entire list; we'll put back a suffix // Grab the entire list; we'll put back a suffix
oop prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list); oop prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
Thread* tid = Thread::current(); Thread* tid = Thread::current();
// Before "no_of_gc_threads" was introduced CMSOverflowSpinCount was // Before "no_of_gc_threads" was introduced CMSOverflowSpinCount was
// set to ParallelGCThreads. // set to ParallelGCThreads.
@ -9113,7 +9113,7 @@ bool CMSCollector::par_take_from_overflow_list(size_t num,
return false; return false;
} else if (_overflow_list != BUSY) { } else if (_overflow_list != BUSY) {
// Try and grab the prefix // Try and grab the prefix
prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list); prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
} }
} }
// If the list was found to be empty, or we spun long // If the list was found to be empty, or we spun long

View file

@ -2694,7 +2694,7 @@ public:
if (print_it) { if (print_it) {
_out->print_cr(" "PTR_FORMAT"%s", _out->print_cr(" "PTR_FORMAT"%s",
o, (over_tams) ? " >" : (marked) ? " M" : ""); (void *)o, (over_tams) ? " >" : (marked) ? " M" : "");
PrintReachableOopClosure oopCl(_out, _vo, _all); PrintReachableOopClosure oopCl(_out, _vo, _all);
o->oop_iterate_no_header(&oopCl); o->oop_iterate_no_header(&oopCl);
} }

View file

@ -4615,7 +4615,7 @@ bool G1ParScanThreadState::verify_ref(narrowOop* ref) const {
assert(!has_partial_array_mask(ref), err_msg("ref=" PTR_FORMAT, ref)); assert(!has_partial_array_mask(ref), err_msg("ref=" PTR_FORMAT, ref));
oop p = oopDesc::load_decode_heap_oop(ref); oop p = oopDesc::load_decode_heap_oop(ref);
assert(_g1h->is_in_g1_reserved(p), assert(_g1h->is_in_g1_reserved(p),
err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, intptr_t(p))); err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, (void *)p));
return true; return true;
} }
@ -4625,11 +4625,11 @@ bool G1ParScanThreadState::verify_ref(oop* ref) const {
// Must be in the collection set--it's already been copied. // Must be in the collection set--it's already been copied.
oop p = clear_partial_array_mask(ref); oop p = clear_partial_array_mask(ref);
assert(_g1h->obj_in_cs(p), assert(_g1h->obj_in_cs(p),
err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, intptr_t(p))); err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, (void *)p));
} else { } else {
oop p = oopDesc::load_decode_heap_oop(ref); oop p = oopDesc::load_decode_heap_oop(ref);
assert(_g1h->is_in_g1_reserved(p), assert(_g1h->is_in_g1_reserved(p),
err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, intptr_t(p))); err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, (void *)p));
} }
return true; return true;
} }

View file

@ -703,7 +703,7 @@ public:
if (_g1_committed.contains((HeapWord*) obj)) { if (_g1_committed.contains((HeapWord*) obj)) {
// no need to subtract the bottom of the heap from obj, // no need to subtract the bottom of the heap from obj,
// _in_cset_fast_test is biased // _in_cset_fast_test is biased
uintx index = (uintx) obj >> HeapRegion::LogOfHRGrainBytes; uintx index = cast_from_oop<uintx>(obj) >> HeapRegion::LogOfHRGrainBytes;
bool ret = _in_cset_fast_test[index]; bool ret = _in_cset_fast_test[index];
// let's make sure the result is consistent with what the slower // let's make sure the result is consistent with what the slower
// test returns // test returns

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -91,12 +91,12 @@ template <class T> inline bool has_partial_array_mask(T* ref) {
} }
template <class T> inline T* set_partial_array_mask(T obj) { template <class T> inline T* set_partial_array_mask(T obj) {
assert(((uintptr_t)obj & G1_PARTIAL_ARRAY_MASK) == 0, "Information loss!"); assert(((uintptr_t)(void *)obj & G1_PARTIAL_ARRAY_MASK) == 0, "Information loss!");
return (T*) ((uintptr_t)obj | G1_PARTIAL_ARRAY_MASK); return (T*) ((uintptr_t)(void *)obj | G1_PARTIAL_ARRAY_MASK);
} }
template <class T> inline oop clear_partial_array_mask(T* ref) { template <class T> inline oop clear_partial_array_mask(T* ref) {
return oop((intptr_t)ref & ~G1_PARTIAL_ARRAY_MASK); return cast_to_oop((intptr_t)ref & ~G1_PARTIAL_ARRAY_MASK);
} }
class G1ParScanPartialArrayClosure : public G1ParClosureSuper { class G1ParScanPartialArrayClosure : public G1ParClosureSuper {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -95,7 +95,7 @@ void
G1SATBCardTableLoggingModRefBS::write_ref_field_static(void* field, G1SATBCardTableLoggingModRefBS::write_ref_field_static(void* field,
oop new_val) { oop new_val) {
uintptr_t field_uint = (uintptr_t)field; uintptr_t field_uint = (uintptr_t)field;
uintptr_t new_val_uint = (uintptr_t)new_val; uintptr_t new_val_uint = cast_from_oop<uintptr_t>(new_val);
uintptr_t comb = field_uint ^ new_val_uint; uintptr_t comb = field_uint ^ new_val_uint;
comb = comb >> HeapRegion::LogOfHRGrainBytes; comb = comb >> HeapRegion::LogOfHRGrainBytes;
if (comb == 0) return; if (comb == 0) return;

View file

@ -637,7 +637,7 @@ class VerifyStrongCodeRootOopClosure: public OopClosure {
gclog_or_tty->print_cr("Object "PTR_FORMAT" in region " gclog_or_tty->print_cr("Object "PTR_FORMAT" in region "
"["PTR_FORMAT", "PTR_FORMAT") is above " "["PTR_FORMAT", "PTR_FORMAT") is above "
"top "PTR_FORMAT, "top "PTR_FORMAT,
obj, _hr->bottom(), _hr->end(), _hr->top()); (void *)obj, _hr->bottom(), _hr->end(), _hr->top());
_failures = true; _failures = true;
return; return;
} }
@ -951,12 +951,12 @@ void HeapRegion::verify(VerifyOption vo,
Klass* klass = obj->klass(); Klass* klass = obj->klass();
if (!klass->is_metaspace_object()) { if (!klass->is_metaspace_object()) {
gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" "
"not metadata", klass, obj); "not metadata", klass, (void *)obj);
*failures = true; *failures = true;
return; return;
} else if (!klass->is_klass()) { } else if (!klass->is_klass()) {
gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" "
"not a klass", klass, obj); "not a klass", klass, (void *)obj);
*failures = true; *failures = true;
return; return;
} else { } else {
@ -971,7 +971,7 @@ void HeapRegion::verify(VerifyOption vo,
} }
} }
} else { } else {
gclog_or_tty->print_cr(PTR_FORMAT" no an oop", obj); gclog_or_tty->print_cr(PTR_FORMAT" no an oop", (void *)obj);
*failures = true; *failures = true;
return; return;
} }

View file

@ -91,8 +91,8 @@ protected:
gclog_or_tty->print_cr(" PRT::Add_reference_work(" PTR_FORMAT "->" PTR_FORMAT").", gclog_or_tty->print_cr(" PRT::Add_reference_work(" PTR_FORMAT "->" PTR_FORMAT").",
from, from,
UseCompressedOops UseCompressedOops
? oopDesc::load_decode_heap_oop((narrowOop*)from) ? (void *)oopDesc::load_decode_heap_oop((narrowOop*)from)
: oopDesc::load_decode_heap_oop((oop*)from)); : (void *)oopDesc::load_decode_heap_oop((oop*)from));
} }
HeapRegion* loc_hr = hr(); HeapRegion* loc_hr = hr();
@ -403,8 +403,8 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) {
gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").", gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").",
from, from,
UseCompressedOops UseCompressedOops
? oopDesc::load_decode_heap_oop((narrowOop*)from) ? (void *)oopDesc::load_decode_heap_oop((narrowOop*)from)
: oopDesc::load_decode_heap_oop((oop*)from)); : (void *)oopDesc::load_decode_heap_oop((oop*)from));
} }
int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift); int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift);

View file

@ -1103,7 +1103,7 @@ void ParNewGeneration::waste_some_time() {
} }
} }
static const oop ClaimedForwardPtr = oop(0x4); static const oop ClaimedForwardPtr = cast_to_oop<intptr_t>(0x4);
// Because of concurrency, there are times where an object for which // Because of concurrency, there are times where an object for which
// "is_forwarded()" is true contains an "interim" forwarding pointer // "is_forwarded()" is true contains an "interim" forwarding pointer
@ -1226,7 +1226,7 @@ oop ParNewGeneration::copy_to_survivor_space_avoiding_promotion_undo(
if (TraceScavenge) { if (TraceScavenge) {
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
is_in_reserved(new_obj) ? "copying" : "tenuring", is_in_reserved(new_obj) ? "copying" : "tenuring",
new_obj->klass()->internal_name(), old, new_obj, new_obj->size()); new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size());
} }
#endif #endif
@ -1347,7 +1347,7 @@ oop ParNewGeneration::copy_to_survivor_space_with_undo(
if (TraceScavenge) { if (TraceScavenge) {
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
is_in_reserved(new_obj) ? "copying" : "tenuring", is_in_reserved(new_obj) ? "copying" : "tenuring",
new_obj->klass()->internal_name(), old, new_obj, new_obj->size()); new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size());
} }
#endif #endif
@ -1436,7 +1436,7 @@ bool ParNewGeneration::should_simulate_overflow() {
// (although some performance comparisons would be useful since // (although some performance comparisons would be useful since
// single global lists have their own performance disadvantages // single global lists have their own performance disadvantages
// as we were made painfully aware not long ago, see 6786503). // as we were made painfully aware not long ago, see 6786503).
#define BUSY (oop(0x1aff1aff)) #define BUSY (cast_to_oop<intptr_t>(0x1aff1aff))
void ParNewGeneration::push_on_overflow_list(oop from_space_obj, ParScanThreadState* par_scan_state) { void ParNewGeneration::push_on_overflow_list(oop from_space_obj, ParScanThreadState* par_scan_state) {
assert(is_in_reserved(from_space_obj), "Should be from this generation"); assert(is_in_reserved(from_space_obj), "Should be from this generation");
if (ParGCUseLocalOverflow) { if (ParGCUseLocalOverflow) {
@ -1512,7 +1512,7 @@ bool ParNewGeneration::take_from_overflow_list_work(ParScanThreadState* par_scan
if (_overflow_list == NULL) return false; if (_overflow_list == NULL) return false;
// Otherwise, there was something there; try claiming the list. // Otherwise, there was something there; try claiming the list.
oop prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list); oop prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
// Trim off a prefix of at most objsFromOverflow items // Trim off a prefix of at most objsFromOverflow items
Thread* tid = Thread::current(); Thread* tid = Thread::current();
size_t spin_count = (size_t)ParallelGCThreads; size_t spin_count = (size_t)ParallelGCThreads;
@ -1526,7 +1526,7 @@ bool ParNewGeneration::take_from_overflow_list_work(ParScanThreadState* par_scan
return false; return false;
} else if (_overflow_list != BUSY) { } else if (_overflow_list != BUSY) {
// try and grab the prefix // try and grab the prefix
prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list); prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
} }
} }
if (prefix == NULL || prefix == BUSY) { if (prefix == NULL || prefix == BUSY) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -84,7 +84,7 @@ inline void ParScanClosure::do_oop_work(T* p,
Space* sp = gch->space_containing(p); Space* sp = gch->space_containing(p);
oop obj = oop(sp->block_start(p)); oop obj = oop(sp->block_start(p));
assert((HeapWord*)obj < (HeapWord*)p, "Error"); assert((HeapWord*)obj < (HeapWord*)p, "Error");
tty->print_cr("Object: " PTR_FORMAT, obj); tty->print_cr("Object: " PTR_FORMAT, (void *)obj);
tty->print_cr("-------"); tty->print_cr("-------");
obj->print(); obj->print();
tty->print_cr("-----"); tty->print_cr("-----");
@ -110,7 +110,7 @@ inline void ParScanClosure::do_oop_work(T* p,
if (TraceScavenge) { if (TraceScavenge) {
gclog_or_tty->print_cr("{%s %s ( " PTR_FORMAT " ) " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", gclog_or_tty->print_cr("{%s %s ( " PTR_FORMAT " ) " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
"forwarded ", "forwarded ",
new_obj->klass()->internal_name(), p, obj, new_obj, new_obj->size()); new_obj->klass()->internal_name(), p, (void *)obj, (void *)new_obj, new_obj->size());
} }
#endif #endif

View file

@ -333,7 +333,7 @@ oop PSPromotionManager::oop_promotion_failed(oop obj, markOop obj_mark) {
gclog_or_tty->print_cr("{%s %s 0x%x (%d)}", gclog_or_tty->print_cr("{%s %s 0x%x (%d)}",
"promotion-failure", "promotion-failure",
obj->klass()->internal_name(), obj->klass()->internal_name(),
obj, obj->size()); (void *)obj, obj->size());
} }
#endif #endif

View file

@ -126,7 +126,7 @@ class PSPromotionManager VALUE_OBJ_CLASS_SPEC {
oop* mask_chunked_array_oop(oop obj) { oop* mask_chunked_array_oop(oop obj) {
assert(!is_oop_masked((oop*) obj), "invariant"); assert(!is_oop_masked((oop*) obj), "invariant");
oop* ret = (oop*) ((uintptr_t)obj | PS_CHUNKED_ARRAY_OOP_MASK); oop* ret = (oop*) (cast_from_oop<uintptr_t>(obj) | PS_CHUNKED_ARRAY_OOP_MASK);
assert(is_oop_masked(ret), "invariant"); assert(is_oop_masked(ret), "invariant");
return ret; return ret;
} }

View file

@ -225,7 +225,7 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) {
if (TraceScavenge) { if (TraceScavenge) {
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring", PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring",
new_obj->klass()->internal_name(), o, new_obj, new_obj->size()); new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size());
} }
#endif #endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -81,7 +81,7 @@ inline void PSScavenge::copy_and_push_safe_barrier(PSPromotionManager* pm,
if (TraceScavenge && o->is_forwarded()) { if (TraceScavenge && o->is_forwarded()) {
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
"forwarding", "forwarding",
new_obj->klass()->internal_name(), o, new_obj, new_obj->size()); new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size());
} }
#endif #endif

View file

@ -215,7 +215,7 @@ void print_oop(oop value, outputStream* st) {
st->print_cr(" %s", buf); st->print_cr(" %s", buf);
} }
} else { } else {
st->print_cr(" " PTR_FORMAT, (intptr_t) value); st->print_cr(" " PTR_FORMAT, (void *)value);
} }
} }

View file

@ -1384,7 +1384,7 @@ void LinkResolver::resolve_dynamic_call(CallInfo& result,
THREAD); THREAD);
if (HAS_PENDING_EXCEPTION) { if (HAS_PENDING_EXCEPTION) {
if (TraceMethodHandles) { if (TraceMethodHandles) {
tty->print_cr("invokedynamic throws BSME for "INTPTR_FORMAT, PENDING_EXCEPTION); tty->print_cr("invokedynamic throws BSME for "INTPTR_FORMAT, (void *)PENDING_EXCEPTION);
PENDING_EXCEPTION->print(); PENDING_EXCEPTION->print();
} }
if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) { if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) {

View file

@ -150,11 +150,11 @@ public:
HEAP_INSPECTION_COLUMNS_DO(DECLARE_KLASS_SIZE_STATS_FIELD) HEAP_INSPECTION_COLUMNS_DO(DECLARE_KLASS_SIZE_STATS_FIELD)
static int count(oop x) { static int count(oop x) {
return (HeapWordSize * ((x) ? (x)->size() : 0)); return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0));
} }
static int count_array(objArrayOop x) { static int count_array(objArrayOop x) {
return (HeapWordSize * ((x) ? (x)->size() : 0)); return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0));
} }
template <class T> static int count(T* x) { template <class T> static int count(T* x) {

View file

@ -367,7 +367,7 @@ void ReferenceProcessor::enqueue_discovered_reflist(DiscoveredList& refs_list,
next_d = java_lang_ref_Reference::discovered(obj); next_d = java_lang_ref_Reference::discovered(obj);
if (TraceReferenceGC && PrintGCDetails) { if (TraceReferenceGC && PrintGCDetails) {
gclog_or_tty->print_cr(" obj " INTPTR_FORMAT "/next_d " INTPTR_FORMAT, gclog_or_tty->print_cr(" obj " INTPTR_FORMAT "/next_d " INTPTR_FORMAT,
obj, next_d); (void *)obj, (void *)next_d);
} }
assert(java_lang_ref_Reference::next(obj) == NULL, assert(java_lang_ref_Reference::next(obj) == NULL,
"Reference not active; should not be discovered"); "Reference not active; should not be discovered");
@ -392,7 +392,7 @@ void ReferenceProcessor::enqueue_discovered_reflist(DiscoveredList& refs_list,
next_d = java_lang_ref_Reference::discovered(obj); next_d = java_lang_ref_Reference::discovered(obj);
if (TraceReferenceGC && PrintGCDetails) { if (TraceReferenceGC && PrintGCDetails) {
gclog_or_tty->print_cr(" obj " INTPTR_FORMAT "/next_d " INTPTR_FORMAT, gclog_or_tty->print_cr(" obj " INTPTR_FORMAT "/next_d " INTPTR_FORMAT,
obj, next_d); (void *)obj, (void *)next_d);
} }
assert(java_lang_ref_Reference::next(obj) == NULL, assert(java_lang_ref_Reference::next(obj) == NULL,
"The reference should not be enqueued"); "The reference should not be enqueued");
@ -562,7 +562,7 @@ ReferenceProcessor::process_phase1(DiscoveredList& refs_list,
!policy->should_clear_reference(iter.obj(), _soft_ref_timestamp_clock)) { !policy->should_clear_reference(iter.obj(), _soft_ref_timestamp_clock)) {
if (TraceReferenceGC) { if (TraceReferenceGC) {
gclog_or_tty->print_cr("Dropping reference (" INTPTR_FORMAT ": %s" ") by policy", gclog_or_tty->print_cr("Dropping reference (" INTPTR_FORMAT ": %s" ") by policy",
iter.obj(), iter.obj()->klass()->internal_name()); (void *)iter.obj(), iter.obj()->klass()->internal_name());
} }
// Remove Reference object from list // Remove Reference object from list
iter.remove(); iter.remove();
@ -601,7 +601,7 @@ ReferenceProcessor::pp2_work(DiscoveredList& refs_list,
if (iter.is_referent_alive()) { if (iter.is_referent_alive()) {
if (TraceReferenceGC) { if (TraceReferenceGC) {
gclog_or_tty->print_cr("Dropping strongly reachable reference (" INTPTR_FORMAT ": %s)", gclog_or_tty->print_cr("Dropping strongly reachable reference (" INTPTR_FORMAT ": %s)",
iter.obj(), iter.obj()->klass()->internal_name()); (void *)iter.obj(), iter.obj()->klass()->internal_name());
} }
// The referent is reachable after all. // The referent is reachable after all.
// Remove Reference object from list. // Remove Reference object from list.
@ -687,7 +687,7 @@ ReferenceProcessor::process_phase3(DiscoveredList& refs_list,
if (TraceReferenceGC) { if (TraceReferenceGC) {
gclog_or_tty->print_cr("Adding %sreference (" INTPTR_FORMAT ": %s) as pending", gclog_or_tty->print_cr("Adding %sreference (" INTPTR_FORMAT ": %s) as pending",
clear_referent ? "cleared " : "", clear_referent ? "cleared " : "",
iter.obj(), iter.obj()->klass()->internal_name()); (void *)iter.obj(), iter.obj()->klass()->internal_name());
} }
assert(iter.obj()->is_oop(UseConcMarkSweepGC), "Adding a bad reference"); assert(iter.obj()->is_oop(UseConcMarkSweepGC), "Adding a bad reference");
iter.next(); iter.next();
@ -1003,7 +1003,7 @@ void ReferenceProcessor::clean_up_discovered_reflist(DiscoveredList& refs_list)
gclog_or_tty->print_cr("clean_up_discovered_list: Dropping Reference: " gclog_or_tty->print_cr("clean_up_discovered_list: Dropping Reference: "
INTPTR_FORMAT " with next field: " INTPTR_FORMAT INTPTR_FORMAT " with next field: " INTPTR_FORMAT
" and referent: " INTPTR_FORMAT, " and referent: " INTPTR_FORMAT,
iter.obj(), next, iter.referent()); (void *)iter.obj(), (void *)next, (void *)iter.referent());
} }
) )
// Remove Reference object from list // Remove Reference object from list
@ -1103,14 +1103,14 @@ ReferenceProcessor::add_to_discovered_list_mt(DiscoveredList& refs_list,
if (TraceReferenceGC) { if (TraceReferenceGC) {
gclog_or_tty->print_cr("Discovered reference (mt) (" INTPTR_FORMAT ": %s)", gclog_or_tty->print_cr("Discovered reference (mt) (" INTPTR_FORMAT ": %s)",
obj, obj->klass()->internal_name()); (void *)obj, obj->klass()->internal_name());
} }
} else { } else {
// If retest was non NULL, another thread beat us to it: // If retest was non NULL, another thread beat us to it:
// The reference has already been discovered... // The reference has already been discovered...
if (TraceReferenceGC) { if (TraceReferenceGC) {
gclog_or_tty->print_cr("Already discovered reference (" INTPTR_FORMAT ": %s)", gclog_or_tty->print_cr("Already discovered reference (" INTPTR_FORMAT ": %s)",
obj, obj->klass()->internal_name()); (void *)obj, obj->klass()->internal_name());
} }
} }
} }
@ -1125,7 +1125,7 @@ void ReferenceProcessor::verify_referent(oop obj) {
assert(da ? referent->is_oop() : referent->is_oop_or_null(), assert(da ? referent->is_oop() : referent->is_oop_or_null(),
err_msg("Bad referent " INTPTR_FORMAT " found in Reference " err_msg("Bad referent " INTPTR_FORMAT " found in Reference "
INTPTR_FORMAT " during %satomic discovery ", INTPTR_FORMAT " during %satomic discovery ",
(intptr_t)referent, (intptr_t)obj, da ? "" : "non-")); (void *)referent, (void *)obj, da ? "" : "non-"));
} }
#endif #endif
@ -1205,7 +1205,7 @@ bool ReferenceProcessor::discover_reference(oop obj, ReferenceType rt) {
// The reference has already been discovered... // The reference has already been discovered...
if (TraceReferenceGC) { if (TraceReferenceGC) {
gclog_or_tty->print_cr("Already discovered reference (" INTPTR_FORMAT ": %s)", gclog_or_tty->print_cr("Already discovered reference (" INTPTR_FORMAT ": %s)",
obj, obj->klass()->internal_name()); (void *)obj, obj->klass()->internal_name());
} }
if (RefDiscoveryPolicy == ReferentBasedDiscovery) { if (RefDiscoveryPolicy == ReferentBasedDiscovery) {
// assumes that an object is not processed twice; // assumes that an object is not processed twice;
@ -1273,7 +1273,7 @@ bool ReferenceProcessor::discover_reference(oop obj, ReferenceType rt) {
if (TraceReferenceGC) { if (TraceReferenceGC) {
gclog_or_tty->print_cr("Discovered reference (" INTPTR_FORMAT ": %s)", gclog_or_tty->print_cr("Discovered reference (" INTPTR_FORMAT ": %s)",
obj, obj->klass()->internal_name()); (void *)obj, obj->klass()->internal_name());
} }
} }
assert(obj->is_oop(), "Discovered a bad reference"); assert(obj->is_oop(), "Discovered a bad reference");
@ -1372,7 +1372,7 @@ ReferenceProcessor::preclean_discovered_reflist(DiscoveredList& refs_list,
// active; we need to trace and mark its cohort. // active; we need to trace and mark its cohort.
if (TraceReferenceGC) { if (TraceReferenceGC) {
gclog_or_tty->print_cr("Precleaning Reference (" INTPTR_FORMAT ": %s)", gclog_or_tty->print_cr("Precleaning Reference (" INTPTR_FORMAT ": %s)",
iter.obj(), iter.obj()->klass()->internal_name()); (void *)iter.obj(), iter.obj()->klass()->internal_name());
} }
// Remove Reference object from list // Remove Reference object from list
iter.remove(); iter.remove();

View file

@ -1918,7 +1918,7 @@ void ConstantPool::print_on(outputStream* st) const {
st->print_cr(" - holder: " INTPTR_FORMAT, pool_holder()); st->print_cr(" - holder: " INTPTR_FORMAT, pool_holder());
} }
st->print_cr(" - cache: " INTPTR_FORMAT, cache()); st->print_cr(" - cache: " INTPTR_FORMAT, cache());
st->print_cr(" - resolved_references: " INTPTR_FORMAT, resolved_references()); st->print_cr(" - resolved_references: " INTPTR_FORMAT, (void *)resolved_references());
st->print_cr(" - reference_map: " INTPTR_FORMAT, reference_map()); st->print_cr(" - reference_map: " INTPTR_FORMAT, reference_map());
for (int index = 1; index < length(); index++) { // Index 0 is unused for (int index = 1; index < length(); index++) { // Index 0 is unused

View file

@ -306,8 +306,8 @@ void ConstantPoolCacheEntry::set_method_handle_common(constantPoolHandle cpool,
if (TraceInvokeDynamic) { if (TraceInvokeDynamic) {
tty->print_cr("set_method_handle bc=%d appendix="PTR_FORMAT"%s method_type="PTR_FORMAT"%s method="PTR_FORMAT" ", tty->print_cr("set_method_handle bc=%d appendix="PTR_FORMAT"%s method_type="PTR_FORMAT"%s method="PTR_FORMAT" ",
invoke_code, invoke_code,
(intptr_t)appendix(), (has_appendix ? "" : " (unused)"), (void *)appendix(), (has_appendix ? "" : " (unused)"),
(intptr_t)method_type(), (has_method_type ? "" : " (unused)"), (void *)method_type(), (has_method_type ? "" : " (unused)"),
(intptr_t)adapter()); (intptr_t)adapter());
adapter->print(); adapter->print();
if (has_appendix) appendix()->print(); if (has_appendix) appendix()->print();

View file

@ -106,7 +106,7 @@ HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__end,
len = name->utf8_length(); \ len = name->utf8_length(); \
} \ } \
HS_DTRACE_PROBE4(hotspot, class__initialization__##type, \ HS_DTRACE_PROBE4(hotspot, class__initialization__##type, \
data, len, (clss)->class_loader(), thread_type); \ data, len, SOLARIS_ONLY((void *))(clss)->class_loader(), thread_type); \
} }
#define DTRACE_CLASSINIT_PROBE_WAIT(type, clss, thread_type, wait) \ #define DTRACE_CLASSINIT_PROBE_WAIT(type, clss, thread_type, wait) \
@ -119,7 +119,7 @@ HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__end,
len = name->utf8_length(); \ len = name->utf8_length(); \
} \ } \
HS_DTRACE_PROBE5(hotspot, class__initialization__##type, \ HS_DTRACE_PROBE5(hotspot, class__initialization__##type, \
data, len, (clss)->class_loader(), thread_type, wait); \ data, len, SOLARIS_ONLY((void *))(clss)->class_loader(), thread_type, wait); \
} }
#else /* USDT2 */ #else /* USDT2 */
@ -2303,7 +2303,7 @@ void InstanceKlass::set_source_debug_extension(char* array, int length) {
} }
address InstanceKlass::static_field_addr(int offset) { address InstanceKlass::static_field_addr(int offset) {
return (address)(offset + InstanceMirrorKlass::offset_of_static_fields() + (intptr_t)java_mirror()); return (address)(offset + InstanceMirrorKlass::offset_of_static_fields() + cast_from_oop<intptr_t>(java_mirror()));
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -66,7 +66,7 @@ class InstanceMirrorKlass: public InstanceKlass {
// Static field offset is an offset into the Heap, should be converted by // Static field offset is an offset into the Heap, should be converted by
// based on UseCompressedOop for traversal // based on UseCompressedOop for traversal
static HeapWord* start_of_static_fields(oop obj) { static HeapWord* start_of_static_fields(oop obj) {
return (HeapWord*)((intptr_t)obj + offset_of_static_fields()); return (HeapWord*)(cast_from_oop<intptr_t>(obj) + offset_of_static_fields());
} }
static void init_offset_of_static_fields() { static void init_offset_of_static_fields() {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -51,7 +51,7 @@ void specialized_oop_follow_contents(InstanceRefKlass* ref, oop obj) {
T heap_oop = oopDesc::load_heap_oop(referent_addr); T heap_oop = oopDesc::load_heap_oop(referent_addr);
debug_only( debug_only(
if(TraceReferenceGC && PrintGCDetails) { if(TraceReferenceGC && PrintGCDetails) {
gclog_or_tty->print_cr("InstanceRefKlass::oop_follow_contents " INTPTR_FORMAT, obj); gclog_or_tty->print_cr("InstanceRefKlass::oop_follow_contents " INTPTR_FORMAT, (void *)obj);
} }
) )
if (!oopDesc::is_null(heap_oop)) { if (!oopDesc::is_null(heap_oop)) {
@ -62,7 +62,7 @@ void specialized_oop_follow_contents(InstanceRefKlass* ref, oop obj) {
ref->InstanceKlass::oop_follow_contents(obj); ref->InstanceKlass::oop_follow_contents(obj);
debug_only( debug_only(
if(TraceReferenceGC && PrintGCDetails) { if(TraceReferenceGC && PrintGCDetails) {
gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, obj); gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, (void *)obj);
} }
) )
return; return;
@ -70,7 +70,7 @@ void specialized_oop_follow_contents(InstanceRefKlass* ref, oop obj) {
// treat referent as normal oop // treat referent as normal oop
debug_only( debug_only(
if(TraceReferenceGC && PrintGCDetails) { if(TraceReferenceGC && PrintGCDetails) {
gclog_or_tty->print_cr(" Non NULL normal " INTPTR_FORMAT, obj); gclog_or_tty->print_cr(" Non NULL normal " INTPTR_FORMAT, (void *)obj);
} }
) )
MarkSweep::mark_and_push(referent_addr); MarkSweep::mark_and_push(referent_addr);
@ -130,7 +130,7 @@ void specialized_oop_follow_contents(InstanceRefKlass* ref,
T heap_oop = oopDesc::load_heap_oop(referent_addr); T heap_oop = oopDesc::load_heap_oop(referent_addr);
debug_only( debug_only(
if(TraceReferenceGC && PrintGCDetails) { if(TraceReferenceGC && PrintGCDetails) {
gclog_or_tty->print_cr("InstanceRefKlass::oop_follow_contents " INTPTR_FORMAT, obj); gclog_or_tty->print_cr("InstanceRefKlass::oop_follow_contents " INTPTR_FORMAT, (void *)obj);
} }
) )
if (!oopDesc::is_null(heap_oop)) { if (!oopDesc::is_null(heap_oop)) {
@ -142,7 +142,7 @@ void specialized_oop_follow_contents(InstanceRefKlass* ref,
ref->InstanceKlass::oop_follow_contents(cm, obj); ref->InstanceKlass::oop_follow_contents(cm, obj);
debug_only( debug_only(
if(TraceReferenceGC && PrintGCDetails) { if(TraceReferenceGC && PrintGCDetails) {
gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, obj); gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, (void *)obj);
} }
) )
return; return;
@ -150,7 +150,7 @@ void specialized_oop_follow_contents(InstanceRefKlass* ref,
// treat referent as normal oop // treat referent as normal oop
debug_only( debug_only(
if(TraceReferenceGC && PrintGCDetails) { if(TraceReferenceGC && PrintGCDetails) {
gclog_or_tty->print_cr(" Non NULL normal " INTPTR_FORMAT, obj); gclog_or_tty->print_cr(" Non NULL normal " INTPTR_FORMAT, (void *)obj);
} }
) )
PSParallelCompact::mark_and_push(cm, referent_addr); PSParallelCompact::mark_and_push(cm, referent_addr);

View file

@ -333,10 +333,10 @@ protected:
return (int)data()->cell_at(index); return (int)data()->cell_at(index);
} }
void set_oop_at(int index, oop value) { void set_oop_at(int index, oop value) {
set_intptr_at(index, (intptr_t) value); set_intptr_at(index, cast_from_oop<intptr_t>(value));
} }
oop oop_at(int index) { oop oop_at(int index) {
return (oop)intptr_at(index); return cast_to_oop(intptr_at(index));
} }
void set_flag_at(int flag_number) { void set_flag_at(int flag_number) {

View file

@ -183,7 +183,7 @@ inline bool oopDesc::is_null(narrowOop obj) { return obj == 0; }
// in inner GC loops so these are separated. // in inner GC loops so these are separated.
inline bool check_obj_alignment(oop obj) { inline bool check_obj_alignment(oop obj) {
return (intptr_t)obj % MinObjAlignmentInBytes == 0; return cast_from_oop<intptr_t>(obj) % MinObjAlignmentInBytes == 0;
} }
inline narrowOop oopDesc::encode_heap_oop_not_null(oop v) { inline narrowOop oopDesc::encode_heap_oop_not_null(oop v) {

View file

@ -55,11 +55,16 @@ typedef class typeArrayOopDesc* typeArrayOop;
// to and from the underlying oopDesc pointer type. // to and from the underlying oopDesc pointer type.
// //
// Because oop and its subclasses <type>Oop are class types, arbitrary // Because oop and its subclasses <type>Oop are class types, arbitrary
// conversions are not accepted by the compiler, and you may get a message // conversions are not accepted by the compiler. Applying a cast to
// about overloading ambiguity (between long and int is common when converting // an oop will cause the best matched conversion operator to be
// from a constant in 64 bit mode), or unable to convert from type to 'oop'. // invoked returning the underlying oopDesc* type if appropriate.
// Applying a cast to one of these conversion operators first will get to the // No copy constructors, explicit user conversions or operators of
// underlying oopDesc* type if appropriate. // numerical type should be defined within the oop class. Most C++
// compilers will issue a compile time error concerning the overloading
// ambiguity between operators of numerical and pointer types. If
// a conversion to or from an oop to a numerical type is needed,
// use the inline template methods, cast_*_oop, defined below.
//
// Converting NULL to oop to Handle implicit is no longer accepted by the // Converting NULL to oop to Handle implicit is no longer accepted by the
// compiler because there are too many steps in the conversion. Use Handle() // compiler because there are too many steps in the conversion. Use Handle()
// instead, which generates less code anyway. // instead, which generates less code anyway.
@ -83,12 +88,9 @@ public:
void raw_set_obj(const void* p) { _o = (oopDesc*)p; } void raw_set_obj(const void* p) { _o = (oopDesc*)p; }
oop() { set_obj(NULL); } oop() { set_obj(NULL); }
oop(const oop& o) { set_obj(o.obj()); }
oop(const volatile oop& o) { set_obj(o.obj()); } oop(const volatile oop& o) { set_obj(o.obj()); }
oop(const void* p) { set_obj(p); } oop(const void* p) { set_obj(p); }
oop(intptr_t i) { set_obj((void *)i); }
#ifdef _LP64
oop(int i) { set_obj((void *)i); }
#endif
~oop() { ~oop() {
if (CheckUnhandledOops) unregister_oop(); if (CheckUnhandledOops) unregister_oop();
} }
@ -101,8 +103,6 @@ public:
bool operator==(void *p) const { return obj() == p; } bool operator==(void *p) const { return obj() == p; }
bool operator!=(const volatile oop o) const { return obj() != o.obj(); } bool operator!=(const volatile oop o) const { return obj() != o.obj(); }
bool operator!=(void *p) const { return obj() != p; } bool operator!=(void *p) const { return obj() != p; }
bool operator==(intptr_t p) const { return obj() == (oopDesc*)p; }
bool operator!=(intptr_t p) const { return obj() != (oopDesc*)p; }
bool operator<(oop o) const { return obj() < o.obj(); } bool operator<(oop o) const { return obj() < o.obj(); }
bool operator>(oop o) const { return obj() > o.obj(); } bool operator>(oop o) const { return obj() > o.obj(); }
@ -110,8 +110,18 @@ public:
bool operator>=(oop o) const { return obj() >= o.obj(); } bool operator>=(oop o) const { return obj() >= o.obj(); }
bool operator!() const { return !obj(); } bool operator!() const { return !obj(); }
// Cast // Assignment
oop& operator=(const oop& o) { _o = o.obj(); return *this; }
#ifndef SOLARIS
volatile oop& operator=(const oop& o) volatile { _o = o.obj(); return *this; }
#endif
volatile oop& operator=(const volatile oop& o) volatile { _o = o.obj(); return *this; }
// Explict user conversions
operator void* () const { return (void *)obj(); } operator void* () const { return (void *)obj(); }
#ifndef SOLARIS
operator void* () const volatile { return (void *)obj(); }
#endif
operator HeapWord* () const { return (HeapWord*)obj(); } operator HeapWord* () const { return (HeapWord*)obj(); }
operator oopDesc* () const { return obj(); } operator oopDesc* () const { return obj(); }
operator intptr_t* () const { return (intptr_t*)obj(); } operator intptr_t* () const { return (intptr_t*)obj(); }
@ -119,7 +129,6 @@ public:
operator markOop () const { return markOop(obj()); } operator markOop () const { return markOop(obj()); }
operator address () const { return (address)obj(); } operator address () const { return (address)obj(); }
operator intptr_t () const volatile { return (intptr_t)obj(); }
// from javaCalls.cpp // from javaCalls.cpp
operator jobject () const { return (jobject)obj(); } operator jobject () const { return (jobject)obj(); }
@ -141,12 +150,26 @@ public:
class type##Oop : public oop { \ class type##Oop : public oop { \
public: \ public: \
type##Oop() : oop() {} \ type##Oop() : oop() {} \
type##Oop(const oop& o) : oop(o) {} \
type##Oop(const volatile oop& o) : oop(o) {} \ type##Oop(const volatile oop& o) : oop(o) {} \
type##Oop(const void* p) : oop(p) {} \ type##Oop(const void* p) : oop(p) {} \
operator type##OopDesc* () const { return (type##OopDesc*)obj(); } \ operator type##OopDesc* () const { return (type##OopDesc*)obj(); } \
type##OopDesc* operator->() const { \ type##OopDesc* operator->() const { \
return (type##OopDesc*)obj(); \ return (type##OopDesc*)obj(); \
} \ } \
type##Oop& operator=(const type##Oop& o) { \
oop::operator=(o); \
return *this; \
} \
NOT_SOLARIS( \
volatile type##Oop& operator=(const type##Oop& o) volatile { \
(void)const_cast<oop&>(oop::operator=(o)); \
return *this; \
}) \
volatile type##Oop& operator=(const volatile type##Oop& o) volatile {\
(void)const_cast<oop&>(oop::operator=(o)); \
return *this; \
} \
}; };
DEF_OOP(instance); DEF_OOP(instance);
@ -156,6 +179,16 @@ DEF_OOP(typeArray);
#endif // CHECK_UNHANDLED_OOPS #endif // CHECK_UNHANDLED_OOPS
// For CHECK_UNHANDLED_OOPS, it is ambiguous C++ behavior to have the oop
// structure contain explicit user defined conversions of both numerical
// and pointer type. Define inline methods to provide the numerical conversions.
template <class T> inline oop cast_to_oop(T value) {
return (oop)(CHECK_UNHANDLED_OOPS_ONLY((void *))(value));
}
template <class T> inline T cast_from_oop(oop o) {
return (T)(CHECK_UNHANDLED_OOPS_ONLY((void*))o);
}
// The metadata hierarchy is separate from the oop hierarchy // The metadata hierarchy is separate from the oop hierarchy
// class MetaspaceObj // class MetaspaceObj

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -341,7 +341,7 @@ const class TypePtr *MachNode::adr_type() const {
return TypePtr::BOTTOM; return TypePtr::BOTTOM;
} }
// %%% make offset be intptr_t // %%% make offset be intptr_t
assert(!Universe::heap()->is_in_reserved((oop)offset), "must be a raw ptr"); assert(!Universe::heap()->is_in_reserved(cast_to_oop(offset)), "must be a raw ptr");
return TypeRawPtr::BOTTOM; return TypeRawPtr::BOTTOM;
} }

View file

@ -165,7 +165,7 @@ class JvmtiTagHashmap : public CHeapObj<mtInternal> {
static unsigned int hash(oop key, int size) { static unsigned int hash(oop key, int size) {
// shift right to get better distribution (as these bits will be zero // shift right to get better distribution (as these bits will be zero
// with aligned addresses) // with aligned addresses)
unsigned int addr = (unsigned int)((intptr_t)key); unsigned int addr = (unsigned int)(cast_from_oop<intptr_t>(key));
#ifdef _LP64 #ifdef _LP64
return (addr >> 3) % size; return (addr >> 3) % size;
#else #else

View file

@ -292,9 +292,9 @@ UNSAFE_ENTRY(jobject, Unsafe_GetObjectVolatile(JNIEnv *env, jobject unsafe, jobj
volatile oop v; volatile oop v;
if (UseCompressedOops) { if (UseCompressedOops) {
volatile narrowOop n = *(volatile narrowOop*) addr; volatile narrowOop n = *(volatile narrowOop*) addr;
v = oopDesc::decode_heap_oop(n); (void)const_cast<oop&>(v = oopDesc::decode_heap_oop(n));
} else { } else {
v = *(volatile oop*) addr; (void)const_cast<oop&>(v = *(volatile oop*) addr);
} }
OrderAccess::acquire(); OrderAccess::acquire();
return JNIHandles::make_local(env, v); return JNIHandles::make_local(env, v);
@ -1222,9 +1222,9 @@ UNSAFE_ENTRY(void, Unsafe_Park(JNIEnv *env, jobject unsafe, jboolean isAbsolute,
#endif /* USDT2 */ #endif /* USDT2 */
if (event.should_commit()) { if (event.should_commit()) {
oop obj = thread->current_park_blocker(); oop obj = thread->current_park_blocker();
event.set_klass(obj ? obj->klass() : NULL); event.set_klass((obj != NULL) ? obj->klass() : NULL);
event.set_timeout(time); event.set_timeout(time);
event.set_address(obj ? (TYPE_ADDRESS) (uintptr_t) obj : 0); event.set_address((obj != NULL) ? (TYPE_ADDRESS) cast_from_oop<uintptr_t>(obj) : 0);
event.commit(); event.commit();
} }
UNSAFE_END UNSAFE_END

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -161,7 +161,7 @@ static BiasedLocking::Condition revoke_bias(oop obj, bool allow_rebias, bool is_
if (TraceBiasedLocking && (Verbose || !is_bulk)) { if (TraceBiasedLocking && (Verbose || !is_bulk)) {
ResourceMark rm; ResourceMark rm;
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, 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,
(intptr_t) obj, (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread); (void *)obj, (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread);
} }
JavaThread* biased_thread = mark->biased_locker(); JavaThread* biased_thread = mark->biased_locker();
@ -214,8 +214,8 @@ static BiasedLocking::Condition revoke_bias(oop obj, bool allow_rebias, bool is_
if (mon_info->owner() == obj) { if (mon_info->owner() == obj) {
if (TraceBiasedLocking && Verbose) { if (TraceBiasedLocking && Verbose) {
tty->print_cr(" mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")", tty->print_cr(" mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")",
(intptr_t) mon_info->owner(), (void *) mon_info->owner(),
(intptr_t) obj); (void *) obj);
} }
// Assume recursive case and fix up highest lock later // Assume recursive case and fix up highest lock later
markOop mark = markOopDesc::encode((BasicLock*) NULL); markOop mark = markOopDesc::encode((BasicLock*) NULL);
@ -224,8 +224,8 @@ static BiasedLocking::Condition revoke_bias(oop obj, bool allow_rebias, bool is_
} else { } else {
if (TraceBiasedLocking && Verbose) { if (TraceBiasedLocking && Verbose) {
tty->print_cr(" mon_info->owner (" PTR_FORMAT ") != obj (" PTR_FORMAT ")", tty->print_cr(" mon_info->owner (" PTR_FORMAT ") != obj (" PTR_FORMAT ")",
(intptr_t) mon_info->owner(), (void *) mon_info->owner(),
(intptr_t) obj); (void *) obj);
} }
} }
} }
@ -326,7 +326,7 @@ static BiasedLocking::Condition bulk_revoke_or_rebias_at_safepoint(oop o,
tty->print_cr("* Beginning bulk revocation (kind == %s) because of object " tty->print_cr("* Beginning bulk revocation (kind == %s) because of object "
INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s", INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
(bulk_rebias ? "rebias" : "revoke"), (bulk_rebias ? "rebias" : "revoke"),
(intptr_t) o, (intptr_t) o->mark(), o->klass()->external_name()); (void *) o, (intptr_t) o->mark(), o->klass()->external_name());
} }
jlong cur_time = os::javaTimeMillis(); jlong cur_time = os::javaTimeMillis();

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -234,7 +234,7 @@ Deoptimization::UnrollBlock* Deoptimization::fetch_unroll_info_helper(JavaThread
assert(Universe::heap()->is_in_or_null(result), "must be heap pointer"); assert(Universe::heap()->is_in_or_null(result), "must be heap pointer");
if (TraceDeoptimization) { if (TraceDeoptimization) {
ttyLocker ttyl; ttyLocker ttyl;
tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, result, thread); tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, (void *)result, thread);
} }
} }
bool reallocated = false; bool reallocated = false;
@ -278,7 +278,7 @@ Deoptimization::UnrollBlock* Deoptimization::fetch_unroll_info_helper(JavaThread
first = false; first = false;
tty->print_cr("RELOCK OBJECTS in thread " INTPTR_FORMAT, thread); tty->print_cr("RELOCK OBJECTS in thread " INTPTR_FORMAT, thread);
} }
tty->print_cr(" object <" INTPTR_FORMAT "> locked", mi->owner()); tty->print_cr(" object <" INTPTR_FORMAT "> locked", (void *)mi->owner());
} }
} }
} }
@ -977,7 +977,7 @@ void Deoptimization::print_objects(GrowableArray<ScopeValue*>* objects) {
KlassHandle k(java_lang_Class::as_Klass(sv->klass()->as_ConstantOopReadValue()->value()())); KlassHandle k(java_lang_Class::as_Klass(sv->klass()->as_ConstantOopReadValue()->value()()));
Handle obj = sv->value(); Handle obj = sv->value();
tty->print(" object <" INTPTR_FORMAT "> of type ", sv->value()()); tty->print(" object <" INTPTR_FORMAT "> of type ", (void *)sv->value()());
k->print_value(); k->print_value();
tty->print(" allocated (%d bytes)", obj->size() * HeapWordSize); tty->print(" allocated (%d bytes)", obj->size() * HeapWordSize);
tty->cr(); tty->cr();

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1097,7 +1097,7 @@ oop frame::retrieve_receiver(RegisterMap* reg_map) {
return NULL; return NULL;
} }
oop r = *oop_adr; oop r = *oop_adr;
assert(Universe::heap()->is_in_or_null(r), err_msg("bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", (intptr_t) r, (intptr_t) r)); assert(Universe::heap()->is_in_or_null(r), err_msg("bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", (void *) r, (void *) r));
return r; return r;
} }
@ -1228,9 +1228,7 @@ void frame::check_derived_oop(oop* base, oop* derived) {
void frame::ZapDeadClosure::do_oop(oop* p) { void frame::ZapDeadClosure::do_oop(oop* p) {
if (TraceZapDeadLocals) tty->print_cr("zapping @ " INTPTR_FORMAT " containing " INTPTR_FORMAT, p, (address)*p); if (TraceZapDeadLocals) tty->print_cr("zapping @ " INTPTR_FORMAT " containing " INTPTR_FORMAT, p, (address)*p);
// Need cast because on _LP64 the conversion to oop is ambiguous. Constant *p = cast_to_oop<intptr_t>(0xbabebabe);
// can be either long or int.
*p = (oop)(int)0xbabebabe;
} }
frame::ZapDeadClosure frame::_zap_dead; frame::ZapDeadClosure frame::_zap_dead;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -430,7 +430,7 @@ intptr_t* JavaCallArguments::parameters() {
for(int i = 0; i < _size; i++) { for(int i = 0; i < _size; i++) {
if (_is_oop[i]) { if (_is_oop[i]) {
// Handle conversion // Handle conversion
_value[i] = (intptr_t)Handle::raw_resolve((oop *)_value[i]); _value[i] = cast_from_oop<intptr_t>(Handle::raw_resolve((oop *)_value[i]));
} }
} }
// Return argument vector // Return argument vector

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -745,14 +745,14 @@ void SafepointSynchronize::block(JavaThread *thread) {
#endif #endif
static void print_ptrs(intptr_t oldptr, intptr_t newptr, bool wasoop) { static void print_ptrs(intptr_t oldptr, intptr_t newptr, bool wasoop) {
bool is_oop = newptr ? ((oop)newptr)->is_oop() : false; bool is_oop = newptr ? (cast_to_oop(newptr))->is_oop() : false;
tty->print_cr(PTR_FORMAT PTR_PAD " %s %c " PTR_FORMAT PTR_PAD " %s %s", tty->print_cr(PTR_FORMAT PTR_PAD " %s %c " PTR_FORMAT PTR_PAD " %s %s",
oldptr, wasoop?"oop":" ", oldptr == newptr ? ' ' : '!', oldptr, wasoop?"oop":" ", oldptr == newptr ? ' ' : '!',
newptr, is_oop?"oop":" ", (wasoop && !is_oop) ? "STALE" : ((wasoop==false&&is_oop==false&&oldptr !=newptr)?"STOMP":" ")); newptr, is_oop?"oop":" ", (wasoop && !is_oop) ? "STALE" : ((wasoop==false&&is_oop==false&&oldptr !=newptr)?"STOMP":" "));
} }
static void print_longs(jlong oldptr, jlong newptr, bool wasoop) { static void print_longs(jlong oldptr, jlong newptr, bool wasoop) {
bool is_oop = newptr ? ((oop)(intptr_t)newptr)->is_oop() : false; bool is_oop = newptr ? (cast_to_oop(newptr))->is_oop() : false;
tty->print_cr(PTR64_FORMAT " %s %c " PTR64_FORMAT " %s %s", tty->print_cr(PTR64_FORMAT " %s %c " PTR64_FORMAT " %s %s",
oldptr, wasoop?"oop":" ", oldptr == newptr ? ' ' : '!', oldptr, wasoop?"oop":" ", oldptr == newptr ? ' ' : '!',
newptr, is_oop?"oop":" ", (wasoop && !is_oop) ? "STALE" : ((wasoop==false&&is_oop==false&&oldptr !=newptr)?"STOMP":" ")); newptr, is_oop?"oop":" ", (wasoop && !is_oop) ? "STALE" : ((wasoop==false&&is_oop==false&&oldptr !=newptr)?"STOMP":" "));

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -577,7 +577,7 @@ oop SharedRuntime::retrieve_receiver( Symbol* sig, frame caller ) {
assert(caller.is_interpreted_frame(), ""); assert(caller.is_interpreted_frame(), "");
int args_size = ArgumentSizeComputer(sig).size() + 1; int args_size = ArgumentSizeComputer(sig).size() + 1;
assert(args_size <= caller.interpreter_frame_expression_stack_size(), "receiver must be on interpreter stack"); assert(args_size <= caller.interpreter_frame_expression_stack_size(), "receiver must be on interpreter stack");
oop result = (oop) *caller.interpreter_frame_tos_at(args_size - 1); oop result = cast_to_oop(*caller.interpreter_frame_tos_at(args_size - 1));
assert(Universe::heap()->is_in(result) && result->is_oop(), "receiver must be an oop"); assert(Universe::heap()->is_in(result) && result->is_oop(), "receiver must be an oop");
return result; return result;
} }
@ -2872,7 +2872,7 @@ JRT_LEAF(intptr_t*, SharedRuntime::OSR_migration_begin( JavaThread *thread) )
ObjectSynchronizer::inflate_helper(kptr2->obj()); ObjectSynchronizer::inflate_helper(kptr2->obj());
// Now the displaced header is free to move // Now the displaced header is free to move
buf[i++] = (intptr_t)lock->displaced_header(); buf[i++] = (intptr_t)lock->displaced_header();
buf[i++] = (intptr_t)kptr2->obj(); buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
} }
} }
assert( i - max_locals == active_monitor_count*2, "found the expected number of monitors" ); assert( i - max_locals == active_monitor_count*2, "found the expected number of monitors" );

View file

@ -154,7 +154,7 @@ int ObjectSynchronizer::gOmInUseCount = 0;
static volatile intptr_t ListLock = 0 ; // protects global monitor free-list cache static volatile intptr_t ListLock = 0 ; // protects global monitor free-list cache
static volatile int MonitorFreeCount = 0 ; // # on gFreeList static volatile int MonitorFreeCount = 0 ; // # on gFreeList
static volatile int MonitorPopulation = 0 ; // # Extant -- in circulation static volatile int MonitorPopulation = 0 ; // # Extant -- in circulation
#define CHAINMARKER ((oop)-1) #define CHAINMARKER (cast_to_oop<intptr_t>(-1))
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Fast Monitor Enter/Exit // Fast Monitor Enter/Exit
@ -510,7 +510,7 @@ static markOop ReadStableMark (oop obj) {
// then for each thread on the list, set the flag and unpark() the thread. // then for each thread on the list, set the flag and unpark() the thread.
// This is conceptually similar to muxAcquire-muxRelease, except that muxRelease // This is conceptually similar to muxAcquire-muxRelease, except that muxRelease
// wakes at most one thread whereas we need to wake the entire list. // wakes at most one thread whereas we need to wake the entire list.
int ix = (intptr_t(obj) >> 5) & (NINFLATIONLOCKS-1) ; int ix = (cast_from_oop<intptr_t>(obj) >> 5) & (NINFLATIONLOCKS-1) ;
int YieldThenBlock = 0 ; int YieldThenBlock = 0 ;
assert (ix >= 0 && ix < NINFLATIONLOCKS, "invariant") ; assert (ix >= 0 && ix < NINFLATIONLOCKS, "invariant") ;
assert ((NINFLATIONLOCKS & (NINFLATIONLOCKS-1)) == 0, "invariant") ; assert ((NINFLATIONLOCKS & (NINFLATIONLOCKS-1)) == 0, "invariant") ;
@ -565,7 +565,7 @@ static inline intptr_t get_next_hash(Thread * Self, oop obj) {
// This variation has the property of being stable (idempotent) // This variation has the property of being stable (idempotent)
// between STW operations. This can be useful in some of the 1-0 // between STW operations. This can be useful in some of the 1-0
// synchronization schemes. // synchronization schemes.
intptr_t addrBits = intptr_t(obj) >> 3 ; intptr_t addrBits = cast_from_oop<intptr_t>(obj) >> 3 ;
value = addrBits ^ (addrBits >> 5) ^ GVars.stwRandom ; value = addrBits ^ (addrBits >> 5) ^ GVars.stwRandom ;
} else } else
if (hashCode == 2) { if (hashCode == 2) {
@ -575,7 +575,7 @@ static inline intptr_t get_next_hash(Thread * Self, oop obj) {
value = ++GVars.hcSequence ; value = ++GVars.hcSequence ;
} else } else
if (hashCode == 4) { if (hashCode == 4) {
value = intptr_t(obj) ; value = cast_from_oop<intptr_t>(obj) ;
} else { } else {
// Marsaglia's xor-shift scheme with thread-specific state // Marsaglia's xor-shift scheme with thread-specific state
// This is probably the best overall implementation -- we'll // This is probably the best overall implementation -- we'll
@ -1321,7 +1321,7 @@ ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
if (object->is_instance()) { if (object->is_instance()) {
ResourceMark rm; ResourceMark rm;
tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s", tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
(intptr_t) object, (intptr_t) object->mark(), (void *) object, (intptr_t) object->mark(),
object->klass()->external_name()); object->klass()->external_name());
} }
} }
@ -1371,7 +1371,7 @@ ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) {
if (object->is_instance()) { if (object->is_instance()) {
ResourceMark rm; ResourceMark rm;
tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s", tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
(intptr_t) object, (intptr_t) object->mark(), (void *) object, (intptr_t) object->mark(),
object->klass()->external_name()); object->klass()->external_name());
} }
} }
@ -1439,7 +1439,7 @@ bool ObjectSynchronizer::deflate_monitor(ObjectMonitor* mid, oop obj,
if (obj->is_instance()) { if (obj->is_instance()) {
ResourceMark rm; ResourceMark rm;
tty->print_cr("Deflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s", tty->print_cr("Deflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
(intptr_t) obj, (intptr_t) obj->mark(), obj->klass()->external_name()); (void *) obj, (intptr_t) obj->mark(), obj->klass()->external_name());
} }
} }

View file

@ -1444,7 +1444,7 @@ void JavaThread::initialize() {
_in_deopt_handler = 0; _in_deopt_handler = 0;
_doing_unsafe_access = false; _doing_unsafe_access = false;
_stack_guard_state = stack_guard_unused; _stack_guard_state = stack_guard_unused;
_exception_oop = NULL; (void)const_cast<oop&>(_exception_oop = NULL);
_exception_pc = 0; _exception_pc = 0;
_exception_handler_pc = 0; _exception_handler_pc = 0;
_is_method_handle_return = 0; _is_method_handle_return = 0;

View file

@ -1278,7 +1278,7 @@ class JavaThread: public Thread {
address exception_handler_pc() const { return _exception_handler_pc; } address exception_handler_pc() const { return _exception_handler_pc; }
bool is_method_handle_return() const { return _is_method_handle_return == 1; } bool is_method_handle_return() const { return _is_method_handle_return == 1; }
void set_exception_oop(oop o) { _exception_oop = o; } void set_exception_oop(oop o) { (void)const_cast<oop&>(_exception_oop = o); }
void set_exception_pc(address a) { _exception_pc = a; } void set_exception_pc(address a) { _exception_pc = a; }
void set_exception_handler_pc(address a) { _exception_handler_pc = a; } void set_exception_handler_pc(address a) { _exception_handler_pc = a; }
void set_is_method_handle_return(bool value) { _is_method_handle_return = value ? 1 : 0; } void set_is_method_handle_return(bool value) { _is_method_handle_return = value ? 1 : 0; }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -111,7 +111,7 @@ void vframeArrayElement::fill_in(compiledVFrame* vf) {
case T_OBJECT: case T_OBJECT:
assert(!value->obj_is_scalar_replaced(), "object should be reallocated already"); assert(!value->obj_is_scalar_replaced(), "object should be reallocated already");
// preserve object type // preserve object type
_locals->add( new StackValue((intptr_t) (value->get_obj()()), T_OBJECT )); _locals->add( new StackValue(cast_from_oop<intptr_t>((value->get_obj()())), T_OBJECT ));
break; break;
case T_CONFLICT: case T_CONFLICT:
// A dead local. Will be initialized to null/zero. // A dead local. Will be initialized to null/zero.
@ -136,7 +136,7 @@ void vframeArrayElement::fill_in(compiledVFrame* vf) {
case T_OBJECT: case T_OBJECT:
assert(!value->obj_is_scalar_replaced(), "object should be reallocated already"); assert(!value->obj_is_scalar_replaced(), "object should be reallocated already");
// preserve object type // preserve object type
_expressions->add( new StackValue((intptr_t) (value->get_obj()()), T_OBJECT )); _expressions->add( new StackValue(cast_from_oop<intptr_t>((value->get_obj()())), T_OBJECT ));
break; break;
case T_CONFLICT: case T_CONFLICT:
// A dead stack element. Will be initialized to null/zero. // A dead stack element. Will be initialized to null/zero.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,7 @@ HS_DTRACE_PROBE_DECL4(hotspot, class__unloaded, char*, int, oop, bool);
len = name->utf8_length(); \ len = name->utf8_length(); \
} \ } \
HS_DTRACE_PROBE4(hotspot, class__##type, \ HS_DTRACE_PROBE4(hotspot, class__##type, \
data, len, (clss)->class_loader(), (shared)); \ data, len, SOLARIS_ONLY((void *))(clss)->class_loader(), (shared)); \
} }
#else /* USDT2 */ #else /* USDT2 */

View file

@ -563,7 +563,7 @@ void DumpWriter::write_u8(u8 x) {
} }
void DumpWriter::write_objectID(oop o) { void DumpWriter::write_objectID(oop o) {
address a = (address)((uintptr_t)o); address a = (address)o;
#ifdef _LP64 #ifdef _LP64
write_u8((u8)a); write_u8((u8)a);
#else #else

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -45,7 +45,7 @@ HS_DTRACE_PROBE_DECL8(hotspot, mem__pool__gc__end, char*, int, char*, int,
MemoryManager::MemoryManager() { MemoryManager::MemoryManager() {
_num_pools = 0; _num_pools = 0;
_memory_mgr_obj = NULL; (void)const_cast<instanceOop&>(_memory_mgr_obj = NULL);
} }
void MemoryManager::add_pool(MemoryPool* pool) { void MemoryManager::add_pool(MemoryPool* pool) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -45,7 +45,7 @@ MemoryPool::MemoryPool(const char* name,
_name = name; _name = name;
_initial_size = init_size; _initial_size = init_size;
_max_size = max_size; _max_size = max_size;
_memory_pool_obj = NULL; (void)const_cast<instanceOop&>(_memory_pool_obj = NULL);
_available_for_allocation = true; _available_for_allocation = true;
_num_managers = 0; _num_managers = 0;
_type = type; _type = type;

View file

@ -967,9 +967,9 @@ const int badCodeHeapFreeVal = 0xDD; // value used to zap
// (These must be implemented as #defines because C++ compilers are // (These must be implemented as #defines because C++ compilers are
// not obligated to inline non-integral constants!) // not obligated to inline non-integral constants!)
#define badAddress ((address)::badAddressVal) #define badAddress ((address)::badAddressVal)
#define badOop ((oop)::badOopVal) #define badOop (cast_to_oop(::badOopVal))
#define badHeapWord (::badHeapWordVal) #define badHeapWord (::badHeapWordVal)
#define badJNIHandle ((oop)::badJNIHandleVal) #define badJNIHandle (cast_to_oop(::badJNIHandleVal))
// Default TaskQueue size is 16K (32-bit) or 128K (64-bit) // Default TaskQueue size is 16K (32-bit) or 128K (64-bit)
#define TASKQUEUE_SIZE (NOT_LP64(1<<14) LP64_ONLY(1<<17)) #define TASKQUEUE_SIZE (NOT_LP64(1<<14) LP64_ONLY(1<<17))

View file

@ -189,6 +189,10 @@ const jlong max_jlong = CONST64(0x7fffffffffffffff);
#pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union (needed in windows.h) #pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union (needed in windows.h)
#pragma warning( disable : 4511 ) // copy constructor could not be generated #pragma warning( disable : 4511 ) // copy constructor could not be generated
#pragma warning( disable : 4291 ) // no matching operator delete found; memory will not be freed if initialization thows an exception #pragma warning( disable : 4291 ) // no matching operator delete found; memory will not be freed if initialization thows an exception
#ifdef CHECK_UNHANDLED_OOPS
#pragma warning( disable : 4521 ) // class has multiple copy ctors of a single type
#pragma warning( disable : 4522 ) // class has multiple assignment operators of a single type
#endif // CHECK_UNHANDLED_OOPS
#if _MSC_VER >= 1400 #if _MSC_VER >= 1400
#pragma warning( disable : 4996 ) // unsafe string functions. Same as define _CRT_SECURE_NO_WARNINGS/_CRT_SECURE_NO_DEPRICATE #pragma warning( disable : 4996 ) // unsafe string functions. Same as define _CRT_SECURE_NO_WARNINGS/_CRT_SECURE_NO_DEPRICATE
#endif #endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -356,9 +356,9 @@ template class Hashtable<ConstantPool*, mtClass>;
template class Hashtable<Symbol*, mtSymbol>; template class Hashtable<Symbol*, mtSymbol>;
template class Hashtable<Klass*, mtClass>; template class Hashtable<Klass*, mtClass>;
template class Hashtable<oop, mtClass>; template class Hashtable<oop, mtClass>;
#ifdef SOLARIS #if defined(SOLARIS) || defined(CHECK_UNHANDLED_OOPS)
template class Hashtable<oop, mtSymbol>; template class Hashtable<oop, mtSymbol>;
#endif #endif // SOLARIS || CHECK_UNHANDLED_OOPS
template class Hashtable<oopDesc*, mtSymbol>; template class Hashtable<oopDesc*, mtSymbol>;
template class Hashtable<Symbol*, mtClass>; template class Hashtable<Symbol*, mtClass>;
template class HashtableEntry<Symbol*, mtSymbol>; template class HashtableEntry<Symbol*, mtSymbol>;

View file

@ -322,11 +322,11 @@ public:
// Attempts to claim a task from the "local" end of the queue (the most // Attempts to claim a task from the "local" end of the queue (the most
// recently pushed). If successful, returns true and sets t to the task; // recently pushed). If successful, returns true and sets t to the task;
// otherwise, returns false (the queue is empty). // otherwise, returns false (the queue is empty).
inline bool pop_local(E& t); inline bool pop_local(volatile E& t);
// Like pop_local(), but uses the "global" end of the queue (the least // Like pop_local(), but uses the "global" end of the queue (the least
// recently pushed). // recently pushed).
bool pop_global(E& t); bool pop_global(volatile E& t);
// Delete any resource associated with the queue. // Delete any resource associated with the queue.
~GenericTaskQueue(); ~GenericTaskQueue();
@ -424,7 +424,7 @@ bool GenericTaskQueue<E, F, N>::pop_local_slow(uint localBot, Age oldAge) {
} }
template<class E, MEMFLAGS F, unsigned int N> template<class E, MEMFLAGS F, unsigned int N>
bool GenericTaskQueue<E, F, N>::pop_global(E& t) { bool GenericTaskQueue<E, F, N>::pop_global(volatile E& t) {
Age oldAge = _age.get(); Age oldAge = _age.get();
// Architectures with weak memory model require a barrier here // Architectures with weak memory model require a barrier here
// to guarantee that bottom is not older than age, // to guarantee that bottom is not older than age,
@ -701,7 +701,7 @@ GenericTaskQueue<E, F, N>::push(E t) {
} }
template<class E, MEMFLAGS F, unsigned int N> inline bool template<class E, MEMFLAGS F, unsigned int N> inline bool
GenericTaskQueue<E, F, N>::pop_local(E& t) { GenericTaskQueue<E, F, N>::pop_local(volatile E& t) {
uint localBot = _bottom; uint localBot = _bottom;
// This value cannot be N-1. That can only occur as a result of // This value cannot be N-1. That can only occur as a result of
// the assignment to bottom in this method. If it does, this method // the assignment to bottom in this method. If it does, this method
@ -799,7 +799,7 @@ public:
} }
volatile ObjArrayTask& volatile ObjArrayTask&
operator =(const volatile ObjArrayTask& t) volatile { operator =(const volatile ObjArrayTask& t) volatile {
_obj = t._obj; (void)const_cast<oop&>(_obj = t._obj);
_index = t._index; _index = t._index;
return *this; return *this;
} }