Mercurial > hg > graal-jvmci-8
comparison src/share/vm/oops/typeArrayKlass.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 | a92cdbac8b9e |
children | d8ce2825b193 |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 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_TYPEARRAYKLASS_HPP | 25 #ifndef SHARE_VM_OOPS_TYPEARRAYKLASS_HPP |
26 #define SHARE_VM_OOPS_TYPEARRAYKLASS_HPP | 26 #define SHARE_VM_OOPS_TYPEARRAYKLASS_HPP |
27 | 27 |
28 #include "classfile/classLoaderData.hpp" | |
28 #include "oops/arrayKlass.hpp" | 29 #include "oops/arrayKlass.hpp" |
29 | 30 |
30 // A typeArrayKlass is the klass of a typeArray | 31 // A typeArrayKlass is the klass of a typeArray |
31 // It contains the type and size of the elements | 32 // It contains the type and size of the elements |
32 | 33 |
33 class typeArrayKlass : public arrayKlass { | 34 class typeArrayKlass : public arrayKlass { |
34 friend class VMStructs; | 35 friend class VMStructs; |
35 private: | 36 private: |
36 jint _max_length; // maximum number of elements allowed in an array | 37 jint _max_length; // maximum number of elements allowed in an array |
38 | |
39 // Constructor | |
40 typeArrayKlass(BasicType type, Symbol* name); | |
41 static typeArrayKlass* allocate(ClassLoaderData* loader_data, BasicType type, Symbol* name, TRAPS); | |
37 public: | 42 public: |
43 typeArrayKlass() {} // For dummy objects. | |
44 | |
38 // instance variables | 45 // instance variables |
39 jint max_length() { return _max_length; } | 46 jint max_length() { return _max_length; } |
40 void set_max_length(jint m) { _max_length = m; } | 47 void set_max_length(jint m) { _max_length = m; } |
41 | 48 |
42 // testers | 49 // testers |
43 bool oop_is_typeArray_slow() const { return true; } | 50 bool oop_is_typeArray_slow() const { return true; } |
44 | 51 |
45 // klass allocation | 52 // klass allocation |
46 DEFINE_ALLOCATE_PERMANENT(typeArrayKlass); | 53 static typeArrayKlass* create_klass(BasicType type, const char* name_str, |
47 static klassOop create_klass(BasicType type, int scale, const char* name_str, | |
48 TRAPS); | 54 TRAPS); |
49 static inline klassOop create_klass(BasicType type, int scale, TRAPS) { | 55 static inline Klass* create_klass(BasicType type, int scale, TRAPS) { |
50 return create_klass(type, scale, external_name(type), CHECK_NULL); | 56 typeArrayKlass* tak = create_klass(type, external_name(type), CHECK_NULL); |
57 assert(scale == (1 << tak->log2_element_size()), "scale must check out"); | |
58 return tak; | |
51 } | 59 } |
52 | 60 |
53 int oop_size(oop obj) const; | 61 int oop_size(oop obj) const; |
54 int klass_oop_size() const { return object_size(); } | |
55 | 62 |
56 bool compute_is_subtype_of(klassOop k); | 63 bool compute_is_subtype_of(Klass* k); |
57 | 64 |
58 // Allocation | 65 // Allocation |
59 typeArrayOop allocate_common(int length, bool do_zero, TRAPS); | 66 typeArrayOop allocate_common(int length, bool do_zero, TRAPS); |
60 typeArrayOop allocate(int length, TRAPS) { return allocate_common(length, true, THREAD); } | 67 typeArrayOop allocate(int length, TRAPS) { return allocate_common(length, true, THREAD); } |
61 typeArrayOop allocate_permanent(int length, TRAPS); // used for class file structures | |
62 oop multi_allocate(int rank, jint* sizes, TRAPS); | 68 oop multi_allocate(int rank, jint* sizes, TRAPS); |
63 | 69 |
64 // Copying | 70 // Copying |
65 void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS); | 71 void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS); |
66 | 72 |
67 // Iteration | 73 // Iteration |
68 int oop_oop_iterate(oop obj, OopClosure* blk); | 74 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk); |
69 int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr); | 75 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr); |
70 | 76 |
71 // Garbage collection | 77 // Garbage collection |
72 void oop_follow_contents(oop obj); | 78 void oop_follow_contents(oop obj); |
73 int oop_adjust_pointers(oop obj); | 79 int oop_adjust_pointers(oop obj); |
74 | 80 |
75 // Parallel Scavenge and Parallel Old | 81 // Parallel Scavenge and Parallel Old |
76 PARALLEL_GC_DECLS | 82 PARALLEL_GC_DECLS |
77 | 83 |
78 protected: | 84 protected: |
79 // Find n'th dimensional array | 85 // Find n'th dimensional array |
80 virtual klassOop array_klass_impl(bool or_null, int n, TRAPS); | 86 virtual Klass* array_klass_impl(bool or_null, int n, TRAPS); |
81 | 87 |
82 // Returns the array class with this class as element type | 88 // Returns the array class with this class as element type |
83 virtual klassOop array_klass_impl(bool or_null, TRAPS); | 89 virtual Klass* array_klass_impl(bool or_null, TRAPS); |
84 | 90 |
85 public: | 91 public: |
86 // Casting from klassOop | 92 // Casting from Klass* |
87 static typeArrayKlass* cast(klassOop k) { | 93 static typeArrayKlass* cast(Klass* k) { |
88 assert(k->klass_part()->oop_is_typeArray_slow(), "cast to typeArrayKlass"); | 94 assert(k->oop_is_typeArray(), "cast to typeArrayKlass"); |
89 return (typeArrayKlass*) k->klass_part(); | 95 return (typeArrayKlass*) k; |
90 } | 96 } |
91 | 97 |
92 // Naming | 98 // Naming |
93 static const char* external_name(BasicType type); | 99 static const char* external_name(BasicType type); |
94 | 100 |
95 // Sizing | 101 // Sizing |
96 static int header_size() { return oopDesc::header_size() + sizeof(typeArrayKlass)/HeapWordSize; } | 102 static int header_size() { return sizeof(typeArrayKlass)/HeapWordSize; } |
97 int object_size() const { return arrayKlass::object_size(header_size()); } | 103 int size() const { return arrayKlass::static_size(header_size()); } |
98 | 104 |
99 // Initialization (virtual from Klass) | 105 // Initialization (virtual from Klass) |
100 void initialize(TRAPS); | 106 void initialize(TRAPS); |
101 | 107 |
102 private: | |
103 // Helpers | |
104 static klassOop array_klass_impl(typeArrayKlassHandle h_this, bool or_null, int n, TRAPS); | |
105 | |
106 #ifndef PRODUCT | |
107 public: | 108 public: |
108 // Printing | 109 // Printing |
110 #ifndef PRODUCT | |
109 void oop_print_on(oop obj, outputStream* st); | 111 void oop_print_on(oop obj, outputStream* st); |
110 #endif | 112 #endif |
113 | |
114 void print_on(outputStream* st) const; | |
115 void print_value_on(outputStream* st) const; | |
116 | |
111 public: | 117 public: |
112 const char* internal_name() const; | 118 const char* internal_name() const; |
113 }; | 119 }; |
114 | 120 |
115 #endif // SHARE_VM_OOPS_TYPEARRAYKLASS_HPP | 121 #endif // SHARE_VM_OOPS_TYPEARRAYKLASS_HPP |