< prev index next >
src/hotspot/share/memory/allocation.hpp
Print this page
@@ -1,7 +1,7 @@
/*
- * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -225,13 +225,21 @@
class ClassLoaderData;
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) \
f(Class) \
f(Symbol) \
< prev index next >