1 /* |
1 /* |
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 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. |
24 |
24 |
25 #ifndef SHARE_VM_CI_CIKLASS_HPP |
25 #ifndef SHARE_VM_CI_CIKLASS_HPP |
26 #define SHARE_VM_CI_CIKLASS_HPP |
26 #define SHARE_VM_CI_CIKLASS_HPP |
27 |
27 |
28 #include "ci/ciType.hpp" |
28 #include "ci/ciType.hpp" |
29 #include "oops/klassOop.hpp" |
|
30 |
29 |
31 // ciKlass |
30 // ciKlass |
32 // |
31 // |
33 // This class and its subclasses represent klassOops in the |
32 // This class and its subclasses represent Klass*s in the |
34 // HotSpot virtual machine. In the vm, each klassOop contains an |
33 // HotSpot virtual machine. In the vm, each Klass* contains an |
35 // embedded Klass object. ciKlass is subclassed to explicitly |
34 // embedded Klass object. ciKlass is subclassed to explicitly |
36 // represent the kind of Klass embedded in the klassOop. For |
35 // represent the kind of Klass embedded in the Klass*. For |
37 // example, a klassOop with an embedded objArrayKlass object is |
36 // example, a Klass* with an embedded objArrayKlass object is |
38 // represented in the ciObject hierarchy by the class |
37 // represented in the ciObject hierarchy by the class |
39 // ciObjArrayKlass. |
38 // ciObjArrayKlass. |
40 class ciKlass : public ciType { |
39 class ciKlass : public ciType { |
41 CI_PACKAGE_ACCESS |
40 CI_PACKAGE_ACCESS |
42 friend class ciEnv; |
41 friend class ciEnv; |
48 ciSymbol* _name; |
47 ciSymbol* _name; |
49 jint _layout_helper; |
48 jint _layout_helper; |
50 |
49 |
51 protected: |
50 protected: |
52 ciKlass(KlassHandle k_h, ciSymbol* name); |
51 ciKlass(KlassHandle k_h, ciSymbol* name); |
53 ciKlass(ciSymbol* name, ciKlass* klass); |
52 ciKlass(ciSymbol* name, BasicType bt); |
54 |
53 |
55 klassOop get_klassOop() const { |
54 Klass* get_Klass() const { |
56 klassOop k = (klassOop)get_oop(); |
55 Klass* k = (Klass*)_metadata; |
57 assert(k != NULL, "illegal use of unloaded klass"); |
56 assert(k != NULL, "illegal use of unloaded klass"); |
58 return k; |
57 return k; |
59 } |
58 } |
60 |
|
61 Klass* get_Klass() const { return get_klassOop()->klass_part(); } |
|
62 |
59 |
63 // Certain subklasses have an associated class loader. |
60 // Certain subklasses have an associated class loader. |
64 virtual oop loader() { return NULL; } |
61 virtual oop loader() { return NULL; } |
65 virtual jobject loader_handle() { return NULL; } |
62 virtual jobject loader_handle() { return NULL; } |
66 |
63 |
85 juint super_depth(); |
82 juint super_depth(); |
86 juint super_check_offset(); |
83 juint super_check_offset(); |
87 ciKlass* super_of_depth(juint i); |
84 ciKlass* super_of_depth(juint i); |
88 bool can_be_primary_super(); |
85 bool can_be_primary_super(); |
89 static juint primary_super_limit() { return Klass::primary_super_limit(); } |
86 static juint primary_super_limit() { return Klass::primary_super_limit(); } |
|
87 |
|
88 // Is this ciObject the ciInstanceKlass representing java.lang.Object()? |
|
89 virtual bool is_java_lang_Object() const { return false; } |
90 |
90 |
91 // Get the shared parent of two klasses. |
91 // Get the shared parent of two klasses. |
92 ciKlass* least_common_ancestor(ciKlass* k); |
92 ciKlass* least_common_ancestor(ciKlass* k); |
93 |
93 |
94 virtual bool is_interface() { |
94 virtual bool is_interface() { |
117 |
117 |
118 // Fetch Klass::access_flags. |
118 // Fetch Klass::access_flags. |
119 jint access_flags(); |
119 jint access_flags(); |
120 |
120 |
121 // What kind of ciObject is this? |
121 // What kind of ciObject is this? |
122 bool is_klass() { return true; } |
122 bool is_klass() const { return true; } |
123 |
123 |
124 void print_name_on(outputStream* st); |
124 void print_name_on(outputStream* st); |
125 }; |
125 }; |
126 |
126 |
127 #endif // SHARE_VM_CI_CIKLASS_HPP |
127 #endif // SHARE_VM_CI_CIKLASS_HPP |