author | lfoltan |
Mon, 21 Oct 2019 13:13:16 -0400 | |
changeset 58722 | cba8afa5cfed |
parent 58177 | 4932dce35882 |
child 58679 | 9c3209ff7550 |
child 59056 | 15936b142f86 |
permissions | -rw-r--r-- |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53143
diff
changeset
|
2 |
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
4 |
* |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
8 |
* |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
13 |
* accompanied this code). |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
14 |
* |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
18 |
* |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
21 |
* questions. |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
22 |
* |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
23 |
*/ |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
24 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53143
diff
changeset
|
25 |
#ifndef SHARE_CLASSFILE_JAVACLASSES_INLINE_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53143
diff
changeset
|
26 |
#define SHARE_CLASSFILE_JAVACLASSES_INLINE_HPP |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
27 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
28 |
#include "classfile/javaClasses.hpp" |
48618
688e5cbd0b91
8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents:
47998
diff
changeset
|
29 |
#include "oops/access.inline.hpp" |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
30 |
#include "oops/oop.inline.hpp" |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
31 |
#include "oops/oopsHierarchy.hpp" |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
32 |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
33 |
void java_lang_String::set_coder(oop string, jbyte coder) { |
43422 | 34 |
assert(initialized && (coder_offset > 0), "Must be initialized"); |
35 |
string->byte_field_put(coder_offset, coder); |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
36 |
} |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
37 |
|
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
38 |
void java_lang_String::set_value_raw(oop string, typeArrayOop buffer) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
39 |
assert(initialized, "Must be initialized"); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
40 |
string->obj_field_put_raw(value_offset, buffer); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
41 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
42 |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
43 |
void java_lang_String::set_value(oop string, typeArrayOop buffer) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
44 |
assert(initialized && (value_offset > 0), "Must be initialized"); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
45 |
string->obj_field_put(value_offset, (oop)buffer); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
46 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
47 |
|
54486
7fd299216e97
8221836: Avoid recalculating String.hash when zero
redestad
parents:
54102
diff
changeset
|
48 |
bool java_lang_String::hash_is_set(oop java_string) { |
7fd299216e97
8221836: Avoid recalculating String.hash when zero
redestad
parents:
54102
diff
changeset
|
49 |
assert(initialized && (hash_offset > 0) && (hashIsZero_offset > 0), "Must be initialized"); |
7fd299216e97
8221836: Avoid recalculating String.hash when zero
redestad
parents:
54102
diff
changeset
|
50 |
return java_string->int_field(hash_offset) != 0 || java_string->bool_field(hashIsZero_offset) != 0; |
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
51 |
} |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
52 |
|
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
53 |
// Accessors |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
54 |
bool java_lang_String::value_equals(typeArrayOop str_value1, typeArrayOop str_value2) { |
58177 | 55 |
return ((str_value1 == str_value2) || |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
56 |
(str_value1->length() == str_value2->length() && |
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
57 |
(!memcmp(str_value1->base(T_BYTE), |
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
58 |
str_value2->base(T_BYTE), |
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
59 |
str_value2->length() * sizeof(jbyte))))); |
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
60 |
} |
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
61 |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
62 |
typeArrayOop java_lang_String::value(oop java_string) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
63 |
assert(initialized && (value_offset > 0), "Must be initialized"); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
64 |
assert(is_instance(java_string), "must be java_string"); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
65 |
return (typeArrayOop) java_string->obj_field(value_offset); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
66 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
67 |
|
48618
688e5cbd0b91
8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents:
47998
diff
changeset
|
68 |
typeArrayOop java_lang_String::value_no_keepalive(oop java_string) { |
688e5cbd0b91
8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents:
47998
diff
changeset
|
69 |
assert(initialized && (value_offset > 0), "Must be initialized"); |
688e5cbd0b91
8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents:
47998
diff
changeset
|
70 |
assert(is_instance(java_string), "must be java_string"); |
688e5cbd0b91
8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents:
47998
diff
changeset
|
71 |
return (typeArrayOop) java_string->obj_field_access<AS_NO_KEEPALIVE>(value_offset); |
688e5cbd0b91
8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents:
47998
diff
changeset
|
72 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
73 |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
74 |
bool java_lang_String::is_latin1(oop java_string) { |
43422 | 75 |
assert(initialized && (coder_offset > 0), "Must be initialized"); |
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
76 |
assert(is_instance(java_string), "must be java_string"); |
43422 | 77 |
jbyte coder = java_string->byte_field(coder_offset); |
78 |
assert(CompactStrings || coder == CODER_UTF16, "Must be UTF16 without CompactStrings"); |
|
79 |
return coder == CODER_LATIN1; |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
80 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
81 |
|
53418
bc2bb4eee477
8217442: Optimize native accesses to String.value
redestad
parents:
53380
diff
changeset
|
82 |
int java_lang_String::length(oop java_string, typeArrayOop value) { |
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
83 |
assert(initialized, "Must be initialized"); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
84 |
assert(is_instance(java_string), "must be java_string"); |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
85 |
assert(value_equals(value, java_lang_String::value(java_string)), |
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
86 |
"value must be equal to java_lang_String::value(java_string)"); |
48618
688e5cbd0b91
8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents:
47998
diff
changeset
|
87 |
if (value == NULL) { |
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
88 |
return 0; |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
89 |
} |
48618
688e5cbd0b91
8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents:
47998
diff
changeset
|
90 |
int arr_length = value->length(); |
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
91 |
if (!is_latin1(java_string)) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
92 |
assert((arr_length & 1) == 0, "should be even for UTF16 string"); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
93 |
arr_length >>= 1; // convert number of bytes to number of elements |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
94 |
} |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
95 |
return arr_length; |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
96 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
97 |
|
53418
bc2bb4eee477
8217442: Optimize native accesses to String.value
redestad
parents:
53380
diff
changeset
|
98 |
int java_lang_String::length(oop java_string) { |
bc2bb4eee477
8217442: Optimize native accesses to String.value
redestad
parents:
53380
diff
changeset
|
99 |
assert(initialized, "Must be initialized"); |
bc2bb4eee477
8217442: Optimize native accesses to String.value
redestad
parents:
53380
diff
changeset
|
100 |
assert(is_instance(java_string), "must be java_string"); |
bc2bb4eee477
8217442: Optimize native accesses to String.value
redestad
parents:
53380
diff
changeset
|
101 |
typeArrayOop value = java_lang_String::value_no_keepalive(java_string); |
bc2bb4eee477
8217442: Optimize native accesses to String.value
redestad
parents:
53380
diff
changeset
|
102 |
return length(java_string, value); |
bc2bb4eee477
8217442: Optimize native accesses to String.value
redestad
parents:
53380
diff
changeset
|
103 |
} |
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
104 |
|
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
105 |
bool java_lang_String::is_instance_inlined(oop obj) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
106 |
return obj != NULL && obj->klass() == SystemDictionary::String_klass(); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
107 |
} |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
108 |
|
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
109 |
// Accessors |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
110 |
oop java_lang_ref_Reference::referent(oop ref) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
111 |
return ref->obj_field(referent_offset); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
112 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
113 |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
114 |
void java_lang_ref_Reference::set_referent(oop ref, oop value) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
115 |
ref->obj_field_put(referent_offset, value); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
116 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
117 |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
118 |
void java_lang_ref_Reference::set_referent_raw(oop ref, oop value) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
119 |
ref->obj_field_put_raw(referent_offset, value); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
120 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
121 |
|
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48618
diff
changeset
|
122 |
HeapWord* java_lang_ref_Reference::referent_addr_raw(oop ref) { |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48618
diff
changeset
|
123 |
return ref->obj_field_addr_raw<HeapWord>(referent_offset); |
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
124 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
125 |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
126 |
oop java_lang_ref_Reference::next(oop ref) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
127 |
return ref->obj_field(next_offset); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
128 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
129 |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
130 |
void java_lang_ref_Reference::set_next(oop ref, oop value) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
131 |
ref->obj_field_put(next_offset, value); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
132 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
133 |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
134 |
void java_lang_ref_Reference::set_next_raw(oop ref, oop value) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
135 |
ref->obj_field_put_raw(next_offset, value); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
136 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
137 |
|
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48618
diff
changeset
|
138 |
HeapWord* java_lang_ref_Reference::next_addr_raw(oop ref) { |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48618
diff
changeset
|
139 |
return ref->obj_field_addr_raw<HeapWord>(next_offset); |
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
140 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
141 |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
142 |
oop java_lang_ref_Reference::discovered(oop ref) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
143 |
return ref->obj_field(discovered_offset); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
144 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
145 |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
146 |
void java_lang_ref_Reference::set_discovered(oop ref, oop value) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
147 |
ref->obj_field_put(discovered_offset, value); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
148 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
149 |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
150 |
void java_lang_ref_Reference::set_discovered_raw(oop ref, oop value) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
151 |
ref->obj_field_put_raw(discovered_offset, value); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
152 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
153 |
|
49041
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48618
diff
changeset
|
154 |
HeapWord* java_lang_ref_Reference::discovered_addr_raw(oop ref) { |
44122f767467
8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents:
48618
diff
changeset
|
155 |
return ref->obj_field_addr_raw<HeapWord>(discovered_offset); |
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
156 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
157 |
|
52383
71564a544d4c
8212184: Incorrect oop ref strength used for referents in FinalReference
pliden
parents:
50063
diff
changeset
|
158 |
bool java_lang_ref_Reference::is_final(oop ref) { |
71564a544d4c
8212184: Incorrect oop ref strength used for referents in FinalReference
pliden
parents:
50063
diff
changeset
|
159 |
return InstanceKlass::cast(ref->klass())->reference_type() == REF_FINAL; |
71564a544d4c
8212184: Incorrect oop ref strength used for referents in FinalReference
pliden
parents:
50063
diff
changeset
|
160 |
} |
54102
fab8496eb541
8220496: Race in java_lang_String::length() when deduplicating
redestad
parents:
53447
diff
changeset
|
161 |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
162 |
bool java_lang_ref_Reference::is_phantom(oop ref) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
163 |
return InstanceKlass::cast(ref->klass())->reference_type() == REF_PHANTOM; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
164 |
} |
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34280
diff
changeset
|
165 |
|
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
166 |
inline void java_lang_invoke_CallSite::set_target_volatile(oop site, oop target) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
167 |
site->obj_field_put_volatile(_target_offset, target); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
168 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
169 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
170 |
inline oop java_lang_invoke_CallSite::target(oop site) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
171 |
return site->obj_field(_target_offset); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
172 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
173 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
174 |
inline void java_lang_invoke_CallSite::set_target(oop site, oop target) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
175 |
site->obj_field_put(_target_offset, target); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
176 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
177 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
178 |
inline bool java_lang_invoke_CallSite::is_instance(oop obj) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
179 |
return obj != NULL && is_subclass(obj->klass()); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
180 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
181 |
|
31037
01a5c5fa5681
8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents:
30263
diff
changeset
|
182 |
inline bool java_lang_invoke_MethodHandleNatives_CallSiteContext::is_instance(oop obj) { |
01a5c5fa5681
8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents:
30263
diff
changeset
|
183 |
return obj != NULL && is_subclass(obj->klass()); |
01a5c5fa5681
8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents:
30263
diff
changeset
|
184 |
} |
01a5c5fa5681
8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents:
30263
diff
changeset
|
185 |
|
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
186 |
inline bool java_lang_invoke_MemberName::is_instance(oop obj) { |
46505
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
44520
diff
changeset
|
187 |
return obj != NULL && obj->klass() == SystemDictionary::MemberName_klass(); |
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
44520
diff
changeset
|
188 |
} |
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
44520
diff
changeset
|
189 |
|
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
44520
diff
changeset
|
190 |
inline bool java_lang_invoke_ResolvedMethodName::is_instance(oop obj) { |
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
44520
diff
changeset
|
191 |
return obj != NULL && obj->klass() == SystemDictionary::ResolvedMethodName_klass(); |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
192 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
193 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
194 |
inline bool java_lang_invoke_MethodType::is_instance(oop obj) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
195 |
return obj != NULL && obj->klass() == SystemDictionary::MethodType_klass(); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
196 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
197 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
198 |
inline bool java_lang_invoke_MethodHandle::is_instance(oop obj) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
199 |
return obj != NULL && is_subclass(obj->klass()); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
200 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
201 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
202 |
inline bool java_lang_Class::is_instance(oop obj) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
203 |
return obj != NULL && obj->klass() == SystemDictionary::Class_klass(); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
204 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
205 |
|
53143
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
206 |
inline bool java_lang_Class::is_primitive(oop java_class) { |
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
207 |
// should assert: |
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
208 |
//assert(java_lang_Class::is_instance(java_class), "must be a Class object"); |
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
209 |
bool is_primitive = (java_class->metadata_field(_klass_offset) == NULL); |
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
210 |
|
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
211 |
#ifdef ASSERT |
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
212 |
if (is_primitive) { |
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
213 |
Klass* k = ((Klass*)java_class->metadata_field(_array_klass_offset)); |
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
214 |
assert(k == NULL || is_java_primitive(ArrayKlass::cast(k)->element_type()), |
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
215 |
"Should be either the T_VOID primitive or a java primitive"); |
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
216 |
} |
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
217 |
#endif |
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
218 |
|
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
219 |
return is_primitive; |
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
220 |
} |
6b7240a24b56
8216157: Enable inlining of java_lang_Class::is_primitive
redestad
parents:
52383
diff
changeset
|
221 |
|
53380
c8208421a860
8217325: Enable inlining of java_lang_Class::oop_size_raw
redestad
parents:
53244
diff
changeset
|
222 |
inline int java_lang_Class::oop_size_raw(oop java_class) { |
c8208421a860
8217325: Enable inlining of java_lang_Class::oop_size_raw
redestad
parents:
53244
diff
changeset
|
223 |
assert(_oop_size_offset != 0, "must be set"); |
c8208421a860
8217325: Enable inlining of java_lang_Class::oop_size_raw
redestad
parents:
53244
diff
changeset
|
224 |
int size = java_class->int_field_raw(_oop_size_offset); |
c8208421a860
8217325: Enable inlining of java_lang_Class::oop_size_raw
redestad
parents:
53244
diff
changeset
|
225 |
assert(size > 0, "Oop size must be greater than zero, not %d", size); |
c8208421a860
8217325: Enable inlining of java_lang_Class::oop_size_raw
redestad
parents:
53244
diff
changeset
|
226 |
return size; |
c8208421a860
8217325: Enable inlining of java_lang_Class::oop_size_raw
redestad
parents:
53244
diff
changeset
|
227 |
} |
c8208421a860
8217325: Enable inlining of java_lang_Class::oop_size_raw
redestad
parents:
53244
diff
changeset
|
228 |
|
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
229 |
inline bool java_lang_invoke_DirectMethodHandle::is_instance(oop obj) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
230 |
return obj != NULL && is_subclass(obj->klass()); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
231 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
232 |
|
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
43422
diff
changeset
|
233 |
inline bool java_lang_Module::is_instance(oop obj) { |
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
43422
diff
changeset
|
234 |
return obj != NULL && obj->klass() == SystemDictionary::Module_klass(); |
36508 | 235 |
} |
236 |
||
34280 | 237 |
inline int Backtrace::merge_bci_and_version(int bci, int version) { |
238 |
// only store u2 for version, checking for overflow. |
|
239 |
if (version > USHRT_MAX || version < 0) version = USHRT_MAX; |
|
240 |
assert((jushort)bci == bci, "bci should be short"); |
|
241 |
return build_int_from_shorts(version, bci); |
|
242 |
} |
|
243 |
||
244 |
inline int Backtrace::merge_mid_and_cpref(int mid, int cpref) { |
|
245 |
// only store u2 for mid and cpref, checking for overflow. |
|
246 |
assert((jushort)mid == mid, "mid should be short"); |
|
247 |
assert((jushort)cpref == cpref, "cpref should be short"); |
|
248 |
return build_int_from_shorts(cpref, mid); |
|
249 |
} |
|
250 |
||
251 |
inline int Backtrace::bci_at(unsigned int merged) { |
|
252 |
return extract_high_short_from_int(merged); |
|
253 |
} |
|
254 |
||
255 |
inline int Backtrace::version_at(unsigned int merged) { |
|
256 |
return extract_low_short_from_int(merged); |
|
257 |
} |
|
258 |
||
259 |
inline int Backtrace::mid_at(unsigned int merged) { |
|
260 |
return extract_high_short_from_int(merged); |
|
261 |
} |
|
262 |
||
263 |
inline int Backtrace::cpref_at(unsigned int merged) { |
|
264 |
return extract_low_short_from_int(merged); |
|
265 |
} |
|
266 |
||
267 |
inline int Backtrace::get_line_number(const methodHandle& method, int bci) { |
|
268 |
int line_number = 0; |
|
269 |
if (method->is_native()) { |
|
270 |
// Negative value different from -1 below, enabling Java code in |
|
271 |
// class java.lang.StackTraceElement to distinguish "native" from |
|
272 |
// "no LineNumberTable". JDK tests for -2. |
|
273 |
line_number = -2; |
|
274 |
} else { |
|
275 |
// Returns -1 if no LineNumberTable, and otherwise actual line number |
|
276 |
line_number = method->line_number_from_bci(bci); |
|
277 |
} |
|
278 |
return line_number; |
|
279 |
} |
|
280 |
||
281 |
inline Symbol* Backtrace::get_source_file_name(InstanceKlass* holder, int version) { |
|
37475
0da78fa10d78
8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents:
36508
diff
changeset
|
282 |
// RedefineClasses() currently permits redefine operations to |
0da78fa10d78
8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents:
36508
diff
changeset
|
283 |
// happen in parallel using a "last one wins" philosophy. That |
0da78fa10d78
8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents:
36508
diff
changeset
|
284 |
// spec laxness allows the constant pool entry associated with |
0da78fa10d78
8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents:
36508
diff
changeset
|
285 |
// the source_file_name_index for any older constant pool version |
0da78fa10d78
8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents:
36508
diff
changeset
|
286 |
// to be unstable so we shouldn't try to use it. |
0da78fa10d78
8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents:
36508
diff
changeset
|
287 |
if (holder->constants()->version() != version) { |
0da78fa10d78
8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents:
36508
diff
changeset
|
288 |
return NULL; |
0da78fa10d78
8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents:
36508
diff
changeset
|
289 |
} else { |
0da78fa10d78
8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents:
36508
diff
changeset
|
290 |
return holder->source_file_name(); |
0da78fa10d78
8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents:
36508
diff
changeset
|
291 |
} |
34280 | 292 |
} |
293 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53143
diff
changeset
|
294 |
#endif // SHARE_CLASSFILE_JAVACLASSES_INLINE_HPP |