Mercurial > hg > graal-jvmci-8
comparison src/share/vm/oops/instanceMirrorKlass.hpp @ 6948:e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 12 Nov 2012 23:14:12 +0100 |
parents | aed758eda82a |
children | db9981fd3124 |
comparison
equal
deleted
inserted
replaced
6711:ae13cc658b80 | 6948:e522a00b91aa |
---|---|
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 |
61 } | 69 } |
62 | 70 |
63 static void init_offset_of_static_fields() { | 71 static void init_offset_of_static_fields() { |
64 // Cache the offset of the static fields in the Class instance | 72 // Cache the offset of the static fields in the Class instance |
65 assert(_offset_of_static_fields == 0, "once"); | 73 assert(_offset_of_static_fields == 0, "once"); |
66 _offset_of_static_fields = instanceMirrorKlass::cast(SystemDictionary::Class_klass())->size_helper() << LogHeapWordSize; | 74 _offset_of_static_fields = InstanceMirrorKlass::cast(SystemDictionary::Class_klass())->size_helper() << LogHeapWordSize; |
67 } | 75 } |
68 | 76 |
69 static int offset_of_static_fields() { | 77 static int offset_of_static_fields() { |
70 return _offset_of_static_fields; | 78 return _offset_of_static_fields; |
71 } | 79 } |
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); \ |