Skip to content
Permalink
Browse files

8237821: Shenandoah: build broken after JDK-8237637 (Remove dubious t…

…ype conversions from oop)

Reviewed-by: rkennke
  • Loading branch information
shipilev committed Jan 24, 2020
1 parent 90d656d commit 7cd21cfdec0f9893e4fd97240c71baf4c1b78928
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved.
* Copyright (c) 2018, 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@ void ShenandoahAsserts::print_obj(ShenandoahMessageBuffer& msg, oop obj) {
msg.append(" %3s marked \n", ctx->is_marked(obj) ? "" : "not");
msg.append(" %3s in collection set\n", heap->in_collection_set(obj) ? "" : "not");
if (heap->traversal_gc() != NULL) {
msg.append(" %3s in traversal set\n", heap->traversal_gc()->traversal_set()->is_in(cast_from_oop<HeapWord*>(obj)) ? "" : "not");
msg.append(" %3s in traversal set\n", heap->traversal_gc()->traversal_set()->is_in(obj) ? "" : "not");
}
msg.append(" mark:%s\n", mw_ss.as_string());
msg.append(" region: %s", ss.as_string());
@@ -85,7 +85,7 @@ void ShenandoahAsserts::print_non_obj(ShenandoahMessageBuffer& msg, void* loc) {
stringStream ss;
r->print_on(&ss);

msg.append(" %3s in collection set\n", heap->in_collection_set(loc) ? "" : "not");
msg.append(" %3s in collection set\n", heap->in_collection_set_loc(loc) ? "" : "not");
msg.append(" region: %s", ss.as_string());
} else {
msg.append(" outside of Java heap\n");
@@ -332,7 +332,7 @@ void ShenandoahAsserts::assert_not_in_cset(void* interior_loc, oop obj, const ch

void ShenandoahAsserts::assert_not_in_cset_loc(void* interior_loc, const char* file, int line) {
ShenandoahHeap* heap = ShenandoahHeap::heap_no_check();
if (heap->in_collection_set(interior_loc)) {
if (heap->in_collection_set_loc(interior_loc)) {
print_failure(_safe_unknown, NULL, interior_loc, NULL, "Shenandoah assert_not_in_cset_loc failed",
"Interior location should not be in collection set",
file, line);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Red Hat, Inc. All rights reserved.
* Copyright (c) 2015, 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -268,7 +268,7 @@ void ShenandoahBarrierSet::arraycopy_work(T* src, size_t count) {
T o = RawAccess<>::oop_load(elem_ptr);
if (!CompressedOops::is_null(o)) {
oop obj = CompressedOops::decode_not_null(o);
if (HAS_FWD && cset->is_in(cast_from_oop<HeapWord *>(obj))) {
if (HAS_FWD && cset->is_in(obj)) {
assert(_heap->has_forwarded_objects(), "only get here with forwarded objects");
oop fwd = resolve_forwarded_not_null(obj);
if (EVAC && obj == fwd) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Red Hat, Inc. All rights reserved.
* Copyright (c) 2019, 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -94,7 +94,7 @@ void ShenandoahTraversalUpdateRefsClosure::do_oop_work(T* p) {
T o = RawAccess<>::oop_load(p);
if (!CompressedOops::is_null(o)) {
oop obj = CompressedOops::decode_not_null(o);
if (_heap->in_collection_set(obj) || _traversal_set->is_in(cast_from_oop<HeapWord*>(obj))) {
if (_heap->in_collection_set(obj) || _traversal_set->is_in(obj)) {
obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
RawAccess<IS_NOT_NULL>::oop_store(p, obj);
} else {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Red Hat, Inc. All rights reserved.
* Copyright (c) 2016, 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -80,6 +80,7 @@ class ShenandoahCollectionSet : public CHeapObj<mtGC> {

inline bool is_in(ShenandoahHeapRegion* r) const;
inline bool is_in(size_t region_number) const;
inline bool is_in(HeapWord* loc) const;
inline bool is_in(oop obj) const;

void print_on(outputStream* out) const;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Red Hat, Inc. All rights reserved.
* Copyright (c) 2017, 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,8 +40,12 @@ bool ShenandoahCollectionSet::is_in(ShenandoahHeapRegion* r) const {
}

bool ShenandoahCollectionSet::is_in(oop p) const {
return is_in(cast_from_oop<HeapWord*>(p));
}

bool ShenandoahCollectionSet::is_in(HeapWord* p) const {
assert(_heap->is_in(p), "Must be in the heap");
uintx index = (cast_from_oop<uintx>(p)) >> _region_size_bytes_shift;
uintx index = ((uintx) p) >> _region_size_bytes_shift;
// no need to subtract the bottom of the heap from p,
// _biased_cset_map is biased
return _biased_cset_map[index] == 1;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved.
* Copyright (c) 2013, 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -698,11 +698,11 @@ class ShenandoahHeap : public CollectedHeap {

ShenandoahCollectionSet* collection_set() const { return _collection_set; }

template <class T>
inline bool in_collection_set(T obj) const;
// Checks if object is in the collection set.
inline bool in_collection_set(oop obj) const;

// Avoid accidentally calling the method above with ShenandoahHeapRegion*, which would be *wrong*.
inline bool in_collection_set(ShenandoahHeapRegion* r) shenandoah_not_implemented_return(false);
// Checks if location is in the collection set. Can be interior pointer, not the oop itself.
inline bool in_collection_set_loc(void* loc) const;

// Evacuates object src. Returns the evacuated object, either evacuated
// by this thread, or by some other thread.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Red Hat, Inc. All rights reserved.
* Copyright (c) 2015, 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -324,13 +324,16 @@ inline bool ShenandoahHeap::requires_marking(const void* entry) const {
return !_marking_context->is_marked(obj);
}

template <class T>
inline bool ShenandoahHeap::in_collection_set(T p) const {
HeapWord* obj = cast_from_oop<HeapWord*>(p);
inline bool ShenandoahHeap::in_collection_set(oop p) const {
assert(collection_set() != NULL, "Sanity");
assert(is_in(obj), "should be in heap");
assert(is_in(p), "should be in heap");
return collection_set()->is_in(p);
}

return collection_set()->is_in(obj);
inline bool ShenandoahHeap::in_collection_set_loc(void* p) const {
assert(collection_set() != NULL, "Sanity");
assert(is_in(p), "should be in heap");
return collection_set()->is_in((HeapWord*)p);
}

inline bool ShenandoahHeap::is_stable() const {

0 comments on commit 7cd21cf

Please sign in to comment.