Mercurial > hg > graal-compiler
annotate src/share/vm/prims/unsafe.cpp @ 9974:01dd93600d02
Add comments in unsafe access of uncompressed pointers
author | Christos Kotselidis <christos.kotselidis@oracle.com> |
---|---|
date | Mon, 10 Jun 2013 12:18:36 +0200 |
parents | 4d5872186e76 |
children | 836a62f43af9 |
rev | line source |
---|---|
0 | 1 /* |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1324
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1324
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1324
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "classfile/vmSymbols.hpp" | |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
7425
diff
changeset
|
27 #include "utilities/macros.hpp" |
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
7425
diff
changeset
|
28 #if INCLUDE_ALL_GCS |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
29 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
7425
diff
changeset
|
30 #endif // INCLUDE_ALL_GCS |
1972 | 31 #include "memory/allocation.inline.hpp" |
32 #include "prims/jni.h" | |
33 #include "prims/jvm.h" | |
34 #include "runtime/globals.hpp" | |
35 #include "runtime/interfaceSupport.hpp" | |
36 #include "runtime/reflection.hpp" | |
37 #include "runtime/synchronizer.hpp" | |
38 #include "services/threadService.hpp" | |
39 #include "utilities/copy.hpp" | |
40 #include "utilities/dtrace.hpp" | |
41 | |
0 | 42 /* |
43 * Implementation of class sun.misc.Unsafe | |
44 */ | |
45 | |
4006 | 46 #ifndef USDT2 |
1324
e392695de029
6935224: Adding new DTrace probes to work with Palantir
fparain
parents:
845
diff
changeset
|
47 HS_DTRACE_PROBE_DECL3(hotspot, thread__park__begin, uintptr_t, int, long long); |
e392695de029
6935224: Adding new DTrace probes to work with Palantir
fparain
parents:
845
diff
changeset
|
48 HS_DTRACE_PROBE_DECL1(hotspot, thread__park__end, uintptr_t); |
e392695de029
6935224: Adding new DTrace probes to work with Palantir
fparain
parents:
845
diff
changeset
|
49 HS_DTRACE_PROBE_DECL1(hotspot, thread__unpark, uintptr_t); |
4006 | 50 #endif /* !USDT2 */ |
1324
e392695de029
6935224: Adding new DTrace probes to work with Palantir
fparain
parents:
845
diff
changeset
|
51 |
0 | 52 #define MAX_OBJECT_SIZE \ |
53 ( arrayOopDesc::header_size(T_DOUBLE) * HeapWordSize \ | |
54 + ((julong)max_jint * sizeof(double)) ) | |
55 | |
56 | |
57 #define UNSAFE_ENTRY(result_type, header) \ | |
58 JVM_ENTRY(result_type, header) | |
59 | |
60 // Can't use UNSAFE_LEAF because it has the signature of a straight | |
61 // call into the runtime (just like JVM_LEAF, funny that) but it's | |
62 // called like a Java Native and thus the wrapper built for it passes | |
63 // arguments like a JNI call. It expects those arguments to be popped | |
64 // from the stack on Intel like all good JNI args are, and adjusts the | |
65 // stack according. Since the JVM_LEAF call expects no extra | |
66 // arguments the stack isn't popped in the C code, is pushed by the | |
67 // wrapper and we get sick. | |
68 //#define UNSAFE_LEAF(result_type, header) \ | |
69 // JVM_LEAF(result_type, header) | |
70 | |
71 #define UNSAFE_END JVM_END | |
72 | |
73 #define UnsafeWrapper(arg) /*nothing, for the present*/ | |
74 | |
75 | |
76 inline void* addr_from_java(jlong addr) { | |
77 // This assert fails in a variety of ways on 32-bit systems. | |
78 // It is impossible to predict whether native code that converts | |
79 // pointers to longs will sign-extend or zero-extend the addresses. | |
80 //assert(addr == (uintptr_t)addr, "must not be odd high bits"); | |
81 return (void*)(uintptr_t)addr; | |
82 } | |
83 | |
84 inline jlong addr_to_java(void* p) { | |
85 assert(p == (void*)(uintptr_t)p, "must not be odd high bits"); | |
86 return (uintptr_t)p; | |
87 } | |
88 | |
89 | |
90 // Note: The VM's obj_field and related accessors use byte-scaled | |
91 // ("unscaled") offsets, just as the unsafe methods do. | |
92 | |
93 // However, the method Unsafe.fieldOffset explicitly declines to | |
94 // guarantee this. The field offset values manipulated by the Java user | |
95 // through the Unsafe API are opaque cookies that just happen to be byte | |
96 // offsets. We represent this state of affairs by passing the cookies | |
97 // through conversion functions when going between the VM and the Unsafe API. | |
98 // The conversion functions just happen to be no-ops at present. | |
99 | |
100 inline jlong field_offset_to_byte_offset(jlong field_offset) { | |
101 return field_offset; | |
102 } | |
103 | |
104 inline jlong field_offset_from_byte_offset(jlong byte_offset) { | |
105 return byte_offset; | |
106 } | |
107 | |
108 inline jint invocation_key_from_method_slot(jint slot) { | |
109 return slot; | |
110 } | |
111 | |
112 inline jint invocation_key_to_method_slot(jint key) { | |
113 return key; | |
114 } | |
115 | |
116 inline void* index_oop_from_field_offset_long(oop p, jlong field_offset) { | |
117 jlong byte_offset = field_offset_to_byte_offset(field_offset); | |
2316
d411927672ed
7012072: CompileTheWorld causes incorrect class initialization
never
parents:
2177
diff
changeset
|
118 // Don't allow unsafe to be used to read or write the header word of oops |
9039
0f090aa237e7
weakened assertion in unsafe.cpp for GRAAL builds
Doug Simon <doug.simon@oracle.com>
parents:
8883
diff
changeset
|
119 // unless running GRAAL which wants to read the misc word for example when |
0f090aa237e7
weakened assertion in unsafe.cpp for GRAAL builds
Doug Simon <doug.simon@oracle.com>
parents:
8883
diff
changeset
|
120 // interpreting computeHashCode(). |
9094
6194aefabf1a
weakened assertion in unsafe.cpp for GRAAL builds such that non-GRAAL builds still work
Doug Simon <doug.simon@oracle.com>
parents:
9039
diff
changeset
|
121 #ifndef GRAAL |
6194aefabf1a
weakened assertion in unsafe.cpp for GRAAL builds such that non-GRAAL builds still work
Doug Simon <doug.simon@oracle.com>
parents:
9039
diff
changeset
|
122 assert(p == NULL || field_offset >= oopDesc::header_size(), "offset must be outside of header"); |
6194aefabf1a
weakened assertion in unsafe.cpp for GRAAL builds such that non-GRAAL builds still work
Doug Simon <doug.simon@oracle.com>
parents:
9039
diff
changeset
|
123 #endif |
0 | 124 #ifdef ASSERT |
125 if (p != NULL) { | |
126 assert(byte_offset >= 0 && byte_offset <= (jlong)MAX_OBJECT_SIZE, "sane offset"); | |
127 if (byte_offset == (jint)byte_offset) { | |
128 void* ptr_plus_disp = (address)p + byte_offset; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
129 assert((void*)p->obj_field_addr<oop>((jint)byte_offset) == ptr_plus_disp, |
0 | 130 "raw [ptr+disp] must be consistent with oop::field_base"); |
131 } | |
6889
e81a8af10cd9
8001071: Add simple range check into VM implemenation of Unsafe access methods
kvn
parents:
6831
diff
changeset
|
132 jlong p_size = HeapWordSize * (jlong)(p->size()); |
e81a8af10cd9
8001071: Add simple range check into VM implemenation of Unsafe access methods
kvn
parents:
6831
diff
changeset
|
133 assert(byte_offset < p_size, err_msg("Unsafe access: offset " INT64_FORMAT " > object's size " INT64_FORMAT, byte_offset, p_size)); |
0 | 134 } |
135 #endif | |
136 if (sizeof(char*) == sizeof(jint)) // (this constant folds!) | |
137 return (address)p + (jint) byte_offset; | |
138 else | |
139 return (address)p + byte_offset; | |
140 } | |
141 | |
142 // Externally callable versions: | |
143 // (Use these in compiler intrinsics which emulate unsafe primitives.) | |
144 jlong Unsafe_field_offset_to_byte_offset(jlong field_offset) { | |
145 return field_offset; | |
146 } | |
147 jlong Unsafe_field_offset_from_byte_offset(jlong byte_offset) { | |
148 return byte_offset; | |
149 } | |
150 jint Unsafe_invocation_key_from_method_slot(jint slot) { | |
151 return invocation_key_from_method_slot(slot); | |
152 } | |
153 jint Unsafe_invocation_key_to_method_slot(jint key) { | |
154 return invocation_key_to_method_slot(key); | |
155 } | |
156 | |
157 | |
158 ///// Data in the Java heap. | |
159 | |
160 #define GET_FIELD(obj, offset, type_name, v) \ | |
161 oop p = JNIHandles::resolve(obj); \ | |
162 type_name v = *(type_name*)index_oop_from_field_offset_long(p, offset) | |
163 | |
164 #define SET_FIELD(obj, offset, type_name, x) \ | |
165 oop p = JNIHandles::resolve(obj); \ | |
166 *(type_name*)index_oop_from_field_offset_long(p, offset) = x | |
167 | |
168 #define GET_FIELD_VOLATILE(obj, offset, type_name, v) \ | |
169 oop p = JNIHandles::resolve(obj); \ | |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
170 volatile type_name v = OrderAccess::load_acquire((volatile type_name*)index_oop_from_field_offset_long(p, offset)); |
0 | 171 |
172 #define SET_FIELD_VOLATILE(obj, offset, type_name, x) \ | |
173 oop p = JNIHandles::resolve(obj); \ | |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
174 OrderAccess::release_store_fence((volatile type_name*)index_oop_from_field_offset_long(p, offset), x); |
0 | 175 |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
176 // Macros for oops that check UseCompressedOops |
9887
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
177 #ifndef GRAAL |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
178 #define GET_OOP_FIELD(obj, offset, v) \ |
9887
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
179 oop p = JNIHandles::resolve(obj); \ |
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
180 oop v; \ |
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
181 if (UseCompressedOops) { \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
182 narrowOop n = *(narrowOop*)index_oop_from_field_offset_long(p, offset); \ |
9887
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
183 v = oopDesc::decode_heap_oop(n); \ |
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
184 } else { \ |
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
185 v = *(oop*)index_oop_from_field_offset_long(p, offset); \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
186 } |
9887
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
187 #else |
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
188 #define GET_OOP_FIELD(obj, offset, v) \ |
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
189 oop p = JNIHandles::resolve(obj); \ |
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
190 oop v; \ |
9974
01dd93600d02
Add comments in unsafe access of uncompressed pointers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9887
diff
changeset
|
191 /* Uncompression is not performed to unsafeAccess with null object. |
01dd93600d02
Add comments in unsafe access of uncompressed pointers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9887
diff
changeset
|
192 * This concerns accesses to the metaspace such as the classMirrorOffset which is not compressed.*/ \ |
9887
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
193 if (UseCompressedOops && p!=NULL && offset>=oopDesc::header_size()) { \ |
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
194 narrowOop n = *(narrowOop*)index_oop_from_field_offset_long(p, offset); \ |
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
195 v = oopDesc::decode_heap_oop(n); \ |
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
196 } else { \ |
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
197 v = *(oop*)index_oop_from_field_offset_long(p, offset); \ |
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
198 } |
4d5872186e76
Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9094
diff
changeset
|
199 #endif |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
200 |
0 | 201 // Get/SetObject must be special-cased, since it works with handles. |
202 | |
203 // The xxx140 variants for backward compatibility do not allow a full-width offset. | |
204 UNSAFE_ENTRY(jobject, Unsafe_GetObject140(JNIEnv *env, jobject unsafe, jobject obj, jint offset)) | |
205 UnsafeWrapper("Unsafe_GetObject"); | |
206 if (obj == NULL) THROW_0(vmSymbols::java_lang_NullPointerException()); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
207 GET_OOP_FIELD(obj, offset, v) |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
208 jobject ret = JNIHandles::make_local(env, v); |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
7425
diff
changeset
|
209 #if INCLUDE_ALL_GCS |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
210 // We could be accessing the referent field in a reference |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
211 // object. If G1 is enabled then we need to register a non-null |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
212 // referent with the SATB barrier. |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
213 if (UseG1GC) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
214 bool needs_barrier = false; |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
215 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
216 if (ret != NULL) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
217 if (offset == java_lang_ref_Reference::referent_offset) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
218 oop o = JNIHandles::resolve_non_null(obj); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
219 Klass* k = o->klass(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
220 if (InstanceKlass::cast(k)->reference_type() != REF_NONE) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
221 assert(InstanceKlass::cast(k)->is_subclass_of(SystemDictionary::Reference_klass()), "sanity"); |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
222 needs_barrier = true; |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
223 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
224 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
225 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
226 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
227 if (needs_barrier) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
228 oop referent = JNIHandles::resolve(ret); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
229 G1SATBCardTableModRefBS::enqueue(referent); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
230 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
231 } |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
7425
diff
changeset
|
232 #endif // INCLUDE_ALL_GCS |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
233 return ret; |
0 | 234 UNSAFE_END |
235 | |
236 UNSAFE_ENTRY(void, Unsafe_SetObject140(JNIEnv *env, jobject unsafe, jobject obj, jint offset, jobject x_h)) | |
237 UnsafeWrapper("Unsafe_SetObject"); | |
238 if (obj == NULL) THROW(vmSymbols::java_lang_NullPointerException()); | |
239 oop x = JNIHandles::resolve(x_h); | |
240 //SET_FIELD(obj, offset, oop, x); | |
241 oop p = JNIHandles::resolve(obj); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
242 if (UseCompressedOops) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
243 if (x != NULL) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
244 // If there is a heap base pointer, we are obliged to emit a store barrier. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
245 oop_store((narrowOop*)index_oop_from_field_offset_long(p, offset), x); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
246 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
247 narrowOop n = oopDesc::encode_heap_oop_not_null(x); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
248 *(narrowOop*)index_oop_from_field_offset_long(p, offset) = n; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
249 } |
0 | 250 } else { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
251 if (x != NULL) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
252 // If there is a heap base pointer, we are obliged to emit a store barrier. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
253 oop_store((oop*)index_oop_from_field_offset_long(p, offset), x); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
254 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
255 *(oop*)index_oop_from_field_offset_long(p, offset) = x; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
256 } |
0 | 257 } |
258 UNSAFE_END | |
259 | |
260 // The normal variants allow a null base pointer with an arbitrary address. | |
261 // But if the base pointer is non-null, the offset should make some sense. | |
262 // That is, it should be in the range [0, MAX_OBJECT_SIZE]. | |
263 UNSAFE_ENTRY(jobject, Unsafe_GetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) | |
264 UnsafeWrapper("Unsafe_GetObject"); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
265 GET_OOP_FIELD(obj, offset, v) |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
266 jobject ret = JNIHandles::make_local(env, v); |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
7425
diff
changeset
|
267 #if INCLUDE_ALL_GCS |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
268 // We could be accessing the referent field in a reference |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
269 // object. If G1 is enabled then we need to register non-null |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
270 // referent with the SATB barrier. |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
271 if (UseG1GC) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
272 bool needs_barrier = false; |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
273 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
274 if (ret != NULL) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
275 if (offset == java_lang_ref_Reference::referent_offset && obj != NULL) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
276 oop o = JNIHandles::resolve(obj); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
277 Klass* k = o->klass(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
278 if (InstanceKlass::cast(k)->reference_type() != REF_NONE) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
279 assert(InstanceKlass::cast(k)->is_subclass_of(SystemDictionary::Reference_klass()), "sanity"); |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
280 needs_barrier = true; |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
281 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
282 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
283 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
284 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
285 if (needs_barrier) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
286 oop referent = JNIHandles::resolve(ret); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
287 G1SATBCardTableModRefBS::enqueue(referent); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
288 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
289 } |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
7425
diff
changeset
|
290 #endif // INCLUDE_ALL_GCS |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
291 return ret; |
0 | 292 UNSAFE_END |
293 | |
294 UNSAFE_ENTRY(void, Unsafe_SetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) | |
295 UnsafeWrapper("Unsafe_SetObject"); | |
296 oop x = JNIHandles::resolve(x_h); | |
297 oop p = JNIHandles::resolve(obj); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
298 if (UseCompressedOops) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
299 oop_store((narrowOop*)index_oop_from_field_offset_long(p, offset), x); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
300 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
301 oop_store((oop*)index_oop_from_field_offset_long(p, offset), x); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
302 } |
0 | 303 UNSAFE_END |
304 | |
305 UNSAFE_ENTRY(jobject, Unsafe_GetObjectVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) | |
306 UnsafeWrapper("Unsafe_GetObjectVolatile"); | |
6224
56c4f88474b3
7087357: JSR 292: remove obsolete code after 7085860
twisti
parents:
4043
diff
changeset
|
307 oop p = JNIHandles::resolve(obj); |
56c4f88474b3
7087357: JSR 292: remove obsolete code after 7085860
twisti
parents:
4043
diff
changeset
|
308 void* addr = index_oop_from_field_offset_long(p, offset); |
56c4f88474b3
7087357: JSR 292: remove obsolete code after 7085860
twisti
parents:
4043
diff
changeset
|
309 volatile oop v; |
56c4f88474b3
7087357: JSR 292: remove obsolete code after 7085860
twisti
parents:
4043
diff
changeset
|
310 if (UseCompressedOops) { |
56c4f88474b3
7087357: JSR 292: remove obsolete code after 7085860
twisti
parents:
4043
diff
changeset
|
311 volatile narrowOop n = *(volatile narrowOop*) addr; |
56c4f88474b3
7087357: JSR 292: remove obsolete code after 7085860
twisti
parents:
4043
diff
changeset
|
312 v = oopDesc::decode_heap_oop(n); |
56c4f88474b3
7087357: JSR 292: remove obsolete code after 7085860
twisti
parents:
4043
diff
changeset
|
313 } else { |
56c4f88474b3
7087357: JSR 292: remove obsolete code after 7085860
twisti
parents:
4043
diff
changeset
|
314 v = *(volatile oop*) addr; |
56c4f88474b3
7087357: JSR 292: remove obsolete code after 7085860
twisti
parents:
4043
diff
changeset
|
315 } |
56c4f88474b3
7087357: JSR 292: remove obsolete code after 7085860
twisti
parents:
4043
diff
changeset
|
316 OrderAccess::acquire(); |
0 | 317 return JNIHandles::make_local(env, v); |
318 UNSAFE_END | |
319 | |
320 UNSAFE_ENTRY(void, Unsafe_SetObjectVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) | |
321 UnsafeWrapper("Unsafe_SetObjectVolatile"); | |
322 oop x = JNIHandles::resolve(x_h); | |
323 oop p = JNIHandles::resolve(obj); | |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
324 void* addr = index_oop_from_field_offset_long(p, offset); |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
325 OrderAccess::release(); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
326 if (UseCompressedOops) { |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
327 oop_store((narrowOop*)addr, x); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
328 } else { |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
329 oop_store((oop*)addr, x); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
330 } |
0 | 331 OrderAccess::fence(); |
332 UNSAFE_END | |
333 | |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
334 #if defined(SPARC) || defined(X86) |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
335 // Sparc and X86 have atomic jlong (8 bytes) instructions |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
336 |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
337 #else |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
338 // Keep old code for platforms which may not have atomic jlong (8 bytes) instructions |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
339 |
0 | 340 // Volatile long versions must use locks if !VM_Version::supports_cx8(). |
341 // support_cx8 is a surrogate for 'supports atomic long memory ops'. | |
342 | |
343 UNSAFE_ENTRY(jlong, Unsafe_GetLongVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) | |
344 UnsafeWrapper("Unsafe_GetLongVolatile"); | |
345 { | |
346 if (VM_Version::supports_cx8()) { | |
347 GET_FIELD_VOLATILE(obj, offset, jlong, v); | |
348 return v; | |
349 } | |
350 else { | |
351 Handle p (THREAD, JNIHandles::resolve(obj)); | |
352 jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset)); | |
353 ObjectLocker ol(p, THREAD); | |
354 jlong value = *addr; | |
355 return value; | |
356 } | |
357 } | |
358 UNSAFE_END | |
359 | |
360 UNSAFE_ENTRY(void, Unsafe_SetLongVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong x)) | |
361 UnsafeWrapper("Unsafe_SetLongVolatile"); | |
362 { | |
363 if (VM_Version::supports_cx8()) { | |
364 SET_FIELD_VOLATILE(obj, offset, jlong, x); | |
365 } | |
366 else { | |
367 Handle p (THREAD, JNIHandles::resolve(obj)); | |
368 jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset)); | |
369 ObjectLocker ol(p, THREAD); | |
370 *addr = x; | |
371 } | |
372 } | |
373 UNSAFE_END | |
374 | |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
375 #endif // not SPARC and not X86 |
0 | 376 |
377 #define DEFINE_GETSETOOP(jboolean, Boolean) \ | |
378 \ | |
379 UNSAFE_ENTRY(jboolean, Unsafe_Get##Boolean##140(JNIEnv *env, jobject unsafe, jobject obj, jint offset)) \ | |
380 UnsafeWrapper("Unsafe_Get"#Boolean); \ | |
381 if (obj == NULL) THROW_0(vmSymbols::java_lang_NullPointerException()); \ | |
382 GET_FIELD(obj, offset, jboolean, v); \ | |
383 return v; \ | |
384 UNSAFE_END \ | |
385 \ | |
386 UNSAFE_ENTRY(void, Unsafe_Set##Boolean##140(JNIEnv *env, jobject unsafe, jobject obj, jint offset, jboolean x)) \ | |
387 UnsafeWrapper("Unsafe_Set"#Boolean); \ | |
388 if (obj == NULL) THROW(vmSymbols::java_lang_NullPointerException()); \ | |
389 SET_FIELD(obj, offset, jboolean, x); \ | |
390 UNSAFE_END \ | |
391 \ | |
392 UNSAFE_ENTRY(jboolean, Unsafe_Get##Boolean(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) \ | |
393 UnsafeWrapper("Unsafe_Get"#Boolean); \ | |
394 GET_FIELD(obj, offset, jboolean, v); \ | |
395 return v; \ | |
396 UNSAFE_END \ | |
397 \ | |
398 UNSAFE_ENTRY(void, Unsafe_Set##Boolean(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jboolean x)) \ | |
399 UnsafeWrapper("Unsafe_Set"#Boolean); \ | |
400 SET_FIELD(obj, offset, jboolean, x); \ | |
401 UNSAFE_END \ | |
402 \ | |
403 // END DEFINE_GETSETOOP. | |
404 | |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
405 DEFINE_GETSETOOP(jboolean, Boolean) |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
406 DEFINE_GETSETOOP(jbyte, Byte) |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
407 DEFINE_GETSETOOP(jshort, Short); |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
408 DEFINE_GETSETOOP(jchar, Char); |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
409 DEFINE_GETSETOOP(jint, Int); |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
410 DEFINE_GETSETOOP(jlong, Long); |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
411 DEFINE_GETSETOOP(jfloat, Float); |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
412 DEFINE_GETSETOOP(jdouble, Double); |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
413 |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
414 #undef DEFINE_GETSETOOP |
0 | 415 |
416 #define DEFINE_GETSETOOP_VOLATILE(jboolean, Boolean) \ | |
417 \ | |
418 UNSAFE_ENTRY(jboolean, Unsafe_Get##Boolean##Volatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) \ | |
419 UnsafeWrapper("Unsafe_Get"#Boolean); \ | |
420 GET_FIELD_VOLATILE(obj, offset, jboolean, v); \ | |
421 return v; \ | |
422 UNSAFE_END \ | |
423 \ | |
424 UNSAFE_ENTRY(void, Unsafe_Set##Boolean##Volatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jboolean x)) \ | |
425 UnsafeWrapper("Unsafe_Set"#Boolean); \ | |
426 SET_FIELD_VOLATILE(obj, offset, jboolean, x); \ | |
427 UNSAFE_END \ | |
428 \ | |
429 // END DEFINE_GETSETOOP_VOLATILE. | |
430 | |
431 DEFINE_GETSETOOP_VOLATILE(jboolean, Boolean) | |
432 DEFINE_GETSETOOP_VOLATILE(jbyte, Byte) | |
433 DEFINE_GETSETOOP_VOLATILE(jshort, Short); | |
434 DEFINE_GETSETOOP_VOLATILE(jchar, Char); | |
435 DEFINE_GETSETOOP_VOLATILE(jint, Int); | |
436 DEFINE_GETSETOOP_VOLATILE(jfloat, Float); | |
437 DEFINE_GETSETOOP_VOLATILE(jdouble, Double); | |
438 | |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
439 #if defined(SPARC) || defined(X86) |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
440 // Sparc and X86 have atomic jlong (8 bytes) instructions |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
441 DEFINE_GETSETOOP_VOLATILE(jlong, Long); |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
442 #endif |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
443 |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
444 #undef DEFINE_GETSETOOP_VOLATILE |
0 | 445 |
446 // The non-intrinsified versions of setOrdered just use setVolatile | |
447 | |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
448 UNSAFE_ENTRY(void, Unsafe_SetOrderedInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint x)) |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
449 UnsafeWrapper("Unsafe_SetOrderedInt"); |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
450 SET_FIELD_VOLATILE(obj, offset, jint, x); |
0 | 451 UNSAFE_END |
452 | |
453 UNSAFE_ENTRY(void, Unsafe_SetOrderedObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) | |
454 UnsafeWrapper("Unsafe_SetOrderedObject"); | |
455 oop x = JNIHandles::resolve(x_h); | |
456 oop p = JNIHandles::resolve(obj); | |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
457 void* addr = index_oop_from_field_offset_long(p, offset); |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
458 OrderAccess::release(); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
459 if (UseCompressedOops) { |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
460 oop_store((narrowOop*)addr, x); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
461 } else { |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
462 oop_store((oop*)addr, x); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
463 } |
0 | 464 OrderAccess::fence(); |
465 UNSAFE_END | |
466 | |
467 UNSAFE_ENTRY(void, Unsafe_SetOrderedLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong x)) | |
468 UnsafeWrapper("Unsafe_SetOrderedLong"); | |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
469 #if defined(SPARC) || defined(X86) |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
470 // Sparc and X86 have atomic jlong (8 bytes) instructions |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
471 SET_FIELD_VOLATILE(obj, offset, jlong, x); |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
472 #else |
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
473 // Keep old code for platforms which may not have atomic long (8 bytes) instructions |
0 | 474 { |
475 if (VM_Version::supports_cx8()) { | |
476 SET_FIELD_VOLATILE(obj, offset, jlong, x); | |
477 } | |
478 else { | |
479 Handle p (THREAD, JNIHandles::resolve(obj)); | |
480 jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset)); | |
481 ObjectLocker ol(p, THREAD); | |
482 *addr = x; | |
483 } | |
484 } | |
2114
4fc084dac61e
7009756: volatile variables could be broken throw reflection API
kvn
parents:
1972
diff
changeset
|
485 #endif |
0 | 486 UNSAFE_END |
487 | |
7425 | 488 UNSAFE_ENTRY(void, Unsafe_LoadFence(JNIEnv *env, jobject unsafe)) |
489 UnsafeWrapper("Unsafe_LoadFence"); | |
490 OrderAccess::acquire(); | |
491 UNSAFE_END | |
492 | |
493 UNSAFE_ENTRY(void, Unsafe_StoreFence(JNIEnv *env, jobject unsafe)) | |
494 UnsafeWrapper("Unsafe_StoreFence"); | |
495 OrderAccess::release(); | |
496 UNSAFE_END | |
497 | |
498 UNSAFE_ENTRY(void, Unsafe_FullFence(JNIEnv *env, jobject unsafe)) | |
499 UnsafeWrapper("Unsafe_FullFence"); | |
500 OrderAccess::fence(); | |
501 UNSAFE_END | |
502 | |
0 | 503 ////// Data in the C heap. |
504 | |
505 // Note: These do not throw NullPointerException for bad pointers. | |
506 // They just crash. Only a oop base pointer can generate a NullPointerException. | |
507 // | |
508 #define DEFINE_GETSETNATIVE(java_type, Type, native_type) \ | |
509 \ | |
510 UNSAFE_ENTRY(java_type, Unsafe_GetNative##Type(JNIEnv *env, jobject unsafe, jlong addr)) \ | |
511 UnsafeWrapper("Unsafe_GetNative"#Type); \ | |
512 void* p = addr_from_java(addr); \ | |
513 JavaThread* t = JavaThread::current(); \ | |
514 t->set_doing_unsafe_access(true); \ | |
515 java_type x = *(volatile native_type*)p; \ | |
516 t->set_doing_unsafe_access(false); \ | |
517 return x; \ | |
518 UNSAFE_END \ | |
519 \ | |
520 UNSAFE_ENTRY(void, Unsafe_SetNative##Type(JNIEnv *env, jobject unsafe, jlong addr, java_type x)) \ | |
521 UnsafeWrapper("Unsafe_SetNative"#Type); \ | |
522 JavaThread* t = JavaThread::current(); \ | |
523 t->set_doing_unsafe_access(true); \ | |
524 void* p = addr_from_java(addr); \ | |
525 *(volatile native_type*)p = x; \ | |
526 t->set_doing_unsafe_access(false); \ | |
527 UNSAFE_END \ | |
528 \ | |
529 // END DEFINE_GETSETNATIVE. | |
530 | |
531 DEFINE_GETSETNATIVE(jbyte, Byte, signed char) | |
532 DEFINE_GETSETNATIVE(jshort, Short, signed short); | |
533 DEFINE_GETSETNATIVE(jchar, Char, unsigned short); | |
534 DEFINE_GETSETNATIVE(jint, Int, jint); | |
535 // no long -- handled specially | |
536 DEFINE_GETSETNATIVE(jfloat, Float, float); | |
537 DEFINE_GETSETNATIVE(jdouble, Double, double); | |
538 | |
539 #undef DEFINE_GETSETNATIVE | |
540 | |
541 UNSAFE_ENTRY(jlong, Unsafe_GetNativeLong(JNIEnv *env, jobject unsafe, jlong addr)) | |
542 UnsafeWrapper("Unsafe_GetNativeLong"); | |
543 JavaThread* t = JavaThread::current(); | |
544 // We do it this way to avoid problems with access to heap using 64 | |
545 // bit loads, as jlong in heap could be not 64-bit aligned, and on | |
546 // some CPUs (SPARC) it leads to SIGBUS. | |
547 t->set_doing_unsafe_access(true); | |
548 void* p = addr_from_java(addr); | |
549 jlong x; | |
550 if (((intptr_t)p & 7) == 0) { | |
551 // jlong is aligned, do a volatile access | |
552 x = *(volatile jlong*)p; | |
553 } else { | |
554 jlong_accessor acc; | |
555 acc.words[0] = ((volatile jint*)p)[0]; | |
556 acc.words[1] = ((volatile jint*)p)[1]; | |
557 x = acc.long_value; | |
558 } | |
559 t->set_doing_unsafe_access(false); | |
560 return x; | |
561 UNSAFE_END | |
562 | |
563 UNSAFE_ENTRY(void, Unsafe_SetNativeLong(JNIEnv *env, jobject unsafe, jlong addr, jlong x)) | |
564 UnsafeWrapper("Unsafe_SetNativeLong"); | |
565 JavaThread* t = JavaThread::current(); | |
566 // see comment for Unsafe_GetNativeLong | |
567 t->set_doing_unsafe_access(true); | |
568 void* p = addr_from_java(addr); | |
569 if (((intptr_t)p & 7) == 0) { | |
570 // jlong is aligned, do a volatile access | |
571 *(volatile jlong*)p = x; | |
572 } else { | |
573 jlong_accessor acc; | |
574 acc.long_value = x; | |
575 ((volatile jint*)p)[0] = acc.words[0]; | |
576 ((volatile jint*)p)[1] = acc.words[1]; | |
577 } | |
578 t->set_doing_unsafe_access(false); | |
579 UNSAFE_END | |
580 | |
581 | |
582 UNSAFE_ENTRY(jlong, Unsafe_GetNativeAddress(JNIEnv *env, jobject unsafe, jlong addr)) | |
583 UnsafeWrapper("Unsafe_GetNativeAddress"); | |
584 void* p = addr_from_java(addr); | |
585 return addr_to_java(*(void**)p); | |
586 UNSAFE_END | |
587 | |
588 UNSAFE_ENTRY(void, Unsafe_SetNativeAddress(JNIEnv *env, jobject unsafe, jlong addr, jlong x)) | |
589 UnsafeWrapper("Unsafe_SetNativeAddress"); | |
590 void* p = addr_from_java(addr); | |
591 *(void**)p = addr_from_java(x); | |
592 UNSAFE_END | |
593 | |
594 | |
595 ////// Allocation requests | |
596 | |
597 UNSAFE_ENTRY(jobject, Unsafe_AllocateInstance(JNIEnv *env, jobject unsafe, jclass cls)) | |
598 UnsafeWrapper("Unsafe_AllocateInstance"); | |
599 { | |
600 ThreadToNativeFromVM ttnfv(thread); | |
601 return env->AllocObject(cls); | |
602 } | |
603 UNSAFE_END | |
604 | |
605 UNSAFE_ENTRY(jlong, Unsafe_AllocateMemory(JNIEnv *env, jobject unsafe, jlong size)) | |
606 UnsafeWrapper("Unsafe_AllocateMemory"); | |
607 size_t sz = (size_t)size; | |
608 if (sz != (julong)size || size < 0) { | |
609 THROW_0(vmSymbols::java_lang_IllegalArgumentException()); | |
610 } | |
611 if (sz == 0) { | |
612 return 0; | |
613 } | |
614 sz = round_to(sz, HeapWordSize); | |
6197 | 615 void* x = os::malloc(sz, mtInternal); |
0 | 616 if (x == NULL) { |
617 THROW_0(vmSymbols::java_lang_OutOfMemoryError()); | |
618 } | |
619 //Copy::fill_to_words((HeapWord*)x, sz / HeapWordSize); | |
620 return addr_to_java(x); | |
621 UNSAFE_END | |
622 | |
623 UNSAFE_ENTRY(jlong, Unsafe_ReallocateMemory(JNIEnv *env, jobject unsafe, jlong addr, jlong size)) | |
624 UnsafeWrapper("Unsafe_ReallocateMemory"); | |
625 void* p = addr_from_java(addr); | |
626 size_t sz = (size_t)size; | |
627 if (sz != (julong)size || size < 0) { | |
628 THROW_0(vmSymbols::java_lang_IllegalArgumentException()); | |
629 } | |
630 if (sz == 0) { | |
631 os::free(p); | |
632 return 0; | |
633 } | |
634 sz = round_to(sz, HeapWordSize); | |
6197 | 635 void* x = (p == NULL) ? os::malloc(sz, mtInternal) : os::realloc(p, sz, mtInternal); |
0 | 636 if (x == NULL) { |
637 THROW_0(vmSymbols::java_lang_OutOfMemoryError()); | |
638 } | |
639 return addr_to_java(x); | |
640 UNSAFE_END | |
641 | |
642 UNSAFE_ENTRY(void, Unsafe_FreeMemory(JNIEnv *env, jobject unsafe, jlong addr)) | |
643 UnsafeWrapper("Unsafe_FreeMemory"); | |
644 void* p = addr_from_java(addr); | |
645 if (p == NULL) { | |
646 return; | |
647 } | |
648 os::free(p); | |
649 UNSAFE_END | |
650 | |
651 UNSAFE_ENTRY(void, Unsafe_SetMemory(JNIEnv *env, jobject unsafe, jlong addr, jlong size, jbyte value)) | |
652 UnsafeWrapper("Unsafe_SetMemory"); | |
653 size_t sz = (size_t)size; | |
654 if (sz != (julong)size || size < 0) { | |
655 THROW(vmSymbols::java_lang_IllegalArgumentException()); | |
656 } | |
657 char* p = (char*) addr_from_java(addr); | |
658 Copy::fill_to_memory_atomic(p, sz, value); | |
659 UNSAFE_END | |
660 | |
661 UNSAFE_ENTRY(void, Unsafe_SetMemory2(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong size, jbyte value)) | |
662 UnsafeWrapper("Unsafe_SetMemory"); | |
663 size_t sz = (size_t)size; | |
664 if (sz != (julong)size || size < 0) { | |
665 THROW(vmSymbols::java_lang_IllegalArgumentException()); | |
666 } | |
667 oop base = JNIHandles::resolve(obj); | |
668 void* p = index_oop_from_field_offset_long(base, offset); | |
669 Copy::fill_to_memory_atomic(p, sz, value); | |
670 UNSAFE_END | |
671 | |
672 UNSAFE_ENTRY(void, Unsafe_CopyMemory(JNIEnv *env, jobject unsafe, jlong srcAddr, jlong dstAddr, jlong size)) | |
673 UnsafeWrapper("Unsafe_CopyMemory"); | |
674 if (size == 0) { | |
675 return; | |
676 } | |
677 size_t sz = (size_t)size; | |
678 if (sz != (julong)size || size < 0) { | |
679 THROW(vmSymbols::java_lang_IllegalArgumentException()); | |
680 } | |
681 void* src = addr_from_java(srcAddr); | |
682 void* dst = addr_from_java(dstAddr); | |
683 Copy::conjoint_memory_atomic(src, dst, sz); | |
684 UNSAFE_END | |
685 | |
686 UNSAFE_ENTRY(void, Unsafe_CopyMemory2(JNIEnv *env, jobject unsafe, jobject srcObj, jlong srcOffset, jobject dstObj, jlong dstOffset, jlong size)) | |
687 UnsafeWrapper("Unsafe_CopyMemory"); | |
688 if (size == 0) { | |
689 return; | |
690 } | |
691 size_t sz = (size_t)size; | |
692 if (sz != (julong)size || size < 0) { | |
693 THROW(vmSymbols::java_lang_IllegalArgumentException()); | |
694 } | |
695 oop srcp = JNIHandles::resolve(srcObj); | |
696 oop dstp = JNIHandles::resolve(dstObj); | |
697 if (dstp != NULL && !dstp->is_typeArray()) { | |
698 // NYI: This works only for non-oop arrays at present. | |
699 // Generalizing it would be reasonable, but requires card marking. | |
700 // Also, autoboxing a Long from 0L in copyMemory(x,y, 0L,z, n) would be bad. | |
701 THROW(vmSymbols::java_lang_IllegalArgumentException()); | |
702 } | |
703 void* src = index_oop_from_field_offset_long(srcp, srcOffset); | |
704 void* dst = index_oop_from_field_offset_long(dstp, dstOffset); | |
705 Copy::conjoint_memory_atomic(src, dst, sz); | |
706 UNSAFE_END | |
707 | |
708 | |
709 ////// Random queries | |
710 | |
711 // See comment at file start about UNSAFE_LEAF | |
712 //UNSAFE_LEAF(jint, Unsafe_AddressSize()) | |
713 UNSAFE_ENTRY(jint, Unsafe_AddressSize(JNIEnv *env, jobject unsafe)) | |
714 UnsafeWrapper("Unsafe_AddressSize"); | |
715 return sizeof(void*); | |
716 UNSAFE_END | |
717 | |
718 // See comment at file start about UNSAFE_LEAF | |
719 //UNSAFE_LEAF(jint, Unsafe_PageSize()) | |
720 UNSAFE_ENTRY(jint, Unsafe_PageSize(JNIEnv *env, jobject unsafe)) | |
721 UnsafeWrapper("Unsafe_PageSize"); | |
722 return os::vm_page_size(); | |
723 UNSAFE_END | |
724 | |
725 jint find_field_offset(jobject field, int must_be_static, TRAPS) { | |
726 if (field == NULL) { | |
727 THROW_0(vmSymbols::java_lang_NullPointerException()); | |
728 } | |
729 | |
730 oop reflected = JNIHandles::resolve_non_null(field); | |
731 oop mirror = java_lang_reflect_Field::clazz(reflected); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
732 Klass* k = java_lang_Class::as_Klass(mirror); |
0 | 733 int slot = java_lang_reflect_Field::slot(reflected); |
734 int modifiers = java_lang_reflect_Field::modifiers(reflected); | |
735 | |
736 if (must_be_static >= 0) { | |
737 int really_is_static = ((modifiers & JVM_ACC_STATIC) != 0); | |
738 if (must_be_static != really_is_static) { | |
739 THROW_0(vmSymbols::java_lang_IllegalArgumentException()); | |
740 } | |
741 } | |
742 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
743 int offset = InstanceKlass::cast(k)->field_offset(slot); |
0 | 744 return field_offset_from_byte_offset(offset); |
745 } | |
746 | |
747 UNSAFE_ENTRY(jlong, Unsafe_ObjectFieldOffset(JNIEnv *env, jobject unsafe, jobject field)) | |
748 UnsafeWrapper("Unsafe_ObjectFieldOffset"); | |
749 return find_field_offset(field, 0, THREAD); | |
750 UNSAFE_END | |
751 | |
752 UNSAFE_ENTRY(jlong, Unsafe_StaticFieldOffset(JNIEnv *env, jobject unsafe, jobject field)) | |
753 UnsafeWrapper("Unsafe_StaticFieldOffset"); | |
754 return find_field_offset(field, 1, THREAD); | |
755 UNSAFE_END | |
756 | |
757 UNSAFE_ENTRY(jobject, Unsafe_StaticFieldBaseFromField(JNIEnv *env, jobject unsafe, jobject field)) | |
758 UnsafeWrapper("Unsafe_StaticFieldBase"); | |
759 // Note: In this VM implementation, a field address is always a short | |
760 // offset from the base of a a klass metaobject. Thus, the full dynamic | |
761 // range of the return type is never used. However, some implementations | |
762 // might put the static field inside an array shared by many classes, | |
763 // or even at a fixed address, in which case the address could be quite | |
764 // large. In that last case, this function would return NULL, since | |
765 // the address would operate alone, without any base pointer. | |
766 | |
767 if (field == NULL) THROW_0(vmSymbols::java_lang_NullPointerException()); | |
768 | |
769 oop reflected = JNIHandles::resolve_non_null(field); | |
770 oop mirror = java_lang_reflect_Field::clazz(reflected); | |
771 int modifiers = java_lang_reflect_Field::modifiers(reflected); | |
772 | |
773 if ((modifiers & JVM_ACC_STATIC) == 0) { | |
774 THROW_0(vmSymbols::java_lang_IllegalArgumentException()); | |
775 } | |
776 | |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2316
diff
changeset
|
777 return JNIHandles::make_local(env, mirror); |
0 | 778 UNSAFE_END |
779 | |
780 //@deprecated | |
781 UNSAFE_ENTRY(jint, Unsafe_FieldOffset(JNIEnv *env, jobject unsafe, jobject field)) | |
782 UnsafeWrapper("Unsafe_FieldOffset"); | |
783 // tries (but fails) to be polymorphic between static and non-static: | |
784 jlong offset = find_field_offset(field, -1, THREAD); | |
785 guarantee(offset == (jint)offset, "offset fits in 32 bits"); | |
786 return (jint)offset; | |
787 UNSAFE_END | |
788 | |
789 //@deprecated | |
790 UNSAFE_ENTRY(jobject, Unsafe_StaticFieldBaseFromClass(JNIEnv *env, jobject unsafe, jobject clazz)) | |
791 UnsafeWrapper("Unsafe_StaticFieldBase"); | |
792 if (clazz == NULL) { | |
793 THROW_0(vmSymbols::java_lang_NullPointerException()); | |
794 } | |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2316
diff
changeset
|
795 return JNIHandles::make_local(env, JNIHandles::resolve_non_null(clazz)); |
0 | 796 UNSAFE_END |
797 | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
798 UNSAFE_ENTRY(void, Unsafe_EnsureClassInitialized(JNIEnv *env, jobject unsafe, jobject clazz)) { |
0 | 799 UnsafeWrapper("Unsafe_EnsureClassInitialized"); |
800 if (clazz == NULL) { | |
801 THROW(vmSymbols::java_lang_NullPointerException()); | |
802 } | |
803 oop mirror = JNIHandles::resolve_non_null(clazz); | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
804 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
805 Klass* klass = java_lang_Class::as_Klass(mirror); |
6983 | 806 if (klass != NULL && klass->should_be_initialized()) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
807 InstanceKlass* k = InstanceKlass::cast(klass); |
0 | 808 k->initialize(CHECK); |
809 } | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
810 } |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
811 UNSAFE_END |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
812 |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
813 UNSAFE_ENTRY(jboolean, Unsafe_ShouldBeInitialized(JNIEnv *env, jobject unsafe, jobject clazz)) { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
814 UnsafeWrapper("Unsafe_ShouldBeInitialized"); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
815 if (clazz == NULL) { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
816 THROW_(vmSymbols::java_lang_NullPointerException(), false); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
817 } |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
818 oop mirror = JNIHandles::resolve_non_null(clazz); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
819 Klass* klass = java_lang_Class::as_Klass(mirror); |
6983 | 820 if (klass != NULL && klass->should_be_initialized()) { |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
821 return true; |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
822 } |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
823 return false; |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
824 } |
0 | 825 UNSAFE_END |
826 | |
827 static void getBaseAndScale(int& base, int& scale, jclass acls, TRAPS) { | |
828 if (acls == NULL) { | |
829 THROW(vmSymbols::java_lang_NullPointerException()); | |
830 } | |
831 oop mirror = JNIHandles::resolve_non_null(acls); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
832 Klass* k = java_lang_Class::as_Klass(mirror); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
833 if (k == NULL || !k->oop_is_array()) { |
0 | 834 THROW(vmSymbols::java_lang_InvalidClassException()); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
835 } else if (k->oop_is_objArray()) { |
0 | 836 base = arrayOopDesc::base_offset_in_bytes(T_OBJECT); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
837 scale = heapOopSize; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
838 } else if (k->oop_is_typeArray()) { |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
839 TypeArrayKlass* tak = TypeArrayKlass::cast(k); |
0 | 840 base = tak->array_header_in_bytes(); |
841 assert(base == arrayOopDesc::base_offset_in_bytes(tak->element_type()), "array_header_size semantics ok"); | |
842 scale = (1 << tak->log2_element_size()); | |
843 } else { | |
844 ShouldNotReachHere(); | |
845 } | |
846 } | |
847 | |
848 UNSAFE_ENTRY(jint, Unsafe_ArrayBaseOffset(JNIEnv *env, jobject unsafe, jclass acls)) | |
849 UnsafeWrapper("Unsafe_ArrayBaseOffset"); | |
850 int base, scale; | |
851 getBaseAndScale(base, scale, acls, CHECK_0); | |
852 return field_offset_from_byte_offset(base); | |
853 UNSAFE_END | |
854 | |
855 | |
856 UNSAFE_ENTRY(jint, Unsafe_ArrayIndexScale(JNIEnv *env, jobject unsafe, jclass acls)) | |
857 UnsafeWrapper("Unsafe_ArrayIndexScale"); | |
858 int base, scale; | |
859 getBaseAndScale(base, scale, acls, CHECK_0); | |
860 // This VM packs both fields and array elements down to the byte. | |
861 // But watch out: If this changes, so that array references for | |
862 // a given primitive type (say, T_BOOLEAN) use different memory units | |
863 // than fields, this method MUST return zero for such arrays. | |
864 // For example, the VM used to store sub-word sized fields in full | |
865 // words in the object layout, so that accessors like getByte(Object,int) | |
866 // did not really do what one might expect for arrays. Therefore, | |
867 // this function used to report a zero scale factor, so that the user | |
868 // would know not to attempt to access sub-word array elements. | |
869 // // Code for unpacked fields: | |
870 // if (scale < wordSize) return 0; | |
871 | |
872 // The following allows for a pretty general fieldOffset cookie scheme, | |
873 // but requires it to be linear in byte offset. | |
874 return field_offset_from_byte_offset(scale) - field_offset_from_byte_offset(0); | |
875 UNSAFE_END | |
876 | |
877 | |
878 static inline void throw_new(JNIEnv *env, const char *ename) { | |
879 char buf[100]; | |
880 strcpy(buf, "java/lang/"); | |
881 strcat(buf, ename); | |
882 jclass cls = env->FindClass(buf); | |
883 char* msg = NULL; | |
884 env->ThrowNew(cls, msg); | |
885 } | |
886 | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
887 static jclass Unsafe_DefineClass_impl(JNIEnv *env, jstring name, jbyteArray data, int offset, int length, jobject loader, jobject pd) { |
0 | 888 { |
889 // Code lifted from JDK 1.3 ClassLoader.c | |
890 | |
891 jbyte *body; | |
892 char *utfName; | |
893 jclass result = 0; | |
894 char buf[128]; | |
895 | |
896 if (UsePerfData) { | |
897 ClassLoader::unsafe_defineClassCallCounter()->inc(); | |
898 } | |
899 | |
900 if (data == NULL) { | |
901 throw_new(env, "NullPointerException"); | |
902 return 0; | |
903 } | |
904 | |
905 /* Work around 4153825. malloc crashes on Solaris when passed a | |
906 * negative size. | |
907 */ | |
908 if (length < 0) { | |
909 throw_new(env, "ArrayIndexOutOfBoundsException"); | |
910 return 0; | |
911 } | |
912 | |
6197 | 913 body = NEW_C_HEAP_ARRAY(jbyte, length, mtInternal); |
0 | 914 |
915 if (body == 0) { | |
916 throw_new(env, "OutOfMemoryError"); | |
917 return 0; | |
918 } | |
919 | |
920 env->GetByteArrayRegion(data, offset, length, body); | |
921 | |
922 if (env->ExceptionOccurred()) | |
923 goto free_body; | |
924 | |
925 if (name != NULL) { | |
926 uint len = env->GetStringUTFLength(name); | |
927 int unicode_len = env->GetStringLength(name); | |
928 if (len >= sizeof(buf)) { | |
6197 | 929 utfName = NEW_C_HEAP_ARRAY(char, len + 1, mtInternal); |
0 | 930 if (utfName == NULL) { |
931 throw_new(env, "OutOfMemoryError"); | |
932 goto free_body; | |
933 } | |
934 } else { | |
935 utfName = buf; | |
936 } | |
937 env->GetStringUTFRegion(name, 0, unicode_len, utfName); | |
938 //VerifyFixClassname(utfName); | |
939 for (uint i = 0; i < len; i++) { | |
940 if (utfName[i] == '.') utfName[i] = '/'; | |
941 } | |
942 } else { | |
943 utfName = NULL; | |
944 } | |
945 | |
946 result = JVM_DefineClass(env, utfName, loader, body, length, pd); | |
947 | |
948 if (utfName && utfName != buf) | |
6197 | 949 FREE_C_HEAP_ARRAY(char, utfName, mtInternal); |
0 | 950 |
951 free_body: | |
6197 | 952 FREE_C_HEAP_ARRAY(jbyte, body, mtInternal); |
0 | 953 return result; |
954 } | |
955 } | |
956 | |
957 | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
958 UNSAFE_ENTRY(jclass, Unsafe_DefineClass(JNIEnv *env, jobject unsafe, jstring name, jbyteArray data, int offset, int length, jobject loader, jobject pd)) |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
959 UnsafeWrapper("Unsafe_DefineClass"); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
960 { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
961 ThreadToNativeFromVM ttnfv(thread); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
962 return Unsafe_DefineClass_impl(env, name, data, offset, length, loader, pd); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
963 } |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
964 UNSAFE_END |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
965 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
966 |
0 | 967 UNSAFE_ENTRY(jclass, Unsafe_DefineClass0(JNIEnv *env, jobject unsafe, jstring name, jbyteArray data, int offset, int length)) |
968 UnsafeWrapper("Unsafe_DefineClass"); | |
969 { | |
970 ThreadToNativeFromVM ttnfv(thread); | |
971 | |
972 int depthFromDefineClass0 = 1; | |
973 jclass caller = JVM_GetCallerClass(env, depthFromDefineClass0); | |
974 jobject loader = (caller == NULL) ? NULL : JVM_GetClassLoader(env, caller); | |
975 jobject pd = (caller == NULL) ? NULL : JVM_GetProtectionDomain(env, caller); | |
976 | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
977 return Unsafe_DefineClass_impl(env, name, data, offset, length, loader, pd); |
0 | 978 } |
979 UNSAFE_END | |
980 | |
981 | |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
982 #define DAC_Args CLS"[B["OBJ |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
983 // define a class but do not make it known to the class loader or system dictionary |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
984 // - host_class: supplies context for linkage, access control, protection domain, and class loader |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
985 // - data: bytes of a class file, a raw memory address (length gives the number of bytes) |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
986 // - cp_patches: where non-null entries exist, they replace corresponding CP entries in data |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
987 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
988 // When you load an anonymous class U, it works as if you changed its name just before loading, |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
989 // to a name that you will never use again. Since the name is lost, no other class can directly |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
990 // link to any member of U. Just after U is loaded, the only way to use it is reflectively, |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
991 // through java.lang.Class methods like Class.newInstance. |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
992 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
993 // Access checks for linkage sites within U continue to follow the same rules as for named classes. |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
994 // The package of an anonymous class is given by the package qualifier on the name under which it was loaded. |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
995 // An anonymous class also has special privileges to access any member of its host class. |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
996 // This is the main reason why this loading operation is unsafe. The purpose of this is to |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
997 // allow language implementations to simulate "open classes"; a host class in effect gets |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
998 // new code when an anonymous class is loaded alongside it. A less convenient but more |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
999 // standard way to do this is with reflection, which can also be set to ignore access |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1000 // restrictions. |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1001 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1002 // Access into an anonymous class is possible only through reflection. Therefore, there |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1003 // are no special access rules for calling into an anonymous class. The relaxed access |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1004 // rule for the host class is applied in the opposite direction: A host class reflectively |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1005 // access one of its anonymous classes. |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1006 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1007 // If you load the same bytecodes twice, you get two different classes. You can reload |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1008 // the same bytecodes with or without varying CP patches. |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1009 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1010 // By using the CP patching array, you can have a new anonymous class U2 refer to an older one U1. |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1011 // The bytecodes for U2 should refer to U1 by a symbolic name (doesn't matter what the name is). |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1012 // The CONSTANT_Class entry for that name can be patched to refer directly to U1. |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1013 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1014 // This allows, for example, U2 to use U1 as a superclass or super-interface, or as |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1015 // an outer class (so that U2 is an anonymous inner class of anonymous U1). |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1016 // It is not possible for a named class, or an older anonymous class, to refer by |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1017 // name (via its CP) to a newer anonymous class. |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1018 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1019 // CP patching may also be used to modify (i.e., hack) the names of methods, classes, |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1020 // or type descriptors used in the loaded anonymous class. |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1021 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1022 // Finally, CP patching may be used to introduce "live" objects into the constant pool, |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1023 // instead of "dead" strings. A compiled statement like println((Object)"hello") can |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1024 // be changed to println(greeting), where greeting is an arbitrary object created before |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1025 // the anonymous class is loaded. This is useful in dynamic languages, in which |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1026 // various kinds of metaobjects must be introduced as constants into bytecode. |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1027 // Note the cast (Object), which tells the verifier to expect an arbitrary object, |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1028 // not just a literal string. For such ldc instructions, the verifier uses the |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1029 // type Object instead of String, if the loaded constant is not in fact a String. |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1030 |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1031 static instanceKlassHandle |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1032 Unsafe_DefineAnonymousClass_impl(JNIEnv *env, |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1033 jclass host_class, jbyteArray data, jobjectArray cp_patches_jh, |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1034 HeapWord* *temp_alloc, |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1035 TRAPS) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1036 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1037 if (UsePerfData) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1038 ClassLoader::unsafe_defineClassCallCounter()->inc(); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1039 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1040 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1041 if (data == NULL) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1042 THROW_0(vmSymbols::java_lang_NullPointerException()); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1043 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1044 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1045 jint length = typeArrayOop(JNIHandles::resolve_non_null(data))->length(); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1046 jint word_length = (length + sizeof(HeapWord)-1) / sizeof(HeapWord); |
6197 | 1047 HeapWord* body = NEW_C_HEAP_ARRAY(HeapWord, word_length, mtInternal); |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1048 if (body == NULL) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1049 THROW_0(vmSymbols::java_lang_OutOfMemoryError()); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1050 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1051 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1052 // caller responsible to free it: |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1053 (*temp_alloc) = body; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1054 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1055 { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1056 jbyte* array_base = typeArrayOop(JNIHandles::resolve_non_null(data))->byte_at_addr(0); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1057 Copy::conjoint_words((HeapWord*) array_base, body, word_length); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1058 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1059 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1060 u1* class_bytes = (u1*) body; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1061 int class_bytes_length = (int) length; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1062 if (class_bytes_length < 0) class_bytes_length = 0; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1063 if (class_bytes == NULL |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1064 || host_class == NULL |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1065 || length != class_bytes_length) |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1066 THROW_0(vmSymbols::java_lang_IllegalArgumentException()); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1067 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1068 objArrayHandle cp_patches_h; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1069 if (cp_patches_jh != NULL) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1070 oop p = JNIHandles::resolve_non_null(cp_patches_jh); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1071 if (!p->is_objArray()) |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1072 THROW_0(vmSymbols::java_lang_IllegalArgumentException()); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1073 cp_patches_h = objArrayHandle(THREAD, (objArrayOop)p); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1074 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1075 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1076 KlassHandle host_klass(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(host_class))); |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1077 const char* host_source = host_klass->external_name(); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1078 Handle host_loader(THREAD, host_klass->class_loader()); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1079 Handle host_domain(THREAD, host_klass->protection_domain()); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1080 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1081 GrowableArray<Handle>* cp_patches = NULL; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1082 if (cp_patches_h.not_null()) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1083 int alen = cp_patches_h->length(); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1084 for (int i = alen-1; i >= 0; i--) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1085 oop p = cp_patches_h->obj_at(i); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1086 if (p != NULL) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1087 Handle patch(THREAD, p); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1088 if (cp_patches == NULL) |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1089 cp_patches = new GrowableArray<Handle>(i+1, i+1, Handle()); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1090 cp_patches->at_put(i, patch); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1091 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1092 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1093 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1094 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1095 ClassFileStream st(class_bytes, class_bytes_length, (char*) host_source); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1096 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1097 instanceKlassHandle anon_klass; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1098 { |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2114
diff
changeset
|
1099 Symbol* no_class_name = NULL; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1100 Klass* anonk = SystemDictionary::parse_stream(no_class_name, |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1101 host_loader, host_domain, |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1102 &st, host_klass, cp_patches, |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1103 CHECK_NULL); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1104 if (anonk == NULL) return NULL; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1105 anon_klass = instanceKlassHandle(THREAD, anonk); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1106 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1107 |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1108 return anon_klass; |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1109 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1110 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1111 UNSAFE_ENTRY(jclass, Unsafe_DefineAnonymousClass(JNIEnv *env, jobject unsafe, jclass host_class, jbyteArray data, jobjectArray cp_patches_jh)) |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1112 { |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1113 instanceKlassHandle anon_klass; |
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1114 jobject res_jh = NULL; |
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1115 |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1116 UnsafeWrapper("Unsafe_DefineAnonymousClass"); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1117 ResourceMark rm(THREAD); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1118 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1119 HeapWord* temp_alloc = NULL; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1120 |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1121 anon_klass = Unsafe_DefineAnonymousClass_impl(env, host_class, data, |
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1122 cp_patches_jh, |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1123 &temp_alloc, THREAD); |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1124 if (anon_klass() != NULL) |
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1125 res_jh = JNIHandles::make_local(env, anon_klass->java_mirror()); |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1126 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1127 // try/finally clause: |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1128 if (temp_alloc != NULL) { |
6197 | 1129 FREE_C_HEAP_ARRAY(HeapWord, temp_alloc, mtInternal); |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1130 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1131 |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1132 // The anonymous class loader data has been artificially been kept alive to |
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1133 // this point. The mirror and any instances of this class have to keep |
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1134 // it alive afterwards. |
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1135 if (anon_klass() != NULL) { |
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1136 anon_klass->class_loader_data()->set_keep_alive(false); |
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1137 } |
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1138 |
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1139 // let caller initialize it as needed... |
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6983
diff
changeset
|
1140 |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1141 return (jclass) res_jh; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1142 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1143 UNSAFE_END |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1144 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1145 |
0 | 1146 |
1147 UNSAFE_ENTRY(void, Unsafe_MonitorEnter(JNIEnv *env, jobject unsafe, jobject jobj)) | |
1148 UnsafeWrapper("Unsafe_MonitorEnter"); | |
1149 { | |
1150 if (jobj == NULL) { | |
1151 THROW(vmSymbols::java_lang_NullPointerException()); | |
1152 } | |
1153 Handle obj(thread, JNIHandles::resolve_non_null(jobj)); | |
1154 ObjectSynchronizer::jni_enter(obj, CHECK); | |
1155 } | |
1156 UNSAFE_END | |
1157 | |
1158 | |
1159 UNSAFE_ENTRY(jboolean, Unsafe_TryMonitorEnter(JNIEnv *env, jobject unsafe, jobject jobj)) | |
1160 UnsafeWrapper("Unsafe_TryMonitorEnter"); | |
1161 { | |
1162 if (jobj == NULL) { | |
1163 THROW_(vmSymbols::java_lang_NullPointerException(), JNI_FALSE); | |
1164 } | |
1165 Handle obj(thread, JNIHandles::resolve_non_null(jobj)); | |
1166 bool res = ObjectSynchronizer::jni_try_enter(obj, CHECK_0); | |
1167 return (res ? JNI_TRUE : JNI_FALSE); | |
1168 } | |
1169 UNSAFE_END | |
1170 | |
1171 | |
1172 UNSAFE_ENTRY(void, Unsafe_MonitorExit(JNIEnv *env, jobject unsafe, jobject jobj)) | |
1173 UnsafeWrapper("Unsafe_MonitorExit"); | |
1174 { | |
1175 if (jobj == NULL) { | |
1176 THROW(vmSymbols::java_lang_NullPointerException()); | |
1177 } | |
1178 Handle obj(THREAD, JNIHandles::resolve_non_null(jobj)); | |
1179 ObjectSynchronizer::jni_exit(obj(), CHECK); | |
1180 } | |
1181 UNSAFE_END | |
1182 | |
1183 | |
1184 UNSAFE_ENTRY(void, Unsafe_ThrowException(JNIEnv *env, jobject unsafe, jthrowable thr)) | |
1185 UnsafeWrapper("Unsafe_ThrowException"); | |
1186 { | |
1187 ThreadToNativeFromVM ttnfv(thread); | |
1188 env->Throw(thr); | |
1189 } | |
1190 UNSAFE_END | |
1191 | |
1192 // JSR166 ------------------------------------------------------------------ | |
1193 | |
1194 UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h)) | |
1195 UnsafeWrapper("Unsafe_CompareAndSwapObject"); | |
1196 oop x = JNIHandles::resolve(x_h); | |
1197 oop e = JNIHandles::resolve(e_h); | |
1198 oop p = JNIHandles::resolve(obj); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
1199 HeapWord* addr = (HeapWord *)index_oop_from_field_offset_long(p, offset); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1200 oop res = oopDesc::atomic_compare_exchange_oop(x, addr, e, true); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
1201 jboolean success = (res == e); |
0 | 1202 if (success) |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
1203 update_barrier_set((void*)addr, x); |
0 | 1204 return success; |
1205 UNSAFE_END | |
1206 | |
1207 UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint e, jint x)) | |
1208 UnsafeWrapper("Unsafe_CompareAndSwapInt"); | |
1209 oop p = JNIHandles::resolve(obj); | |
1210 jint* addr = (jint *) index_oop_from_field_offset_long(p, offset); | |
1211 return (jint)(Atomic::cmpxchg(x, addr, e)) == e; | |
1212 UNSAFE_END | |
1213 | |
1214 UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong e, jlong x)) | |
1215 UnsafeWrapper("Unsafe_CompareAndSwapLong"); | |
1216 Handle p (THREAD, JNIHandles::resolve(obj)); | |
1217 jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset)); | |
1218 if (VM_Version::supports_cx8()) | |
1219 return (jlong)(Atomic::cmpxchg(x, addr, e)) == e; | |
1220 else { | |
1221 jboolean success = false; | |
1222 ObjectLocker ol(p, THREAD); | |
1223 if (*addr == e) { *addr = x; success = true; } | |
1224 return success; | |
1225 } | |
1226 UNSAFE_END | |
1227 | |
1228 UNSAFE_ENTRY(void, Unsafe_Park(JNIEnv *env, jobject unsafe, jboolean isAbsolute, jlong time)) | |
1229 UnsafeWrapper("Unsafe_Park"); | |
4006 | 1230 #ifndef USDT2 |
1324
e392695de029
6935224: Adding new DTrace probes to work with Palantir
fparain
parents:
845
diff
changeset
|
1231 HS_DTRACE_PROBE3(hotspot, thread__park__begin, thread->parker(), (int) isAbsolute, time); |
4006 | 1232 #else /* USDT2 */ |
1233 HOTSPOT_THREAD_PARK_BEGIN( | |
1234 (uintptr_t) thread->parker(), (int) isAbsolute, time); | |
1235 #endif /* USDT2 */ | |
0 | 1236 JavaThreadParkedState jtps(thread, time != 0); |
1237 thread->parker()->park(isAbsolute != 0, time); | |
4006 | 1238 #ifndef USDT2 |
1324
e392695de029
6935224: Adding new DTrace probes to work with Palantir
fparain
parents:
845
diff
changeset
|
1239 HS_DTRACE_PROBE1(hotspot, thread__park__end, thread->parker()); |
4006 | 1240 #else /* USDT2 */ |
1241 HOTSPOT_THREAD_PARK_END( | |
1242 (uintptr_t) thread->parker()); | |
1243 #endif /* USDT2 */ | |
0 | 1244 UNSAFE_END |
1245 | |
1246 UNSAFE_ENTRY(void, Unsafe_Unpark(JNIEnv *env, jobject unsafe, jobject jthread)) | |
1247 UnsafeWrapper("Unsafe_Unpark"); | |
1248 Parker* p = NULL; | |
1249 if (jthread != NULL) { | |
1250 oop java_thread = JNIHandles::resolve_non_null(jthread); | |
1251 if (java_thread != NULL) { | |
1252 jlong lp = java_lang_Thread::park_event(java_thread); | |
1253 if (lp != 0) { | |
1254 // This cast is OK even though the jlong might have been read | |
1255 // non-atomically on 32bit systems, since there, one word will | |
1256 // always be zero anyway and the value set is always the same | |
1257 p = (Parker*)addr_from_java(lp); | |
1258 } else { | |
1259 // Grab lock if apparently null or using older version of library | |
1260 MutexLocker mu(Threads_lock); | |
1261 java_thread = JNIHandles::resolve_non_null(jthread); | |
1262 if (java_thread != NULL) { | |
1263 JavaThread* thr = java_lang_Thread::thread(java_thread); | |
1264 if (thr != NULL) { | |
1265 p = thr->parker(); | |
1266 if (p != NULL) { // Bind to Java thread for next time. | |
1267 java_lang_Thread::set_park_event(java_thread, addr_to_java(p)); | |
1268 } | |
1269 } | |
1270 } | |
1271 } | |
1272 } | |
1273 } | |
1274 if (p != NULL) { | |
4006 | 1275 #ifndef USDT2 |
1324
e392695de029
6935224: Adding new DTrace probes to work with Palantir
fparain
parents:
845
diff
changeset
|
1276 HS_DTRACE_PROBE1(hotspot, thread__unpark, p); |
4006 | 1277 #else /* USDT2 */ |
1278 HOTSPOT_THREAD_UNPARK( | |
1279 (uintptr_t) p); | |
1280 #endif /* USDT2 */ | |
0 | 1281 p->unpark(); |
1282 } | |
1283 UNSAFE_END | |
1284 | |
1285 UNSAFE_ENTRY(jint, Unsafe_Loadavg(JNIEnv *env, jobject unsafe, jdoubleArray loadavg, jint nelem)) | |
1286 UnsafeWrapper("Unsafe_Loadavg"); | |
1287 const int max_nelem = 3; | |
1288 double la[max_nelem]; | |
1289 jint ret; | |
1290 | |
1291 typeArrayOop a = typeArrayOop(JNIHandles::resolve_non_null(loadavg)); | |
1292 assert(a->is_typeArray(), "must be type array"); | |
1293 | |
1294 if (nelem < 0 || nelem > max_nelem || a->length() < nelem) { | |
1295 ThreadToNativeFromVM ttnfv(thread); | |
1296 throw_new(env, "ArrayIndexOutOfBoundsException"); | |
1297 return -1; | |
1298 } | |
1299 | |
1300 ret = os::loadavg(la, nelem); | |
1301 if (ret == -1) return -1; | |
1302 | |
1303 // if successful, ret is the number of samples actually retrieved. | |
1304 assert(ret >= 0 && ret <= max_nelem, "Unexpected loadavg return value"); | |
1305 switch(ret) { | |
1306 case 3: a->double_at_put(2, (jdouble)la[2]); // fall through | |
1307 case 2: a->double_at_put(1, (jdouble)la[1]); // fall through | |
1308 case 1: a->double_at_put(0, (jdouble)la[0]); break; | |
1309 } | |
1310 return ret; | |
1311 UNSAFE_END | |
1312 | |
1313 UNSAFE_ENTRY(void, Unsafe_PrefetchRead(JNIEnv* env, jclass ignored, jobject obj, jlong offset)) | |
1314 UnsafeWrapper("Unsafe_PrefetchRead"); | |
1315 oop p = JNIHandles::resolve(obj); | |
1316 void* addr = index_oop_from_field_offset_long(p, 0); | |
1317 Prefetch::read(addr, (intx)offset); | |
1318 UNSAFE_END | |
1319 | |
1320 UNSAFE_ENTRY(void, Unsafe_PrefetchWrite(JNIEnv* env, jclass ignored, jobject obj, jlong offset)) | |
1321 UnsafeWrapper("Unsafe_PrefetchWrite"); | |
1322 oop p = JNIHandles::resolve(obj); | |
1323 void* addr = index_oop_from_field_offset_long(p, 0); | |
1324 Prefetch::write(addr, (intx)offset); | |
1325 UNSAFE_END | |
1326 | |
1327 | |
1328 /// JVM_RegisterUnsafeMethods | |
1329 | |
1330 #define ADR "J" | |
1331 | |
1332 #define LANG "Ljava/lang/" | |
1333 | |
1334 #define OBJ LANG"Object;" | |
1335 #define CLS LANG"Class;" | |
1336 #define CTR LANG"reflect/Constructor;" | |
1337 #define FLD LANG"reflect/Field;" | |
1338 #define MTH LANG"reflect/Method;" | |
1339 #define THR LANG"Throwable;" | |
1340 | |
1341 #define DC0_Args LANG"String;[BII" | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1342 #define DC_Args DC0_Args LANG"ClassLoader;" "Ljava/security/ProtectionDomain;" |
0 | 1343 |
1344 #define CC (char*) /*cast a literal from (const char*)*/ | |
1345 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f) | |
1346 | |
1347 // define deprecated accessors for compabitility with 1.4.0 | |
1348 #define DECLARE_GETSETOOP_140(Boolean, Z) \ | |
1349 {CC"get"#Boolean, CC"("OBJ"I)"#Z, FN_PTR(Unsafe_Get##Boolean##140)}, \ | |
1350 {CC"put"#Boolean, CC"("OBJ"I"#Z")V", FN_PTR(Unsafe_Set##Boolean##140)} | |
1351 | |
1352 // Note: In 1.4.1, getObject and kin take both int and long offsets. | |
1353 #define DECLARE_GETSETOOP_141(Boolean, Z) \ | |
1354 {CC"get"#Boolean, CC"("OBJ"J)"#Z, FN_PTR(Unsafe_Get##Boolean)}, \ | |
1355 {CC"put"#Boolean, CC"("OBJ"J"#Z")V", FN_PTR(Unsafe_Set##Boolean)} | |
1356 | |
1357 // Note: In 1.5.0, there are volatile versions too | |
1358 #define DECLARE_GETSETOOP(Boolean, Z) \ | |
1359 {CC"get"#Boolean, CC"("OBJ"J)"#Z, FN_PTR(Unsafe_Get##Boolean)}, \ | |
1360 {CC"put"#Boolean, CC"("OBJ"J"#Z")V", FN_PTR(Unsafe_Set##Boolean)}, \ | |
1361 {CC"get"#Boolean"Volatile", CC"("OBJ"J)"#Z, FN_PTR(Unsafe_Get##Boolean##Volatile)}, \ | |
1362 {CC"put"#Boolean"Volatile", CC"("OBJ"J"#Z")V", FN_PTR(Unsafe_Set##Boolean##Volatile)} | |
1363 | |
1364 | |
1365 #define DECLARE_GETSETNATIVE(Byte, B) \ | |
1366 {CC"get"#Byte, CC"("ADR")"#B, FN_PTR(Unsafe_GetNative##Byte)}, \ | |
1367 {CC"put"#Byte, CC"("ADR#B")V", FN_PTR(Unsafe_SetNative##Byte)} | |
1368 | |
1369 | |
1370 | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1371 // These are the methods for 1.4.0 |
0 | 1372 static JNINativeMethod methods_140[] = { |
1373 {CC"getObject", CC"("OBJ"I)"OBJ"", FN_PTR(Unsafe_GetObject140)}, | |
1374 {CC"putObject", CC"("OBJ"I"OBJ")V", FN_PTR(Unsafe_SetObject140)}, | |
1375 | |
1376 DECLARE_GETSETOOP_140(Boolean, Z), | |
1377 DECLARE_GETSETOOP_140(Byte, B), | |
1378 DECLARE_GETSETOOP_140(Short, S), | |
1379 DECLARE_GETSETOOP_140(Char, C), | |
1380 DECLARE_GETSETOOP_140(Int, I), | |
1381 DECLARE_GETSETOOP_140(Long, J), | |
1382 DECLARE_GETSETOOP_140(Float, F), | |
1383 DECLARE_GETSETOOP_140(Double, D), | |
1384 | |
1385 DECLARE_GETSETNATIVE(Byte, B), | |
1386 DECLARE_GETSETNATIVE(Short, S), | |
1387 DECLARE_GETSETNATIVE(Char, C), | |
1388 DECLARE_GETSETNATIVE(Int, I), | |
1389 DECLARE_GETSETNATIVE(Long, J), | |
1390 DECLARE_GETSETNATIVE(Float, F), | |
1391 DECLARE_GETSETNATIVE(Double, D), | |
1392 | |
1393 {CC"getAddress", CC"("ADR")"ADR, FN_PTR(Unsafe_GetNativeAddress)}, | |
1394 {CC"putAddress", CC"("ADR""ADR")V", FN_PTR(Unsafe_SetNativeAddress)}, | |
1395 | |
1396 {CC"allocateMemory", CC"(J)"ADR, FN_PTR(Unsafe_AllocateMemory)}, | |
1397 {CC"reallocateMemory", CC"("ADR"J)"ADR, FN_PTR(Unsafe_ReallocateMemory)}, | |
1398 {CC"freeMemory", CC"("ADR")V", FN_PTR(Unsafe_FreeMemory)}, | |
1399 | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1400 {CC"fieldOffset", CC"("FLD")I", FN_PTR(Unsafe_FieldOffset)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1401 {CC"staticFieldBase", CC"("CLS")"OBJ, FN_PTR(Unsafe_StaticFieldBaseFromClass)}, |
0 | 1402 {CC"ensureClassInitialized",CC"("CLS")V", FN_PTR(Unsafe_EnsureClassInitialized)}, |
1403 {CC"arrayBaseOffset", CC"("CLS")I", FN_PTR(Unsafe_ArrayBaseOffset)}, | |
1404 {CC"arrayIndexScale", CC"("CLS")I", FN_PTR(Unsafe_ArrayIndexScale)}, | |
1405 {CC"addressSize", CC"()I", FN_PTR(Unsafe_AddressSize)}, | |
1406 {CC"pageSize", CC"()I", FN_PTR(Unsafe_PageSize)}, | |
1407 | |
1408 {CC"defineClass", CC"("DC0_Args")"CLS, FN_PTR(Unsafe_DefineClass0)}, | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1409 {CC"defineClass", CC"("DC_Args")"CLS, FN_PTR(Unsafe_DefineClass)}, |
0 | 1410 {CC"allocateInstance", CC"("CLS")"OBJ, FN_PTR(Unsafe_AllocateInstance)}, |
1411 {CC"monitorEnter", CC"("OBJ")V", FN_PTR(Unsafe_MonitorEnter)}, | |
1412 {CC"monitorExit", CC"("OBJ")V", FN_PTR(Unsafe_MonitorExit)}, | |
1413 {CC"throwException", CC"("THR")V", FN_PTR(Unsafe_ThrowException)} | |
1414 }; | |
1415 | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1416 // These are the methods prior to the JSR 166 changes in 1.5.0 |
0 | 1417 static JNINativeMethod methods_141[] = { |
1418 {CC"getObject", CC"("OBJ"J)"OBJ"", FN_PTR(Unsafe_GetObject)}, | |
1419 {CC"putObject", CC"("OBJ"J"OBJ")V", FN_PTR(Unsafe_SetObject)}, | |
1420 | |
1421 DECLARE_GETSETOOP_141(Boolean, Z), | |
1422 DECLARE_GETSETOOP_141(Byte, B), | |
1423 DECLARE_GETSETOOP_141(Short, S), | |
1424 DECLARE_GETSETOOP_141(Char, C), | |
1425 DECLARE_GETSETOOP_141(Int, I), | |
1426 DECLARE_GETSETOOP_141(Long, J), | |
1427 DECLARE_GETSETOOP_141(Float, F), | |
1428 DECLARE_GETSETOOP_141(Double, D), | |
1429 | |
1430 DECLARE_GETSETNATIVE(Byte, B), | |
1431 DECLARE_GETSETNATIVE(Short, S), | |
1432 DECLARE_GETSETNATIVE(Char, C), | |
1433 DECLARE_GETSETNATIVE(Int, I), | |
1434 DECLARE_GETSETNATIVE(Long, J), | |
1435 DECLARE_GETSETNATIVE(Float, F), | |
1436 DECLARE_GETSETNATIVE(Double, D), | |
1437 | |
1438 {CC"getAddress", CC"("ADR")"ADR, FN_PTR(Unsafe_GetNativeAddress)}, | |
1439 {CC"putAddress", CC"("ADR""ADR")V", FN_PTR(Unsafe_SetNativeAddress)}, | |
1440 | |
1441 {CC"allocateMemory", CC"(J)"ADR, FN_PTR(Unsafe_AllocateMemory)}, | |
1442 {CC"reallocateMemory", CC"("ADR"J)"ADR, FN_PTR(Unsafe_ReallocateMemory)}, | |
1443 {CC"freeMemory", CC"("ADR")V", FN_PTR(Unsafe_FreeMemory)}, | |
1444 | |
1445 {CC"objectFieldOffset", CC"("FLD")J", FN_PTR(Unsafe_ObjectFieldOffset)}, | |
1446 {CC"staticFieldOffset", CC"("FLD")J", FN_PTR(Unsafe_StaticFieldOffset)}, | |
1447 {CC"staticFieldBase", CC"("FLD")"OBJ, FN_PTR(Unsafe_StaticFieldBaseFromField)}, | |
1448 {CC"ensureClassInitialized",CC"("CLS")V", FN_PTR(Unsafe_EnsureClassInitialized)}, | |
1449 {CC"arrayBaseOffset", CC"("CLS")I", FN_PTR(Unsafe_ArrayBaseOffset)}, | |
1450 {CC"arrayIndexScale", CC"("CLS")I", FN_PTR(Unsafe_ArrayIndexScale)}, | |
1451 {CC"addressSize", CC"()I", FN_PTR(Unsafe_AddressSize)}, | |
1452 {CC"pageSize", CC"()I", FN_PTR(Unsafe_PageSize)}, | |
1453 | |
1454 {CC"defineClass", CC"("DC0_Args")"CLS, FN_PTR(Unsafe_DefineClass0)}, | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1455 {CC"defineClass", CC"("DC_Args")"CLS, FN_PTR(Unsafe_DefineClass)}, |
0 | 1456 {CC"allocateInstance", CC"("CLS")"OBJ, FN_PTR(Unsafe_AllocateInstance)}, |
1457 {CC"monitorEnter", CC"("OBJ")V", FN_PTR(Unsafe_MonitorEnter)}, | |
1458 {CC"monitorExit", CC"("OBJ")V", FN_PTR(Unsafe_MonitorExit)}, | |
1459 {CC"throwException", CC"("THR")V", FN_PTR(Unsafe_ThrowException)} | |
1460 | |
1461 }; | |
1462 | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1463 // These are the methods prior to the JSR 166 changes in 1.6.0 |
0 | 1464 static JNINativeMethod methods_15[] = { |
1465 {CC"getObject", CC"("OBJ"J)"OBJ"", FN_PTR(Unsafe_GetObject)}, | |
1466 {CC"putObject", CC"("OBJ"J"OBJ")V", FN_PTR(Unsafe_SetObject)}, | |
1467 {CC"getObjectVolatile",CC"("OBJ"J)"OBJ"", FN_PTR(Unsafe_GetObjectVolatile)}, | |
1468 {CC"putObjectVolatile",CC"("OBJ"J"OBJ")V", FN_PTR(Unsafe_SetObjectVolatile)}, | |
1469 | |
1470 | |
1471 DECLARE_GETSETOOP(Boolean, Z), | |
1472 DECLARE_GETSETOOP(Byte, B), | |
1473 DECLARE_GETSETOOP(Short, S), | |
1474 DECLARE_GETSETOOP(Char, C), | |
1475 DECLARE_GETSETOOP(Int, I), | |
1476 DECLARE_GETSETOOP(Long, J), | |
1477 DECLARE_GETSETOOP(Float, F), | |
1478 DECLARE_GETSETOOP(Double, D), | |
1479 | |
1480 DECLARE_GETSETNATIVE(Byte, B), | |
1481 DECLARE_GETSETNATIVE(Short, S), | |
1482 DECLARE_GETSETNATIVE(Char, C), | |
1483 DECLARE_GETSETNATIVE(Int, I), | |
1484 DECLARE_GETSETNATIVE(Long, J), | |
1485 DECLARE_GETSETNATIVE(Float, F), | |
1486 DECLARE_GETSETNATIVE(Double, D), | |
1487 | |
1488 {CC"getAddress", CC"("ADR")"ADR, FN_PTR(Unsafe_GetNativeAddress)}, | |
1489 {CC"putAddress", CC"("ADR""ADR")V", FN_PTR(Unsafe_SetNativeAddress)}, | |
1490 | |
1491 {CC"allocateMemory", CC"(J)"ADR, FN_PTR(Unsafe_AllocateMemory)}, | |
1492 {CC"reallocateMemory", CC"("ADR"J)"ADR, FN_PTR(Unsafe_ReallocateMemory)}, | |
1493 {CC"freeMemory", CC"("ADR")V", FN_PTR(Unsafe_FreeMemory)}, | |
1494 | |
1495 {CC"objectFieldOffset", CC"("FLD")J", FN_PTR(Unsafe_ObjectFieldOffset)}, | |
1496 {CC"staticFieldOffset", CC"("FLD")J", FN_PTR(Unsafe_StaticFieldOffset)}, | |
1497 {CC"staticFieldBase", CC"("FLD")"OBJ, FN_PTR(Unsafe_StaticFieldBaseFromField)}, | |
1498 {CC"ensureClassInitialized",CC"("CLS")V", FN_PTR(Unsafe_EnsureClassInitialized)}, | |
1499 {CC"arrayBaseOffset", CC"("CLS")I", FN_PTR(Unsafe_ArrayBaseOffset)}, | |
1500 {CC"arrayIndexScale", CC"("CLS")I", FN_PTR(Unsafe_ArrayIndexScale)}, | |
1501 {CC"addressSize", CC"()I", FN_PTR(Unsafe_AddressSize)}, | |
1502 {CC"pageSize", CC"()I", FN_PTR(Unsafe_PageSize)}, | |
1503 | |
1504 {CC"defineClass", CC"("DC0_Args")"CLS, FN_PTR(Unsafe_DefineClass0)}, | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1505 {CC"defineClass", CC"("DC_Args")"CLS, FN_PTR(Unsafe_DefineClass)}, |
0 | 1506 {CC"allocateInstance", CC"("CLS")"OBJ, FN_PTR(Unsafe_AllocateInstance)}, |
1507 {CC"monitorEnter", CC"("OBJ")V", FN_PTR(Unsafe_MonitorEnter)}, | |
1508 {CC"monitorExit", CC"("OBJ")V", FN_PTR(Unsafe_MonitorExit)}, | |
1509 {CC"throwException", CC"("THR")V", FN_PTR(Unsafe_ThrowException)}, | |
1510 {CC"compareAndSwapObject", CC"("OBJ"J"OBJ""OBJ")Z", FN_PTR(Unsafe_CompareAndSwapObject)}, | |
1511 {CC"compareAndSwapInt", CC"("OBJ"J""I""I"")Z", FN_PTR(Unsafe_CompareAndSwapInt)}, | |
1512 {CC"compareAndSwapLong", CC"("OBJ"J""J""J"")Z", FN_PTR(Unsafe_CompareAndSwapLong)}, | |
1513 {CC"park", CC"(ZJ)V", FN_PTR(Unsafe_Park)}, | |
1514 {CC"unpark", CC"("OBJ")V", FN_PTR(Unsafe_Unpark)} | |
1515 | |
1516 }; | |
1517 | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1518 // These are the methods for 1.6.0 and 1.7.0 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1519 static JNINativeMethod methods_16[] = { |
0 | 1520 {CC"getObject", CC"("OBJ"J)"OBJ"", FN_PTR(Unsafe_GetObject)}, |
1521 {CC"putObject", CC"("OBJ"J"OBJ")V", FN_PTR(Unsafe_SetObject)}, | |
1522 {CC"getObjectVolatile",CC"("OBJ"J)"OBJ"", FN_PTR(Unsafe_GetObjectVolatile)}, | |
1523 {CC"putObjectVolatile",CC"("OBJ"J"OBJ")V", FN_PTR(Unsafe_SetObjectVolatile)}, | |
1524 | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1525 DECLARE_GETSETOOP(Boolean, Z), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1526 DECLARE_GETSETOOP(Byte, B), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1527 DECLARE_GETSETOOP(Short, S), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1528 DECLARE_GETSETOOP(Char, C), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1529 DECLARE_GETSETOOP(Int, I), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1530 DECLARE_GETSETOOP(Long, J), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1531 DECLARE_GETSETOOP(Float, F), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1532 DECLARE_GETSETOOP(Double, D), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1533 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1534 DECLARE_GETSETNATIVE(Byte, B), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1535 DECLARE_GETSETNATIVE(Short, S), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1536 DECLARE_GETSETNATIVE(Char, C), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1537 DECLARE_GETSETNATIVE(Int, I), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1538 DECLARE_GETSETNATIVE(Long, J), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1539 DECLARE_GETSETNATIVE(Float, F), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1540 DECLARE_GETSETNATIVE(Double, D), |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1541 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1542 {CC"getAddress", CC"("ADR")"ADR, FN_PTR(Unsafe_GetNativeAddress)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1543 {CC"putAddress", CC"("ADR""ADR")V", FN_PTR(Unsafe_SetNativeAddress)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1544 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1545 {CC"allocateMemory", CC"(J)"ADR, FN_PTR(Unsafe_AllocateMemory)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1546 {CC"reallocateMemory", CC"("ADR"J)"ADR, FN_PTR(Unsafe_ReallocateMemory)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1547 {CC"freeMemory", CC"("ADR")V", FN_PTR(Unsafe_FreeMemory)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1548 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1549 {CC"objectFieldOffset", CC"("FLD")J", FN_PTR(Unsafe_ObjectFieldOffset)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1550 {CC"staticFieldOffset", CC"("FLD")J", FN_PTR(Unsafe_StaticFieldOffset)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1551 {CC"staticFieldBase", CC"("FLD")"OBJ, FN_PTR(Unsafe_StaticFieldBaseFromField)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1552 {CC"ensureClassInitialized",CC"("CLS")V", FN_PTR(Unsafe_EnsureClassInitialized)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1553 {CC"arrayBaseOffset", CC"("CLS")I", FN_PTR(Unsafe_ArrayBaseOffset)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1554 {CC"arrayIndexScale", CC"("CLS")I", FN_PTR(Unsafe_ArrayIndexScale)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1555 {CC"addressSize", CC"()I", FN_PTR(Unsafe_AddressSize)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1556 {CC"pageSize", CC"()I", FN_PTR(Unsafe_PageSize)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1557 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1558 {CC"defineClass", CC"("DC0_Args")"CLS, FN_PTR(Unsafe_DefineClass0)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1559 {CC"defineClass", CC"("DC_Args")"CLS, FN_PTR(Unsafe_DefineClass)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1560 {CC"allocateInstance", CC"("CLS")"OBJ, FN_PTR(Unsafe_AllocateInstance)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1561 {CC"monitorEnter", CC"("OBJ")V", FN_PTR(Unsafe_MonitorEnter)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1562 {CC"monitorExit", CC"("OBJ")V", FN_PTR(Unsafe_MonitorExit)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1563 {CC"tryMonitorEnter", CC"("OBJ")Z", FN_PTR(Unsafe_TryMonitorEnter)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1564 {CC"throwException", CC"("THR")V", FN_PTR(Unsafe_ThrowException)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1565 {CC"compareAndSwapObject", CC"("OBJ"J"OBJ""OBJ")Z", FN_PTR(Unsafe_CompareAndSwapObject)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1566 {CC"compareAndSwapInt", CC"("OBJ"J""I""I"")Z", FN_PTR(Unsafe_CompareAndSwapInt)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1567 {CC"compareAndSwapLong", CC"("OBJ"J""J""J"")Z", FN_PTR(Unsafe_CompareAndSwapLong)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1568 {CC"putOrderedObject", CC"("OBJ"J"OBJ")V", FN_PTR(Unsafe_SetOrderedObject)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1569 {CC"putOrderedInt", CC"("OBJ"JI)V", FN_PTR(Unsafe_SetOrderedInt)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1570 {CC"putOrderedLong", CC"("OBJ"JJ)V", FN_PTR(Unsafe_SetOrderedLong)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1571 {CC"park", CC"(ZJ)V", FN_PTR(Unsafe_Park)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1572 {CC"unpark", CC"("OBJ")V", FN_PTR(Unsafe_Unpark)} |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1573 }; |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1574 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1575 // These are the methods for 1.8.0 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1576 static JNINativeMethod methods_18[] = { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1577 {CC"getObject", CC"("OBJ"J)"OBJ"", FN_PTR(Unsafe_GetObject)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1578 {CC"putObject", CC"("OBJ"J"OBJ")V", FN_PTR(Unsafe_SetObject)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1579 {CC"getObjectVolatile",CC"("OBJ"J)"OBJ"", FN_PTR(Unsafe_GetObjectVolatile)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1580 {CC"putObjectVolatile",CC"("OBJ"J"OBJ")V", FN_PTR(Unsafe_SetObjectVolatile)}, |
0 | 1581 |
1582 DECLARE_GETSETOOP(Boolean, Z), | |
1583 DECLARE_GETSETOOP(Byte, B), | |
1584 DECLARE_GETSETOOP(Short, S), | |
1585 DECLARE_GETSETOOP(Char, C), | |
1586 DECLARE_GETSETOOP(Int, I), | |
1587 DECLARE_GETSETOOP(Long, J), | |
1588 DECLARE_GETSETOOP(Float, F), | |
1589 DECLARE_GETSETOOP(Double, D), | |
1590 | |
1591 DECLARE_GETSETNATIVE(Byte, B), | |
1592 DECLARE_GETSETNATIVE(Short, S), | |
1593 DECLARE_GETSETNATIVE(Char, C), | |
1594 DECLARE_GETSETNATIVE(Int, I), | |
1595 DECLARE_GETSETNATIVE(Long, J), | |
1596 DECLARE_GETSETNATIVE(Float, F), | |
1597 DECLARE_GETSETNATIVE(Double, D), | |
1598 | |
1599 {CC"getAddress", CC"("ADR")"ADR, FN_PTR(Unsafe_GetNativeAddress)}, | |
1600 {CC"putAddress", CC"("ADR""ADR")V", FN_PTR(Unsafe_SetNativeAddress)}, | |
1601 | |
1602 {CC"allocateMemory", CC"(J)"ADR, FN_PTR(Unsafe_AllocateMemory)}, | |
1603 {CC"reallocateMemory", CC"("ADR"J)"ADR, FN_PTR(Unsafe_ReallocateMemory)}, | |
1604 {CC"freeMemory", CC"("ADR")V", FN_PTR(Unsafe_FreeMemory)}, | |
1605 | |
1606 {CC"objectFieldOffset", CC"("FLD")J", FN_PTR(Unsafe_ObjectFieldOffset)}, | |
1607 {CC"staticFieldOffset", CC"("FLD")J", FN_PTR(Unsafe_StaticFieldOffset)}, | |
1608 {CC"staticFieldBase", CC"("FLD")"OBJ, FN_PTR(Unsafe_StaticFieldBaseFromField)}, | |
1609 {CC"ensureClassInitialized",CC"("CLS")V", FN_PTR(Unsafe_EnsureClassInitialized)}, | |
1610 {CC"arrayBaseOffset", CC"("CLS")I", FN_PTR(Unsafe_ArrayBaseOffset)}, | |
1611 {CC"arrayIndexScale", CC"("CLS")I", FN_PTR(Unsafe_ArrayIndexScale)}, | |
1612 {CC"addressSize", CC"()I", FN_PTR(Unsafe_AddressSize)}, | |
1613 {CC"pageSize", CC"()I", FN_PTR(Unsafe_PageSize)}, | |
1614 | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1615 {CC"defineClass", CC"("DC_Args")"CLS, FN_PTR(Unsafe_DefineClass)}, |
0 | 1616 {CC"allocateInstance", CC"("CLS")"OBJ, FN_PTR(Unsafe_AllocateInstance)}, |
1617 {CC"monitorEnter", CC"("OBJ")V", FN_PTR(Unsafe_MonitorEnter)}, | |
1618 {CC"monitorExit", CC"("OBJ")V", FN_PTR(Unsafe_MonitorExit)}, | |
1619 {CC"tryMonitorEnter", CC"("OBJ")Z", FN_PTR(Unsafe_TryMonitorEnter)}, | |
1620 {CC"throwException", CC"("THR")V", FN_PTR(Unsafe_ThrowException)}, | |
1621 {CC"compareAndSwapObject", CC"("OBJ"J"OBJ""OBJ")Z", FN_PTR(Unsafe_CompareAndSwapObject)}, | |
1622 {CC"compareAndSwapInt", CC"("OBJ"J""I""I"")Z", FN_PTR(Unsafe_CompareAndSwapInt)}, | |
1623 {CC"compareAndSwapLong", CC"("OBJ"J""J""J"")Z", FN_PTR(Unsafe_CompareAndSwapLong)}, | |
1624 {CC"putOrderedObject", CC"("OBJ"J"OBJ")V", FN_PTR(Unsafe_SetOrderedObject)}, | |
1625 {CC"putOrderedInt", CC"("OBJ"JI)V", FN_PTR(Unsafe_SetOrderedInt)}, | |
1626 {CC"putOrderedLong", CC"("OBJ"JJ)V", FN_PTR(Unsafe_SetOrderedLong)}, | |
1627 {CC"park", CC"(ZJ)V", FN_PTR(Unsafe_Park)}, | |
1628 {CC"unpark", CC"("OBJ")V", FN_PTR(Unsafe_Unpark)} | |
1629 }; | |
1630 | |
1631 JNINativeMethod loadavg_method[] = { | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1632 {CC"getLoadAverage", CC"([DI)I", FN_PTR(Unsafe_Loadavg)} |
0 | 1633 }; |
1634 | |
1635 JNINativeMethod prefetch_methods[] = { | |
1636 {CC"prefetchRead", CC"("OBJ"J)V", FN_PTR(Unsafe_PrefetchRead)}, | |
1637 {CC"prefetchWrite", CC"("OBJ"J)V", FN_PTR(Unsafe_PrefetchWrite)}, | |
1638 {CC"prefetchReadStatic", CC"("OBJ"J)V", FN_PTR(Unsafe_PrefetchRead)}, | |
1639 {CC"prefetchWriteStatic",CC"("OBJ"J)V", FN_PTR(Unsafe_PrefetchWrite)} | |
1640 }; | |
1641 | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1642 JNINativeMethod memcopy_methods_17[] = { |
0 | 1643 {CC"copyMemory", CC"("OBJ"J"OBJ"JJ)V", FN_PTR(Unsafe_CopyMemory2)}, |
1644 {CC"setMemory", CC"("OBJ"JJB)V", FN_PTR(Unsafe_SetMemory2)} | |
1645 }; | |
1646 | |
1647 JNINativeMethod memcopy_methods_15[] = { | |
1648 {CC"setMemory", CC"("ADR"JB)V", FN_PTR(Unsafe_SetMemory)}, | |
1649 {CC"copyMemory", CC"("ADR ADR"J)V", FN_PTR(Unsafe_CopyMemory)} | |
1650 }; | |
1651 | |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1652 JNINativeMethod anonk_methods[] = { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1653 {CC"defineAnonymousClass", CC"("DAC_Args")"CLS, FN_PTR(Unsafe_DefineAnonymousClass)}, |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
356
diff
changeset
|
1654 }; |
0 | 1655 |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
1656 JNINativeMethod lform_methods[] = { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
1657 {CC"shouldBeInitialized",CC"("CLS")Z", FN_PTR(Unsafe_ShouldBeInitialized)}, |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
1658 }; |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
1659 |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1660 JNINativeMethod fence_methods[] = { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1661 {CC"loadFence", CC"()V", FN_PTR(Unsafe_LoadFence)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1662 {CC"storeFence", CC"()V", FN_PTR(Unsafe_StoreFence)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1663 {CC"fullFence", CC"()V", FN_PTR(Unsafe_FullFence)}, |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1664 }; |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1665 |
0 | 1666 #undef CC |
1667 #undef FN_PTR | |
1668 | |
1669 #undef ADR | |
1670 #undef LANG | |
1671 #undef OBJ | |
1672 #undef CLS | |
1673 #undef CTR | |
1674 #undef FLD | |
1675 #undef MTH | |
1676 #undef THR | |
1677 #undef DC0_Args | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1678 #undef DC_Args |
0 | 1679 |
1680 #undef DECLARE_GETSETOOP | |
1681 #undef DECLARE_GETSETNATIVE | |
1682 | |
1683 | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1684 /** |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1685 * Helper method to register native methods. |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1686 */ |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1687 static bool register_natives(const char* message, JNIEnv* env, jclass clazz, const JNINativeMethod* methods, jint nMethods) { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1688 int status = env->RegisterNatives(clazz, methods, nMethods); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1689 if (status < 0 || env->ExceptionOccurred()) { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1690 if (PrintMiscellaneous && (Verbose || WizardMode)) { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1691 tty->print_cr("Unsafe: failed registering %s", message); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1692 } |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1693 env->ExceptionClear(); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1694 return false; |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1695 } else { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1696 if (PrintMiscellaneous && (Verbose || WizardMode)) { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1697 tty->print_cr("Unsafe: successfully registered %s", message); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1698 } |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1699 return true; |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1700 } |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1701 } |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1702 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1703 |
0 | 1704 // This one function is exported, used by NativeLookup. |
1705 // The Unsafe_xxx functions above are called only from the interpreter. | |
1706 // The optimizer looks at names and signatures to recognize | |
1707 // individual functions. | |
1708 | |
1709 JVM_ENTRY(void, JVM_RegisterUnsafeMethods(JNIEnv *env, jclass unsafecls)) | |
1710 UnsafeWrapper("JVM_RegisterUnsafeMethods"); | |
1711 { | |
1712 ThreadToNativeFromVM ttnfv(thread); | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1713 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1714 // Unsafe methods |
0 | 1715 { |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1716 bool success = false; |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1717 // We need to register the 1.6 methods first because the 1.8 methods would register fine on 1.7 and 1.6 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1718 if (!success) { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1719 success = register_natives("1.6 methods", env, unsafecls, methods_16, sizeof(methods_16)/sizeof(JNINativeMethod)); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1720 } |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1721 if (!success) { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1722 success = register_natives("1.8 methods", env, unsafecls, methods_18, sizeof(methods_18)/sizeof(JNINativeMethod)); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1723 } |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1724 if (!success) { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1725 success = register_natives("1.5 methods", env, unsafecls, methods_15, sizeof(methods_15)/sizeof(JNINativeMethod)); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1726 } |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1727 if (!success) { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1728 success = register_natives("1.4.1 methods", env, unsafecls, methods_141, sizeof(methods_141)/sizeof(JNINativeMethod)); |
0 | 1729 } |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1730 if (!success) { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1731 success = register_natives("1.4.0 methods", env, unsafecls, methods_140, sizeof(methods_140)/sizeof(JNINativeMethod)); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1732 } |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1733 guarantee(success, "register unsafe natives"); |
0 | 1734 } |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1735 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1736 // Unsafe.getLoadAverage |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1737 register_natives("1.6 loadavg method", env, unsafecls, loadavg_method, sizeof(loadavg_method)/sizeof(JNINativeMethod)); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1738 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1739 // Prefetch methods |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1740 register_natives("1.6 prefetch methods", env, unsafecls, prefetch_methods, sizeof(prefetch_methods)/sizeof(JNINativeMethod)); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1741 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1742 // Memory copy methods |
0 | 1743 { |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1744 bool success = false; |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1745 if (!success) { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1746 success = register_natives("1.7 memory copy methods", env, unsafecls, memcopy_methods_17, sizeof(memcopy_methods_17)/sizeof(JNINativeMethod)); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1747 } |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1748 if (!success) { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1749 success = register_natives("1.5 memory copy methods", env, unsafecls, memcopy_methods_15, sizeof(memcopy_methods_15)/sizeof(JNINativeMethod)); |
0 | 1750 } |
1751 } | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1752 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1753 // Unsafe.defineAnonymousClass |
2416
38fea01eb669
6817525: turn on method handle functionality by default for JSR 292
twisti
parents:
2376
diff
changeset
|
1754 if (EnableInvokeDynamic) { |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1755 register_natives("1.7 define anonymous class method", env, unsafecls, anonk_methods, sizeof(anonk_methods)/sizeof(JNINativeMethod)); |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6226
diff
changeset
|
1756 } |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1757 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1758 // Unsafe.shouldBeInitialized |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1759 if (EnableInvokeDynamic) { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1760 register_natives("1.7 LambdaForm support", env, unsafecls, lform_methods, sizeof(lform_methods)/sizeof(JNINativeMethod)); |
0 | 1761 } |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1762 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1763 // Fence methods |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8001
diff
changeset
|
1764 register_natives("1.8 fence methods", env, unsafecls, fence_methods, sizeof(fence_methods)/sizeof(JNINativeMethod)); |
0 | 1765 } |
1766 JVM_END |