Mercurial > hg > truffle
annotate src/share/vm/oops/typeArrayKlass.hpp @ 497:7aadaf46ecd7
Merge
author | jmasa |
---|---|
date | Fri, 19 Dec 2008 12:15:34 -0800 |
parents | 7d7a7c599c17 |
children | 0fbdb4381b99 |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 // A typeArrayKlass is the klass of a typeArray | |
26 // It contains the type and size of the elements | |
27 | |
28 class typeArrayKlass : public arrayKlass { | |
29 friend class VMStructs; | |
30 private: | |
31 jint _max_length; // maximum number of elements allowed in an array | |
32 public: | |
33 // instance variables | |
34 jint max_length() { return _max_length; } | |
35 void set_max_length(jint m) { _max_length = m; } | |
36 | |
37 // testers | |
38 bool oop_is_typeArray_slow() const { return true; } | |
39 | |
40 // klass allocation | |
41 DEFINE_ALLOCATE_PERMANENT(typeArrayKlass); | |
481
7d7a7c599c17
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
0
diff
changeset
|
42 static klassOop create_klass(BasicType type, int scale, const char* name_str, |
7d7a7c599c17
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
0
diff
changeset
|
43 TRAPS); |
7d7a7c599c17
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
0
diff
changeset
|
44 static inline klassOop create_klass(BasicType type, int scale, TRAPS) { |
7d7a7c599c17
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
0
diff
changeset
|
45 return create_klass(type, scale, external_name(type), CHECK_NULL); |
7d7a7c599c17
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
0
diff
changeset
|
46 } |
0 | 47 |
48 int oop_size(oop obj) const; | |
49 int klass_oop_size() const { return object_size(); } | |
50 | |
51 bool compute_is_subtype_of(klassOop k); | |
52 | |
53 // Allocation | |
54 typeArrayOop allocate(int length, TRAPS); | |
55 typeArrayOop allocate_permanent(int length, TRAPS); // used for class file structures | |
56 oop multi_allocate(int rank, jint* sizes, TRAPS); | |
57 | |
58 // Copying | |
59 void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS); | |
60 | |
61 // Iteration | |
62 int oop_oop_iterate(oop obj, OopClosure* blk); | |
63 int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr); | |
64 | |
65 // Garbage collection | |
66 void oop_follow_contents(oop obj); | |
67 int oop_adjust_pointers(oop obj); | |
68 | |
69 // Parallel Scavenge and Parallel Old | |
70 PARALLEL_GC_DECLS | |
71 | |
72 protected: | |
73 // Find n'th dimensional array | |
74 virtual klassOop array_klass_impl(bool or_null, int n, TRAPS); | |
75 | |
76 // Returns the array class with this class as element type | |
77 virtual klassOop array_klass_impl(bool or_null, TRAPS); | |
78 | |
79 public: | |
80 // Casting from klassOop | |
81 static typeArrayKlass* cast(klassOop k) { | |
82 assert(k->klass_part()->oop_is_typeArray_slow(), "cast to typeArrayKlass"); | |
83 return (typeArrayKlass*) k->klass_part(); | |
84 } | |
85 | |
86 // Naming | |
87 static const char* external_name(BasicType type); | |
88 | |
89 // Sizing | |
90 static int header_size() { return oopDesc::header_size() + sizeof(typeArrayKlass)/HeapWordSize; } | |
91 int object_size() const { return arrayKlass::object_size(header_size()); } | |
92 | |
93 // Initialization (virtual from Klass) | |
94 void initialize(TRAPS); | |
95 | |
96 private: | |
97 // Helpers | |
98 static klassOop array_klass_impl(typeArrayKlassHandle h_this, bool or_null, int n, TRAPS); | |
99 | |
100 #ifndef PRODUCT | |
101 public: | |
102 // Printing | |
103 void oop_print_on(oop obj, outputStream* st); | |
104 #endif | |
105 public: | |
106 const char* internal_name() const; | |
107 }; |