--- a/hotspot/src/share/vm/oops/annotations.hpp Sat Jul 22 15:54:27 2017 -0400
+++ b/hotspot/src/share/vm/oops/annotations.hpp Wed Aug 02 18:06:38 2017 -0700
@@ -43,6 +43,8 @@
// a type_annotation instance.
class Annotations: public MetaspaceObj {
+ // If you add a new field that points to any metaspace object, you
+ // must add this field to Annotations::metaspace_pointers_do().
// Annotations for this class, or null if none.
AnnotationArray* _class_annotations;
@@ -63,6 +65,10 @@
// Sizing (in words)
static int size() { return sizeof(Annotations) / wordSize; }
+
+ // Annotations should be stored in the read-only region of CDS archive.
+ static bool is_read_only_by_default() { return true; }
+
#if INCLUDE_SERVICES
void collect_statistics(KlassSizeStats *sz) const;
#endif
@@ -87,6 +93,9 @@
static typeArrayOop make_java_array(AnnotationArray* annotations, TRAPS);
bool is_klass() const { return false; }
+ void metaspace_pointers_do(MetaspaceClosure* it);
+ MetaspaceObj::Type type() const { return AnnotationsType; }
+
private:
static julong count_bytes(Array<AnnotationArray*>* p);
public: