author | vlivanov |
Mon, 13 Feb 2017 23:58:00 +0300 | |
changeset 43951 | c23519aaccc1 |
parent 33611 | 9abd65805e19 |
child 46329 | 53ccc37bda19 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
13952
diff
changeset
|
2 |
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "ci/ciArrayKlass.hpp" |
|
27 |
#include "ci/ciObjArrayKlass.hpp" |
|
28 |
#include "ci/ciTypeArrayKlass.hpp" |
|
29 |
#include "ci/ciUtilities.hpp" |
|
1 | 30 |
|
31 |
// ciArrayKlass |
|
32 |
// |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
7397
diff
changeset
|
33 |
// This class represents a Klass* in the HotSpot virtual machine |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
34 |
// whose Klass part in an ArrayKlass. |
1 | 35 |
|
36 |
// ------------------------------------------------------------------ |
|
37 |
// ciArrayKlass::ciArrayKlass |
|
38 |
// |
|
39 |
// Loaded array klass. |
|
40 |
ciArrayKlass::ciArrayKlass(KlassHandle h_k) : ciKlass(h_k) { |
|
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
13952
diff
changeset
|
41 |
assert(get_Klass()->is_array_klass(), "wrong type"); |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
42 |
_dimension = get_ArrayKlass()->dimension(); |
1 | 43 |
} |
44 |
||
45 |
// ------------------------------------------------------------------ |
|
46 |
// ciArrayKlass::ciArrayKlass |
|
47 |
// |
|
48 |
// Unloaded array klass. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
7397
diff
changeset
|
49 |
ciArrayKlass::ciArrayKlass(ciSymbol* name, int dimension, BasicType bt) |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
7397
diff
changeset
|
50 |
: ciKlass(name, bt) { |
1 | 51 |
_dimension = dimension; |
52 |
} |
|
53 |
||
54 |
// ------------------------------------------------------------------ |
|
55 |
// ciArrayKlass::element_type |
|
56 |
// |
|
57 |
// What type is obtained when this array is indexed once? |
|
58 |
ciType* ciArrayKlass::element_type() { |
|
59 |
if (is_type_array_klass()) { |
|
60 |
return ciType::make(as_type_array_klass()->element_type()); |
|
61 |
} else { |
|
62 |
return as_obj_array_klass()->element_klass()->as_klass(); |
|
63 |
} |
|
64 |
} |
|
65 |
||
66 |
||
67 |
// ------------------------------------------------------------------ |
|
68 |
// ciArrayKlass::base_element_type |
|
69 |
// |
|
70 |
// What type is obtained when this array is indexed as many times as possible? |
|
71 |
ciType* ciArrayKlass::base_element_type() { |
|
72 |
if (is_type_array_klass()) { |
|
73 |
return ciType::make(as_type_array_klass()->element_type()); |
|
74 |
} else { |
|
75 |
ciKlass* ek = as_obj_array_klass()->base_element_klass(); |
|
76 |
if (ek->is_type_array_klass()) { |
|
77 |
return ciType::make(ek->as_type_array_klass()->element_type()); |
|
78 |
} |
|
79 |
return ek; |
|
80 |
} |
|
81 |
} |
|
82 |
||
83 |
||
84 |
// ------------------------------------------------------------------ |
|
85 |
// ciArrayKlass::is_leaf_type |
|
86 |
bool ciArrayKlass::is_leaf_type() { |
|
87 |
if (is_type_array_klass()) { |
|
88 |
return true; |
|
89 |
} else { |
|
90 |
return as_obj_array_klass()->base_element_klass()->is_leaf_type(); |
|
91 |
} |
|
92 |
} |
|
93 |
||
94 |
||
95 |
// ------------------------------------------------------------------ |
|
96 |
// ciArrayKlass::base_element_type |
|
97 |
// |
|
98 |
// What type is obtained when this array is indexed as many times as possible? |
|
99 |
ciArrayKlass* ciArrayKlass::make(ciType* element_type) { |
|
100 |
if (element_type->is_primitive_type()) { |
|
101 |
return ciTypeArrayKlass::make(element_type->basic_type()); |
|
102 |
} else { |
|
103 |
return ciObjArrayKlass::make(element_type->as_klass()); |
|
104 |
} |
|
105 |
} |