comparison src/share/vm/oops/instanceMirrorKlass.hpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents 63997f575155
children aed758eda82a
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
23 */ 23 */
24 24
25 #ifndef SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP 25 #ifndef SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP
26 #define SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP 26 #define SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP
27 27
28 #include "classfile/systemDictionary.hpp"
28 #include "oops/instanceKlass.hpp" 29 #include "oops/instanceKlass.hpp"
30 #include "runtime/handles.hpp"
29 31
30 // An instanceMirrorKlass is a specialized instanceKlass for 32 // An instanceMirrorKlass is a specialized InstanceKlass for
31 // java.lang.Class instances. These instances are special because 33 // java.lang.Class instances. These instances are special because
32 // they contain the static fields of the class in addition to the 34 // they contain the static fields of the class in addition to the
33 // normal fields of Class. This means they are variable sized 35 // normal fields of Class. This means they are variable sized
34 // instances and need special logic for computing their size and for 36 // instances and need special logic for computing their size and for
35 // iteration of their oops. 37 // iteration of their oops.
36 38
37 39
38 class instanceMirrorKlass: public instanceKlass { 40 class instanceMirrorKlass: public InstanceKlass {
39 friend class VMStructs; 41 friend class VMStructs;
42 friend class InstanceKlass;
40 43
41 private: 44 private:
42 static int _offset_of_static_fields; 45 static int _offset_of_static_fields;
43 46
47 // Constructor
48 instanceMirrorKlass(int vtable_len, int itable_len, int static_field_size, int nonstatic_oop_map_size, ReferenceType rt, AccessFlags access_flags, bool is_anonymous)
49 : InstanceKlass(vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt, access_flags, is_anonymous) {}
50
44 public: 51 public:
52 instanceMirrorKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
45 // Type testing 53 // Type testing
46 bool oop_is_instanceMirror() const { return true; } 54 bool oop_is_instanceMirror() const { return true; }
47 55
48 // Casting from klassOop 56 // Casting from Klass*
49 static instanceMirrorKlass* cast(klassOop k) { 57 static instanceMirrorKlass* cast(Klass* k) {
50 assert(k->klass_part()->oop_is_instanceMirror(), "cast to instanceMirrorKlass"); 58 assert(k->oop_is_instanceMirror(), "cast to instanceMirrorKlass");
51 return (instanceMirrorKlass*) k->klass_part(); 59 return (instanceMirrorKlass*) k;
52 } 60 }
53 61
54 // Returns the size of the instance including the extra static fields. 62 // Returns the size of the instance including the extra static fields.
55 virtual int oop_size(oop obj) const; 63 virtual int oop_size(oop obj) const;
56 64
74 82
75 // Given a Klass return the size of the instance 83 // Given a Klass return the size of the instance
76 int instance_size(KlassHandle k); 84 int instance_size(KlassHandle k);
77 85
78 // allocation 86 // allocation
79 DEFINE_ALLOCATE_PERMANENT(instanceMirrorKlass);
80 instanceOop allocate_instance(KlassHandle k, TRAPS); 87 instanceOop allocate_instance(KlassHandle k, TRAPS);
81 88
82 // Garbage collection 89 // Garbage collection
83 int oop_adjust_pointers(oop obj); 90 int oop_adjust_pointers(oop obj);
84 void oop_follow_contents(oop obj); 91 void oop_follow_contents(oop obj);
85 92
86 // Parallel Scavenge and Parallel Old 93 // Parallel Scavenge and Parallel Old
87 PARALLEL_GC_DECLS 94 PARALLEL_GC_DECLS
88 95
89 int oop_oop_iterate(oop obj, OopClosure* blk) { 96 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
90 return oop_oop_iterate_v(obj, blk); 97 return oop_oop_iterate_v(obj, blk);
91 } 98 }
92 int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { 99 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
93 return oop_oop_iterate_v_m(obj, blk, mr); 100 return oop_oop_iterate_v_m(obj, blk, mr);
94 } 101 }
95 102
96 #define InstanceMirrorKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ 103 #define InstanceMirrorKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
97 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \ 104 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \