--- old/src/hotspot/share/memory/allocation.hpp 2018-01-15 16:24:04.888444153 -0800 +++ new/src/hotspot/share/memory/allocation.hpp 2018-01-15 16:24:04.472428394 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. 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 @@ -227,9 +227,17 @@ class MetaspaceClosure; class MetaspaceObj { + friend class MetaspaceShared; + static void* _shared_metaspace_base; + static void* _shared_metaspace_top; + public: bool is_metaspace_object() const; - bool is_shared() const; + bool is_shared() const { + // If no shared metaspace regions are mapped, _shared_metaspace_{base,top} will + // both be NULL and all values of p will be rejected quickly. + return (((void*)this) < _shared_metaspace_top && ((void*)this) >= _shared_metaspace_base); + } void print_address_on(outputStream* st) const; // nonvirtual address printing #define METASPACE_OBJ_TYPES_DO(f) \