OpenJDK / jdk / jdk
changeset 57832:d4fc10ef2d17
8237821: Shenandoah: build broken after JDK-8237637 (Remove dubious type conversions from oop)
Reviewed-by: rkennke
author | shade |
---|---|
date | Fri, 24 Jan 2020 21:11:31 +0100 |
parents | 9af9aac9996a |
children | 476ac8b04323 |
files | src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp |
diffstat | 7 files changed, 30 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp Fri Jan 24 11:55:15 2020 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp Fri Jan 24 21:11:31 2020 +0100 @@ -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 @@ 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 @@ 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_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);
--- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp Fri Jan 24 11:55:15 2020 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp Fri Jan 24 21:11:31 2020 +0100 @@ -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 @@ 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) {
--- a/src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp Fri Jan 24 11:55:15 2020 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp Fri Jan 24 21:11:31 2020 +0100 @@ -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 @@ 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 {
--- a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp Fri Jan 24 11:55:15 2020 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp Fri Jan 24 21:11:31 2020 +0100 @@ -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 @@ 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;
--- a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp Fri Jan 24 11:55:15 2020 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp Fri Jan 24 21:11:31 2020 +0100 @@ -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(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;
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Fri Jan 24 11:55:15 2020 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Fri Jan 24 21:11:31 2020 +0100 @@ -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 @@ 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.
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp Fri Jan 24 11:55:15 2020 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp Fri Jan 24 21:11:31 2020 +0100 @@ -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 @@ 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 {