CACAO
sun_misc_Unsafe.cpp
Go to the documentation of this file.
1 /* src/native/vm/sun_misc_Unsafe.cpp - sun/misc/Unsafe
2 
3  Copyright (C) 2006-2014
4  CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5 
6  This file is part of CACAO.
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2, or (at
11  your option) any later version.
12 
13  This program is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  02110-1301, USA.
22 
23 */
24 
25 
26 #include "config.h"
27 
28 #include <stdint.h>
29 #include <unistd.h>
30 
31 #include "threads/atomic.hpp"
32 #include "threads/thread.hpp"
33 
34 #include "mm/memory.hpp"
35 
36 #include "native/jni.hpp"
37 #include "native/llni.hpp"
38 #include "native/native.hpp"
39 
40 #if defined(ENABLE_JNI_HEADERS)
41 # include "native/include/sun_misc_Unsafe.h"
42 #endif
43 
44 #include "vm/array.hpp"
45 #include "vm/jit/builtin.hpp"
46 #include "vm/exceptions.hpp"
47 #include "vm/initialize.hpp"
48 #include "vm/javaobjects.hpp"
49 #include "vm/os.hpp"
50 #include "vm/string.hpp"
51 #include "vm/utf8.hpp"
52 #include "vm/vm.hpp"
53 
54 
55 // Native functions are exported as C functions.
56 extern "C" {
57 
58 /*
59  * Class: sun/misc/Unsafe
60  * Method: registerNatives
61  * Signature: ()V
62  */
63 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_registerNatives(JNIEnv *env, jclass clazz)
64 {
65  /* The native methods of this function are already registered in
66  _Jv_sun_misc_Unsafe_init() which is called during VM
67  startup. */
68 }
69 
70 
71 /*
72  * Class: sun/misc/Unsafe
73  * Method: getInt
74  * Signature: (Ljava/lang/Object;J)I
75  */
76 JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_getInt__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
77 {
78  return FieldAccess::get<int32_t>(o, offset);
79 }
80 
81 
82 /*
83  * Class: sun/misc/Unsafe
84  * Method: putInt
85  * Signature: (Ljava/lang/Object;JI)V
86  */
87 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putInt__Ljava_lang_Object_2JI(JNIEnv *env, jobject _this, jobject o, jlong offset, jint x)
88 {
89  FieldAccess::set(o, offset, x);
90 }
91 
92 
93 /*
94  * Class: sun/misc/Unsafe
95  * Method: getObject
96  * Signature: (Ljava/lang/Object;J)Ljava/lang/Object;
97  */
98 JNIEXPORT jobject JNICALL Java_sun_misc_Unsafe_getObject(JNIEnv *env, jobject _this, jobject o, jlong offset)
99 {
100  return FieldAccess::get<jobject>(o, offset);
101 }
102 
103 
104 /*
105  * Class: sun/misc/Unsafe
106  * Method: putObject
107  * Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
108  */
109 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObject(JNIEnv *env, jobject _this, jobject o, jlong offset, jobject x)
110 {
111  FieldAccess::set(o, offset, x);
112 }
113 
114 
115 /*
116  * Class: sun/misc/Unsafe
117  * Method: getBoolean
118  * Signature: (Ljava/lang/Object;J)Z
119  */
120 JNIEXPORT jboolean JNICALL Java_sun_misc_Unsafe_getBoolean(JNIEnv *env, jobject _this, jobject o, jlong offset)
121 {
122  return FieldAccess::get<int32_t>(o, offset);
123 }
124 
125 
126 /*
127  * Class: sun/misc/Unsafe
128  * Method: putBoolean
129  * Signature: (Ljava/lang/Object;JZ)V
130  */
131 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putBoolean(JNIEnv *env, jobject _this, jobject o, jlong offset, jboolean x)
132 {
133  FieldAccess::set(o, offset, (int32_t) x);
134 }
135 
136 
137 /*
138  * Class: sun/misc/Unsafe
139  * Method: getByte
140  * Signature: (Ljava/lang/Object;J)B
141  */
142 JNIEXPORT jbyte JNICALL Java_sun_misc_Unsafe_getByte__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
143 {
144  return FieldAccess::get<int32_t>(o, offset);
145 }
146 
147 
148 /*
149  * Class: sun/misc/Unsafe
150  * Method: putByte
151  * Signature: (Ljava/lang/Object;JB)V
152  */
153 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putByte__Ljava_lang_Object_2JB(JNIEnv *env, jobject _this, jobject o, jlong offset, jbyte x)
154 {
155  FieldAccess::set(o, offset, (int32_t) x);
156 }
157 
158 
159 /*
160  * Class: sun/misc/Unsafe
161  * Method: getShort
162  * Signature: (Ljava/lang/Object;J)S
163  */
164 JNIEXPORT jshort JNICALL Java_sun_misc_Unsafe_getShort__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
165 {
166  return FieldAccess::get<int32_t>(o, offset);
167 }
168 
169 
170 /*
171  * Class: sun/misc/Unsafe
172  * Method: putShort
173  * Signature: (Ljava/lang/Object;JS)V
174  */
175 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putShort__Ljava_lang_Object_2JS(JNIEnv *env, jobject _this, jobject o, jlong offset, jshort x)
176 {
177  FieldAccess::set(o, offset, (int32_t) x);
178 }
179 
180 
181 /*
182  * Class: sun/misc/Unsafe
183  * Method: getChar
184  * Signature: (Ljava/lang/Object;J)C
185  */
186 JNIEXPORT jchar JNICALL Java_sun_misc_Unsafe_getChar__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
187 {
188  return FieldAccess::get<int32_t>(o, offset);
189 }
190 
191 
192 /*
193  * Class: sun/misc/Unsafe
194  * Method: putChar
195  * Signature: (Ljava/lang/Object;JC)V
196  */
197 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putChar__Ljava_lang_Object_2JC(JNIEnv *env, jobject _this, jobject o, jlong offset, jchar x)
198 {
199  FieldAccess::set(o, offset, (int32_t) x);
200 }
201 
202 
203 /*
204  * Class: sun/misc/Unsafe
205  * Method: getLong
206  * Signature: (Ljava/lang/Object;J)J
207  */
208 JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_getLong__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
209 {
210  return FieldAccess::get<int64_t>(o, offset);
211 }
212 
213 
214 /*
215  * Class: sun/misc/Unsafe
216  * Method: putLong
217  * Signature: (Ljava/lang/Object;JJ)V
218  */
219 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong__Ljava_lang_Object_2JJ(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong x)
220 {
221  FieldAccess::set(o, offset, x);
222 }
223 
224 
225 /*
226  * Class: sun/misc/Unsafe
227  * Method: getFloat
228  * Signature: (Ljava/lang/Object;J)F
229  */
230 JNIEXPORT jfloat JNICALL Java_sun_misc_Unsafe_getFloat__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
231 {
232  return FieldAccess::get<float>(o, offset);
233 }
234 
235 
236 /*
237  * Class: sun/misc/Unsafe
238  * Method: putFloat
239  * Signature: (Ljava/lang/Object;JF)V
240  */
241 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putFloat__Ljava_lang_Object_2JF(JNIEnv *env, jobject _this, jobject o, jlong offset, jfloat x)
242 {
243  FieldAccess::set(o, offset, x);
244 }
245 
246 
247 /*
248  * Class: sun/misc/Unsafe
249  * Method: getDouble
250  * Signature: (Ljava/lang/Object;J)D
251  */
252 JNIEXPORT jdouble JNICALL Java_sun_misc_Unsafe_getDouble__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
253 {
254  return FieldAccess::get<double>(o, offset);
255 }
256 
257 
258 /*
259  * Class: sun/misc/Unsafe
260  * Method: putDouble
261  * Signature: (Ljava/lang/Object;JD)V
262  */
263 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putDouble__Ljava_lang_Object_2JD(JNIEnv *env, jobject _this, jobject o, jlong offset, jdouble x)
264 {
265  FieldAccess::set(o, offset, x);
266 }
267 
268 
269 /*
270  * Class: sun/misc/Unsafe
271  * Method: getByte
272  * Signature: (J)B
273  */
274 JNIEXPORT jbyte JNICALL Java_sun_misc_Unsafe_getByte__J(JNIEnv *env, jobject _this, jlong address)
275 {
276  int8_t *p;
277  int8_t value;
278 
279  p = (int8_t *) (intptr_t) address;
280 
281  value = *p;
282 
283  return (int32_t) value;
284 }
285 
286 
287 /*
288  * Class: sun/misc/Unsafe
289  * Method: putByte
290  * Signature: (JB)V
291  */
292 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putByte__JB(JNIEnv *env, jobject _this, jlong address, jbyte value)
293 {
294  int8_t *p;
295 
296  p = (int8_t *) (intptr_t) address;
297 
298  *p = (int8_t) value;
299 }
300 
301 
302 /*
303  * Class: sun/misc/Unsafe
304  * Method: getShort
305  * Signature: (J)S
306  */
307 JNIEXPORT jshort JNICALL Java_sun_misc_Unsafe_getShort__J(JNIEnv *env, jobject _this, jlong address)
308 {
309  int16_t *p;
310  int16_t value;
311 
312  p = (int16_t *) (intptr_t) address;
313 
314  value = *p;
315 
316  return (int32_t) value;
317 }
318 
319 
320 /*
321  * Class: sun/misc/Unsafe
322  * Method: putShort
323  * Signature: (JS)V
324  */
325 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putShort__JS(JNIEnv *env, jobject _this, jlong address, jshort value)
326 {
327  int16_t *p;
328 
329  p = (int16_t *) (intptr_t) address;
330 
331  *p = (int16_t) value;
332 }
333 
334 
335 /*
336  * Class: sun/misc/Unsafe
337  * Method: getChar
338  * Signature: (J)C
339  */
340 JNIEXPORT jchar JNICALL Java_sun_misc_Unsafe_getChar__J(JNIEnv *env, jobject _this, jlong address)
341 {
342  uint16_t *p;
343  uint16_t value;
344 
345  p = (uint16_t *) (intptr_t) address;
346 
347  value = *p;
348 
349  return (int32_t) value;
350 }
351 
352 
353 /*
354  * Class: sun/misc/Unsafe
355  * Method: putChar
356  * Signature: (JC)V
357  */
358 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putChar__JC(JNIEnv *env, jobject _this, jlong address, jchar value)
359 {
360  uint16_t *p;
361 
362  p = (uint16_t *) (intptr_t) address;
363 
364  *p = (uint16_t) value;
365 }
366 
367 
368 /*
369  * Class: sun/misc/Unsafe
370  * Method: getInt
371  * Signature: (J)I
372  */
373 JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_getInt__J(JNIEnv *env, jobject _this, jlong address)
374 {
375  int32_t *p;
376  int32_t value;
377 
378  p = (int32_t *) (intptr_t) address;
379 
380  value = *p;
381 
382  return value;
383 }
384 
385 
386 /*
387  * Class: sun/misc/Unsafe
388  * Method: putInt
389  * Signature: (JI)V
390  */
391 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putInt__JI(JNIEnv *env, jobject _this, jlong address, jint value)
392 {
393  int32_t *p;
394 
395  p = (int32_t *) (intptr_t) address;
396 
397  *p = value;
398 }
399 
400 
401 /*
402  * Class: sun/misc/Unsafe
403  * Method: getLong
404  * Signature: (J)J
405  */
406 JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_getLong__J(JNIEnv *env, jobject _this, jlong address)
407 {
408  int64_t *p;
409  int64_t value;
410 
411  p = (int64_t *) (intptr_t) address;
412 
413  value = *p;
414 
415  return value;
416 }
417 
418 
419 /*
420  * Class: sun/misc/Unsafe
421  * Method: putLong
422  * Signature: (JJ)V
423  */
424 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong__JJ(JNIEnv *env, jobject _this, jlong address, jlong value)
425 {
426  int64_t *p;
427 
428  p = (int64_t *) (intptr_t) address;
429 
430  *p = value;
431 }
432 
433 
434 /*
435  * Class: sun/misc/Unsafe
436  * Method: getFloat
437  * Signature: (J)F
438  */
439 JNIEXPORT jfloat JNICALL Java_sun_misc_Unsafe_getFloat__J(JNIEnv *env, jobject _this, jlong address)
440 {
441  float *p;
442  float value;
443 
444  p = (float *) (intptr_t) address;
445 
446  value = *p;
447 
448  return value;
449 }
450 
451 
452 /*
453  * Class: sun/misc/Unsafe
454  * Method: putFloat
455  * Signature: (JF)V
456  */
457 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putFloat__JF(JNIEnv *env, jobject _this, jlong address, jfloat value)
458 {
459  float* p;
460 
461  p = (float*) (intptr_t) address;
462 
463  *p = value;
464 }
465 
466 
467 /*
468  * Class: sun/misc/Unsafe
469  * Method: getDouble
470  * Signature: (J)D
471  */
472 JNIEXPORT jdouble JNICALL Java_sun_misc_Unsafe_getDouble__J(JNIEnv *env, jobject _this, jlong address)
473 {
474  double *p;
475  double value;
476 
477  p = (double*) (intptr_t) address;
478 
479  value = *p;
480 
481  return value;
482 }
483 
484 
485 /*
486  * Class: sun/misc/Unsafe
487  * Method: putDouble
488  * Signature: (JD)V
489  */
490 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putDouble__JD(JNIEnv *env, jobject _this, jlong address, jdouble value)
491 {
492  double* p;
493 
494  p = (double*) (intptr_t) address;
495 
496  *p = value;
497 }
498 
499 
500 /*
501  * Class: sun_misc_Unsafe
502  * Method: getAddress
503  * Signature: (J)J
504  */
505 JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_getAddress (JNIEnv *env, jobject _this, jlong address)
506 {
507  uintptr_t *p;
508  uintptr_t value;
509 
510  p = (uintptr_t *) (intptr_t) address;
511 
512  value = *p;
513 
514  return value;
515 }
516 
517 
518 /*
519  * Class: sun_misc_Unsafe
520  * Method: putAddress
521  * Signature: (JJ)V
522  */
523 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putAddress (JNIEnv *env, jobject _this, jlong address, jlong value)
524 {
525  uintptr_t *p;
526 
527  p = (uintptr_t *) (intptr_t) address;
528 
529  *p = value;
530 }
531 
532 
533 /*
534  * Class: sun/misc/Unsafe
535  * Method: objectFieldOffset
536  * Signature: (Ljava/lang/reflect/Field;)J
537  */
539 {
540 #if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
541 
542  java_lang_reflect_Field rf(field);
543  java_lang_reflect_VMField rvmf(rf.get_f());
544  fieldinfo* f = rvmf.get_field();
545 
546 #elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
547 
548  java_lang_reflect_Field rf(field);
549  fieldinfo* f = rf.get_field();
550 
551 #else
552 # error unknown configuration
553 #endif
554 
555  return (jlong) f->offset;
556 }
557 
558 
559 /*
560  * Class: sun/misc/Unsafe
561  * Method: allocateMemory
562  * Signature: (J)J
563  */
564 JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_allocateMemory(JNIEnv *env, jobject _this, jlong bytes)
565 {
566  size_t length;
567  void *p;
568 
569  length = (size_t) bytes;
570 
571  if ((length != (uint64_t) bytes) || (bytes < 0)) {
573  return 0;
574  }
575 
576  p = MNEW(uint8_t, length);
577 
578  return (int64_t) (intptr_t) p;
579 }
580 
581 
582 /* OpenJDK 7 */
583 
584 /*
585  * Class: sun/misc/Unsafe
586  * Method: setMemory
587  * Signature: (Ljava/lang/Object;JJB)V
588  */
589 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_setMemory_jdk7(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong bytes, jbyte value)
590 {
591  size_t length;
592  void *p;
593 
594  length = (size_t) bytes;
595 
596  if ((length != (uint64_t) bytes) || (bytes < 0)) {
598  return;
599  }
600 
601  /* XXX Missing LLNI: we need to unwrap _this object. */
602 
603  p = (void *) (((uint8_t *) o) + offset);
604 
605  /* XXX Not sure this is correct. */
606 
607  os::memset(p, value, length);
608 }
609 
610 
611 /*
612  * Class: sun/misc/Unsafe
613  * Method: copyMemory
614  * Signature: (Ljava/lang/Object;JLjava/lang/Object;JJ)V
615  */
616 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_copyMemory_jdk7(JNIEnv *env, jobject _this, jobject srcBase, jlong srcOffset, jobject destBase, jlong destOffset, jlong bytes)
617 {
618  size_t length;
619  void *src;
620  void *dest;
621 
622  if (bytes == 0)
623  return;
624 
625  length = (size_t) bytes;
626 
627  if ((length != (uint64_t) bytes) || (bytes < 0)) {
629  return;
630  }
631 
632  /* XXX Missing LLNI: We need to unwrap these objects. */
633 
634  src = (void *) (((uint8_t *) srcBase) + srcOffset);
635  dest = (void *) (((uint8_t *) destBase) + destOffset);
636 
637  os::memcpy(dest, src, length);
638 }
639 
640 /*
641  * Class: sun/misc/Unsafe
642  * Method: setMemory
643  * Signature: (JJB)V
644  */
645 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_setMemory_jdk6(JNIEnv *env, jobject _this, jlong address, jlong bytes, jbyte value)
646 {
647  size_t length;
648  void *p;
649 
650  length = (size_t) bytes;
651 
652  if ((length != (uint64_t) bytes) || (bytes < 0)) {
654  return;
655  }
656 
657  p = (void *) (intptr_t) address;
658 
659  /* XXX Not sure this is correct. */
660 
661  os::memset(p, value, length);
662 }
663 
664 
665 /*
666  * Class: sun/misc/Unsafe
667  * Method: copyMemory
668  * Signature: (JJJ)V
669  */
670 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_copyMemory_jdk6(JNIEnv *env, jobject _this, jlong srcAddress, jlong destAddress, jlong bytes)
671 {
672  size_t length;
673  void *src;
674  void *dest;
675 
676  if (bytes == 0)
677  return;
678 
679  length = (size_t) bytes;
680 
681  if ((length != (uint64_t) bytes) || (bytes < 0)) {
683  return;
684  }
685 
686  src = (void *) (intptr_t) srcAddress;
687  dest = (void *) (intptr_t) destAddress;
688 
689  os::memcpy(dest, src, length);
690 }
691 
692 
693 /*
694  * Class: sun/misc/Unsafe
695  * Method: freeMemory
696  * Signature: (J)V
697  */
698 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_freeMemory(JNIEnv *env, jobject _this, jlong address)
699 {
700  void *p;
701 
702  p = (void *) (intptr_t) address;
703 
704  if (p == NULL)
705  return;
706 
707  /* we pass length 1 to trick the free function */
708 
709  MFREE(p, uint8_t, 1);
710 }
711 
712 
713 /*
714  * Class: sun/misc/Unsafe
715  * Method: staticFieldOffset
716  * Signature: (Ljava/lang/reflect/Field;)J
717  */
718 JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_staticFieldOffset(JNIEnv *env, jobject _this, jobject f)
719 {
720  /* The offset of static fields is 0. */
721 
722  return 0;
723 }
724 
725 
726 /*
727  * Class: sun/misc/Unsafe
728  * Method: staticFieldBase
729  * Signature: (Ljava/lang/reflect/Field;)Ljava/lang/Object;
730  */
732 {
733 #if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
734 
735  java_lang_reflect_Field rf(field);
736  java_lang_reflect_VMField rvmf(rf.get_f());
737  fieldinfo* f = rvmf.get_field();
738 
739 #elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
740 
741  java_lang_reflect_Field rf(field);
742  fieldinfo* f = rf.get_field();
743 
744 #else
745 # error unknown configuration
746 #endif
747 
748  return (jobject) (f->value);
749 }
750 
751 
752 /*
753  * Class: sun/misc/Unsafe
754  * Method: ensureClassInitialized
755  * Signature: (Ljava/lang/Class;)V
756  */
757 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_ensureClassInitialized(JNIEnv *env, jobject _this, jclass clazz)
758 {
759  classinfo *c;
760 
761  c = LLNI_classinfo_unwrap(clazz);
762 
763  if (!(c->state & CLASS_INITIALIZED))
764  initialize_class(c);
765 }
766 
767 
768 /*
769  * Class: sun/misc/Unsafe
770  * Method: arrayBaseOffset
771  * Signature: (Ljava/lang/Class;)I
772  */
773 JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_arrayBaseOffset(JNIEnv *env, jobject _this, jclass arrayClass)
774 {
775  classinfo *c;
776  arraydescriptor *ad;
777 
778  c = LLNI_classinfo_unwrap(arrayClass);
779  ad = c->vftbl->arraydesc;
780 
781  if (ad == NULL) {
782  /* XXX does that exception exist? */
783  exceptions_throw_internalerror("java/lang/InvalidClassException");
784  return 0;
785  }
786 
787  return ad->dataoffset;
788 }
789 
790 
791 /*
792  * Class: sun/misc/Unsafe
793  * Method: arrayIndexScale
794  * Signature: (Ljava/lang/Class;)I
795  */
796 JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_arrayIndexScale(JNIEnv *env, jobject _this, jclass arrayClass)
797 {
798  classinfo *c;
799  arraydescriptor *ad;
800 
801  c = LLNI_classinfo_unwrap(arrayClass);
802  ad = c->vftbl->arraydesc;
803 
804  if (ad == NULL) {
805  /* XXX does that exception exist? */
806  exceptions_throw_internalerror("java/lang/InvalidClassException");
807  return 0;
808  }
809 
810  return ad->componentsize;
811 }
812 
813 
814 /*
815  * Class: sun/misc/Unsafe
816  * Method: addressSize
817  * Signature: ()I
818  */
819 JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_addressSize(JNIEnv *env, jobject _this)
820 {
821  return SIZEOF_VOID_P;
822 }
823 
824 
825 /*
826  * Class: sun/misc/Unsafe
827  * Method: pageSize
828  * Signature: ()I
829  */
830 JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_pageSize(JNIEnv *env, jobject _this)
831 {
832  int sz;
833 
834  sz = os::getpagesize();
835 
836  return sz;
837 }
838 
839 
840 /*
841  * Class: sun/misc/Unsafe
842  * Method: defineClass
843  * Signature: (Ljava/lang/String;[BIILjava/lang/ClassLoader;Ljava/security/ProtectionDomain;)Ljava/lang/Class;
844  */
846 {
847  classloader_t *cl;
848  Utf8String utfname;
849  classinfo *c;
850 
852 
853  /* check if data was passed */
854 
855  if (b == NULL) {
857  return NULL;
858  }
859 
860  /* check the indexes passed */
861 
862  ByteArray ba(b);
863 
864  if ((off < 0) || (len < 0) || ((off + len) > ba.get_length())) {
866  return NULL;
867  }
868 
869  if (name != NULL) {
870  /* convert '.' to '/' in java string */
871 
872  utfname = JavaString((java_handle_t*) name).to_utf8_dot_to_slash();
873  }
874  else {
875  utfname = NULL;
876  }
877 
878  /* define the class */
879 
880  uint8_t* ptr = ((uint8_t*) ba.get_raw_data_ptr()) + off;
881  c = class_define(utfname, cl, len, ptr,
882  (java_handle_t *) protectionDomain);
883 
884  if (c == NULL)
885  return NULL;
886 
888 
889 #if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
890  // Set ProtectionDomain.
891  java_lang_Class jlc(h);
892  jlc.set_pd(protectionDomain);
893 #endif
894 
895  return (jclass) h;
896 }
897 
898 
899 /*
900  * Class: sun/misc/Unsafe
901  * Method: allocateInstance
902  * Signature: (Ljava/lang/Class;)Ljava/lang/Object;
903  */
905 {
906  classinfo *c;
907  java_handle_t *o;
908 
909  c = LLNI_classinfo_unwrap(cls);
910 
911  o = builtin_new(c);
912 
913  return (jobject ) o;
914 }
915 
916 
917 /*
918  * Class: sun/misc/Unsafe
919  * Method: throwException
920  * Signature: (Ljava/lang/Throwable;)V
921  */
922 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_throwException(JNIEnv *env, jobject _this, jobject ee)
923 {
924  java_handle_t *o;
925 
926  o = (java_handle_t *) ee;
927 
929 }
930 
931 
932 /*
933  * Class: sun/misc/Unsafe
934  * Method: compareAndSwapObject
935  * Signature: (Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z
936  */
937 JNIEXPORT jboolean JNICALL Java_sun_misc_Unsafe_compareAndSwapObject(JNIEnv *env, jobject _this, jobject o, jlong offset, jobject expected, jobject x)
938 {
939  void **p;
940  void *result;
941 
942  /* XXX Use LLNI */
943 
944  p = (void **) (((uint8_t *) o) + offset);
945 
946  result = Atomic::compare_and_swap(p, (void *) expected, (void *) x);
947 #if defined(CAS_PROVIDES_FULL_BARRIER) && CAS_PROVIDES_FULL_BARRIER
949 #else
951 #endif
952 
953  if (result == expected)
954  return true;
955 
956  return false;
957 }
958 
959 
960 /*
961  * Class: sun/misc/Unsafe
962  * Method: compareAndSwapInt
963  * Signature: (Ljava/lang/Object;JII)Z
964  */
965 JNIEXPORT jboolean JNICALL Java_sun_misc_Unsafe_compareAndSwapInt(JNIEnv *env, jobject _this, jobject o, jlong offset, jint expected, jint x)
966 {
967  uint32_t *p;
968  uint32_t result;
969 
970  /* XXX Use LLNI */
971 
972  p = (uint32_t *) (((uint8_t *) o) + offset);
973 
974  result = Atomic::compare_and_swap(p, (uint32_t) expected, (uint32_t) x);
975 #if defined(CAS_PROVIDES_FULL_BARRIER) && CAS_PROVIDES_FULL_BARRIER
977 #else
979 #endif
980 
981  if (result == (uint32_t) expected)
982  return true;
983 
984  return false;
985 }
986 
987 
988 /*
989  * Class: sun/misc/Unsafe
990  * Method: compareAndSwapLong
991  * Signature: (Ljava/lang/Object;JJJ)Z
992  */
993 JNIEXPORT jboolean JNICALL Java_sun_misc_Unsafe_compareAndSwapLong(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong expected, jlong x)
994 {
995  uint64_t *p;
996  uint64_t result;
997 
998  /* XXX Use LLNI */
999 
1000  p = (uint64_t *) (((uint8_t *) o) + offset);
1001 
1002  result = Atomic::compare_and_swap(p, (uint64_t) expected, (uint64_t) x);
1003 #if defined(CAS_PROVIDES_FULL_BARRIER) && CAS_PROVIDES_FULL_BARRIER
1005 #else
1007 #endif
1008 
1009  if (result == (uint64_t) expected)
1010  return true;
1011 
1012  return false;
1013 }
1014 
1015 
1016 /*
1017  * Class: sun/misc/Unsafe
1018  * Method: getObjectVolatile
1019  * Signature: (Ljava/lang/Object;J)Ljava/lang/Object;
1020  */
1021 JNIEXPORT jobject JNICALL Java_sun_misc_Unsafe_getObjectVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
1022 {
1023  return FieldAccess::get_volatile<jobject>(o, offset);
1024 }
1025 
1026 
1027 /*
1028  * Class: sun/misc/Unsafe
1029  * Method: putObjectVolatile
1030  * Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
1031  */
1032 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObjectVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jobject x)
1033 {
1034  FieldAccess::set_volatile(o, offset, x);
1035 }
1036 
1037 
1038 /*
1039  * Class: sun/misc/Unsafe
1040  * Method: getBooleanVolatile
1041  * Signature: (Ljava/lang/Object;J)Z
1042  */
1043 JNIEXPORT jboolean JNICALL Java_sun_misc_Unsafe_getBooleanVolatile(JNIEnv* env, jobject _this, jobject o, jlong offset)
1044 {
1045  return FieldAccess::get_volatile<int32_t>(o, offset);
1046 }
1047 
1048 
1049 /*
1050  * Class: sun/misc/Unsafe
1051  * Method: putBooleanVolatile
1052  * Signature: (Ljava/lang/Object;JZ)V
1053  */
1054 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putBooleanVolatile (JNIEnv *env, jobject _this, jobject o, jlong offset, jboolean x)
1055 {
1056  FieldAccess::set_volatile(o, offset, x);
1057 }
1058 
1059 
1060 /*
1061  * Class: sun/misc/Unsafe
1062  * Method: getByteVolatile
1063  * Signature: (Ljava/lang/Object;J)B
1064  */
1065 JNIEXPORT jbyte JNICALL Java_sun_misc_Unsafe_getByteVolatile(JNIEnv* env, jobject _this, jobject o, jlong offset)
1066 {
1067  return FieldAccess::get_volatile<int32_t>(o, offset);
1068 }
1069 
1070 
1071 /*
1072  * Class: sun/misc/Unsafe
1073  * Method: putByteVolatile
1074  * Signature: (Ljava/lang/Object;JB)V
1075  */
1076 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putByteVolatile (JNIEnv *env, jobject _this, jobject o, jlong offset, jbyte x)
1077 {
1078  FieldAccess::set_volatile(o, offset, x);
1079 }
1080 
1081 
1082 /*
1083  * Class: sun/misc/Unsafe
1084  * Method: getShortVolatile
1085  * Signature: (Ljava/lang/Object;J)S
1086  */
1087 JNIEXPORT jshort JNICALL Java_sun_misc_Unsafe_getShortVolatile(JNIEnv* env, jobject _this, jobject o, jlong offset)
1088 {
1089  return FieldAccess::get_volatile<int32_t>(o, offset);
1090 }
1091 
1092 
1093 /*
1094  * Class: sun/misc/Unsafe
1095  * Method: putShortVolatile
1096  * Signature: (Ljava/lang/Object;JS)V
1097  */
1098 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putShortVolatile (JNIEnv *env, jobject _this, jobject o, jlong offset, jshort x)
1099 {
1100  FieldAccess::set_volatile(o, offset, x);
1101 }
1102 
1103 
1104 /*
1105  * Class: sun/misc/Unsafe
1106  * Method: getCharVolatile
1107  * Signature: (Ljava/lang/Object;J)C
1108  */
1109 JNIEXPORT jchar JNICALL Java_sun_misc_Unsafe_getCharVolatile(JNIEnv* env, jobject _this, jobject o, jlong offset)
1110 {
1111  return FieldAccess::get_volatile<int32_t>(o, offset);
1112 }
1113 
1114 
1115 /*
1116  * Class: sun/misc/Unsafe
1117  * Method: putCharVolatile
1118  * Signature: (Ljava/lang/Object;JC)V
1119  */
1120 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putCharVolatile (JNIEnv *env, jobject _this, jobject o, jlong offset, jchar x)
1121 {
1122  FieldAccess::set_volatile(o, offset, x);
1123 }
1124 
1125 
1126 /*
1127  * Class: sun/misc/Unsafe
1128  * Method: getIntVolatile
1129  * Signature: (Ljava/lang/Object;J)I
1130  */
1131 JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_getIntVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
1132 {
1133  return FieldAccess::get_volatile<int32_t>(o, offset);
1134 }
1135 
1136 
1137 /*
1138  * Class: sun/misc/Unsafe
1139  * Method: putIntVolatile
1140  * Signature: (Ljava/lang/Object;JI)V
1141  */
1142 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putIntVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jint x)
1143 {
1144  FieldAccess::set_volatile(o, offset, x);
1145 }
1146 
1147 
1148 /*
1149  * Class: sun/misc/Unsafe
1150  * Method: getLongVolatile
1151  * Signature: (Ljava/lang/Object;J)J
1152  */
1153 JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_getLongVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
1154 {
1155  return FieldAccess::get_volatile<int64_t>(o, offset);
1156 }
1157 
1158 
1159 /*
1160  * Class: sun/misc/Unsafe
1161  * Method: putLongVolatile
1162  * Signature: (Ljava/lang/Object;JJ)V
1163  */
1164 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLongVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong x)
1165 {
1166  FieldAccess::set_volatile(o, offset, x);
1167 }
1168 
1169 
1170 /*
1171  * Class: sun/misc/Unsafe
1172  * Method: getFloatVolatile
1173  * Signature: (Ljava/lang/Object;J)F
1174  */
1175 JNIEXPORT jfloat JNICALL Java_sun_misc_Unsafe_getFloatVolatile(JNIEnv* env, jobject _this, jobject o, jlong offset)
1176 {
1177  return FieldAccess::get_volatile<float>(o, offset);
1178 }
1179 
1180 
1181 /*
1182  * Class: sun/misc/Unsafe
1183  * Method: putFloatVolatile
1184  * Signature: (Ljava/lang/Object;JF)V
1185  */
1186 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putFloatVolatile (JNIEnv *env, jobject _this, jobject o, jlong offset, jfloat x)
1187 {
1188  FieldAccess::set_volatile(o, offset, x);
1189 }
1190 
1191 
1192 /*
1193  * Class: sun/misc/Unsafe
1194  * Method: getDoubleVolatile
1195  * Signature: (Ljava/lang/Object;J)D
1196  */
1197 JNIEXPORT jdouble JNICALL Java_sun_misc_Unsafe_getDoubleVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
1198 {
1199  return FieldAccess::get_volatile<double>(o, offset);
1200 }
1201 
1202 
1203 /*
1204  * Class: sun/misc/Unsafe
1205  * Method: putDoubleVolatile
1206  * Signature: (Ljava/lang/Object;JD)V
1207  */
1208 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putDoubleVolatile (JNIEnv *env, jobject _this, jobject o, jlong offset, jdouble x)
1209 {
1210  FieldAccess::set_volatile(o, offset, x);
1211 }
1212 
1213 
1214 /*
1215  * Class: sun/misc/Unsafe
1216  * Method: putOrderedObject
1217  * Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
1218  */
1219 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedObject(JNIEnv *env, jobject _this, jobject o, jlong offset, jobject x)
1220 {
1221  FieldAccess::set_volatile(o, offset, x);
1222 }
1223 
1224 
1225 /*
1226  * Class: sun/misc/Unsafe
1227  * Method: putOrderedInt
1228  * Signature: (Ljava/lang/Object;JI)V
1229  */
1230 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedInt(JNIEnv *env, jobject _this, jobject o, jlong offset, jint x)
1231 {
1232  FieldAccess::set_volatile(o, offset, x);
1233 }
1234 
1235 
1236 /*
1237  * Class: sun/misc/Unsafe
1238  * Method: putOrderedLong
1239  * Signature: (Ljava/lang/Object;JJ)V
1240  */
1241 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedLong(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong x)
1242 {
1243  FieldAccess::set_volatile(o, offset, x);
1244 }
1245 
1246 
1247 /*
1248  * Class: sun/misc/Unsafe
1249  * Method: unpark
1250  * Signature: (Ljava/lang/Object;)V
1251  */
1252 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_unpark(JNIEnv *env, jobject _this, jobject thread)
1253 {
1254  java_handle_t *h = (java_handle_t *) thread;
1255  threadobject *t;
1256 
1257 #if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
1258  h = java_lang_Thread(h).get_vmThread();
1259 #endif
1260  t = thread_get_thread(h);
1261 
1262  threads_unpark(t);
1263 }
1264 
1265 
1266 /*
1267  * Class: sun/misc/Unsafe
1268  * Method: park
1269  * Signature: (ZJ)V
1270  */
1271 JNIEXPORT void JNICALL Java_sun_misc_Unsafe_park(JNIEnv *env, jobject _this, jboolean isAbsolute, jlong time)
1272 {
1273  threads_park(isAbsolute, time);
1274 }
1275 
1276 
1277 /*
1278  * Class: sun/misc/Unsafe
1279  * Method: getLoadAverage
1280  * Signature: ([DI)I
1281  */
1282 JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_getLoadAverage(JNIEnv *env, jobject _this, jdoubleArray loadavg, jint nelem)
1283 {
1284  DoubleArray da(loadavg);
1285 
1286 #define MAX_SAMPLES 3
1287 
1288  // Check the passed number of samples.
1289  if ((nelem < 0) || (nelem > da.get_length()) || nelem > MAX_SAMPLES) {
1291  return -1;
1292  }
1293 
1294  // Actually retrieve samples.
1295  double values[MAX_SAMPLES];
1296  int result = os::getloadavg(values, nelem);
1297 
1298  // Save samples into the given array.
1299  for (int i = 0; i < result; i++) {
1300  da.set_element(i, values[i]);
1301  }
1302 
1303  return result;
1304 }
1305 
1306 } // extern "C"
1307 
1308 
1309 /* native methods implemented by this file ************************************/
1310 
1311 static JNINativeMethod methods[] = {
1312  { (char*) "registerNatives", (char*) "()V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_registerNatives },
1313  { (char*) "getInt", (char*) "(Ljava/lang/Object;J)I", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getInt__Ljava_lang_Object_2J },
1314  { (char*) "putInt", (char*) "(Ljava/lang/Object;JI)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putInt__Ljava_lang_Object_2JI },
1315  { (char*) "getObject", (char*) "(Ljava/lang/Object;J)Ljava/lang/Object;", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getObject },
1316  { (char*) "putObject", (char*) "(Ljava/lang/Object;JLjava/lang/Object;)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putObject },
1317  { (char*) "getBoolean", (char*) "(Ljava/lang/Object;J)Z", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getBoolean },
1318  { (char*) "putBoolean", (char*) "(Ljava/lang/Object;JZ)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putBoolean },
1319  { (char*) "getByte", (char*) "(Ljava/lang/Object;J)B", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getByte__Ljava_lang_Object_2J },
1320  { (char*) "putByte", (char*) "(Ljava/lang/Object;JB)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putByte__Ljava_lang_Object_2JB },
1321  { (char*) "getShort", (char*) "(Ljava/lang/Object;J)S", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getShort__Ljava_lang_Object_2J },
1322  { (char*) "putShort", (char*) "(Ljava/lang/Object;JS)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putShort__Ljava_lang_Object_2JS },
1323  { (char*) "getChar", (char*) "(Ljava/lang/Object;J)C", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getChar__Ljava_lang_Object_2J },
1324  { (char*) "putChar", (char*) "(Ljava/lang/Object;JC)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putChar__Ljava_lang_Object_2JC },
1325  { (char*) "getLong", (char*) "(Ljava/lang/Object;J)J", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getLong__Ljava_lang_Object_2J },
1326  { (char*) "putLong", (char*) "(Ljava/lang/Object;JJ)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putLong__Ljava_lang_Object_2JJ },
1327  { (char*) "getFloat", (char*) "(Ljava/lang/Object;J)F", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getFloat__Ljava_lang_Object_2J },
1328  { (char*) "putFloat", (char*) "(Ljava/lang/Object;JF)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putFloat__Ljava_lang_Object_2JF },
1329  { (char*) "getDouble", (char*) "(Ljava/lang/Object;J)D", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getDouble__Ljava_lang_Object_2J },
1330  { (char*) "putDouble", (char*) "(Ljava/lang/Object;JD)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putDouble__Ljava_lang_Object_2JD },
1331  { (char*) "getByte", (char*) "(J)B", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getByte__J },
1332  { (char*) "putByte", (char*) "(JB)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putByte__JB },
1333  { (char*) "getShort", (char*) "(J)S", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getShort__J },
1334  { (char*) "putShort", (char*) "(JS)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putShort__JS },
1335  { (char*) "getChar", (char*) "(J)C", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getChar__J },
1336  { (char*) "putChar", (char*) "(JC)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putChar__JC },
1337  { (char*) "getInt", (char*) "(J)I", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getInt__J },
1338  { (char*) "putInt", (char*) "(JI)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putInt__JI },
1339  { (char*) "getLong", (char*) "(J)J", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getLong__J },
1340  { (char*) "putLong", (char*) "(JJ)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putLong__JJ },
1341  { (char*) "getFloat", (char*) "(J)F", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getFloat__J },
1342  { (char*) "putFloat", (char*) "(JF)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putFloat__JF },
1343  { (char*) "getDouble", (char*) "(J)D", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getDouble__J },
1344  { (char*) "putDouble", (char*) "(JD)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putDouble__JD },
1345  { (char*) "getAddress", (char*) "(J)J", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getAddress },
1346  { (char*) "putAddress", (char*) "(Ljava/lang/Object;JJ)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putAddress },
1347  { (char*) "objectFieldOffset", (char*) "(Ljava/lang/reflect/Field;)J", (void*) (uintptr_t) &Java_sun_misc_Unsafe_objectFieldOffset },
1348  { (char*) "allocateMemory", (char*) "(J)J", (void*) (uintptr_t) &Java_sun_misc_Unsafe_allocateMemory },
1349  // next two methods: OpenJDK 7
1350  { (char*) "setMemory", (char*) "(Ljava/lang/Object;JJB)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_setMemory_jdk7 },
1351  { (char*) "copyMemory", (char*) "(Ljava/lang/Object;JLjava/lang/Object;JJ)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_copyMemory_jdk7 },
1352  // next two methods: OpenJDK 6
1353  { (char*) "setMemory", (char*) "(JJB)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_setMemory_jdk6 },
1354  { (char*) "copyMemory", (char*) "(JJJ)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_copyMemory_jdk6 },
1355  { (char*) "freeMemory", (char*) "(J)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_freeMemory },
1356  { (char*) "staticFieldOffset", (char*) "(Ljava/lang/reflect/Field;)J", (void*) (uintptr_t) &Java_sun_misc_Unsafe_staticFieldOffset },
1357  { (char*) "staticFieldBase", (char*) "(Ljava/lang/reflect/Field;)Ljava/lang/Object;", (void*) (uintptr_t) &Java_sun_misc_Unsafe_staticFieldBase },
1358  { (char*) "ensureClassInitialized", (char*) "(Ljava/lang/Class;)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_ensureClassInitialized },
1359  { (char*) "arrayBaseOffset", (char*) "(Ljava/lang/Class;)I", (void*) (uintptr_t) &Java_sun_misc_Unsafe_arrayBaseOffset },
1360  { (char*) "arrayIndexScale", (char*) "(Ljava/lang/Class;)I", (void*) (uintptr_t) &Java_sun_misc_Unsafe_arrayIndexScale },
1361  { (char*) "addressSize", (char*) "()I", (void*) (uintptr_t) &Java_sun_misc_Unsafe_addressSize },
1362  { (char*) "pageSize", (char*) "()I", (void*) (uintptr_t) &Java_sun_misc_Unsafe_pageSize },
1363  { (char*) "defineClass", (char*) "(Ljava/lang/String;[BIILjava/lang/ClassLoader;Ljava/security/ProtectionDomain;)Ljava/lang/Class;", (void*) (uintptr_t) &Java_sun_misc_Unsafe_defineClass__Ljava_lang_String_2_3BIILjava_lang_ClassLoader_2Ljava_security_ProtectionDomain_2 },
1364  { (char*) "allocateInstance", (char*) "(Ljava/lang/Class;)Ljava/lang/Object;", (void*) (uintptr_t) &Java_sun_misc_Unsafe_allocateInstance },
1365  { (char*) "throwException", (char*) "(Ljava/lang/Throwable;)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_throwException },
1366  { (char*) "compareAndSwapObject", (char*) "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", (void*) (uintptr_t) &Java_sun_misc_Unsafe_compareAndSwapObject },
1367  { (char*) "compareAndSwapInt", (char*) "(Ljava/lang/Object;JII)Z", (void*) (uintptr_t) &Java_sun_misc_Unsafe_compareAndSwapInt },
1368  { (char*) "compareAndSwapLong", (char*) "(Ljava/lang/Object;JJJ)Z", (void*) (uintptr_t) &Java_sun_misc_Unsafe_compareAndSwapLong },
1369  { (char*) "getObjectVolatile", (char*) "(Ljava/lang/Object;J)Ljava/lang/Object;", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getObjectVolatile },
1370  { (char*) "putObjectVolatile", (char*) "(Ljava/lang/Object;JLjava/lang/Object;)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putObjectVolatile },
1371  { (char*) "getBooleanVolatile", (char*) "(Ljava/lang/Object;J)Z", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getBooleanVolatile },
1372  { (char*) "putBooleanVolatile", (char*) "(Ljava/lang/Object;JZ)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putBooleanVolatile },
1373  { (char*) "getByteVolatile", (char*) "(Ljava/lang/Object;J)B", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getByteVolatile },
1374  { (char*) "putByteVolatile", (char*) "(Ljava/lang/Object;JB)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putByteVolatile },
1375  { (char*) "getShortVolatile", (char*) "(Ljava/lang/Object;J)S", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getShortVolatile },
1376  { (char*) "putShortVolatile", (char*) "(Ljava/lang/Object;JS)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putShortVolatile },
1377  { (char*) "getCharVolatile", (char*) "(Ljava/lang/Object;J)C", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getCharVolatile },
1378  { (char*) "putCharVolatile", (char*) "(Ljava/lang/Object;JC)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putCharVolatile },
1379  { (char*) "getIntVolatile", (char*) "(Ljava/lang/Object;J)I", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getIntVolatile },
1380  { (char*) "putIntVolatile", (char*) "(Ljava/lang/Object;JI)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putIntVolatile },
1381  { (char*) "getLongVolatile", (char*) "(Ljava/lang/Object;J)J", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getLongVolatile },
1382  { (char*) "putLongVolatile", (char*) "(Ljava/lang/Object;JJ)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putLongVolatile },
1383  { (char*) "getFloatVolatile", (char*) "(Ljava/lang/Object;J)F", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getFloatVolatile },
1384  { (char*) "putFloatVolatile", (char*) "(Ljava/lang/Object;JF)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putFloatVolatile },
1385  { (char*) "getDoubleVolatile", (char*) "(Ljava/lang/Object;J)D", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getDoubleVolatile },
1386  { (char*) "putDoubleVolatile", (char*) "(Ljava/lang/Object;JD)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putDoubleVolatile },
1387  { (char*) "putOrderedObject", (char*) "(Ljava/lang/Object;JLjava/lang/Object;)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putOrderedObject },
1388  { (char*) "putOrderedInt", (char*) "(Ljava/lang/Object;JI)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putOrderedInt },
1389  { (char*) "putOrderedLong", (char*) "(Ljava/lang/Object;JJ)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_putOrderedLong },
1390  { (char*) "unpark", (char*) "(Ljava/lang/Object;)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_unpark },
1391  { (char*) "park", (char*) "(ZJ)V", (void*) (uintptr_t) &Java_sun_misc_Unsafe_park },
1392  { (char*) "getLoadAverage", (char*) "([DI)I", (void*) (uintptr_t) &Java_sun_misc_Unsafe_getLoadAverage },
1393 };
1394 
1395 
1396 /* _Jv_sun_misc_Unsafe_init ****************************************************
1397 
1398  Register native functions.
1399 
1400 *******************************************************************************/
1401 
1403 {
1404  Utf8String u = Utf8String::from_utf8("sun/misc/Unsafe");
1405 
1408 }
1409 
1410 
1411 /*
1412  * These are local overrides for various environment variables in Emacs.
1413  * Please do not remove this and leave it at the end of the file, where
1414  * Emacs will automagically detect them.
1415  * ---------------------------------------------------------------------
1416  * Local variables:
1417  * mode: c++
1418  * indent-tabs-mode: t
1419  * c-basic-offset: 4
1420  * tab-width: 4
1421  * End:
1422  * vim:noexpandtab:sw=4:ts=4:
1423  */
void exceptions_throw_illegalargumentexception(void)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_park(JNIEnv *env, jobject _this, jboolean isAbsolute, jlong time)
JNIEXPORT jshort JNICALL Java_sun_misc_Unsafe_getShortVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
static void * memset(void *s, int c, size_t n)
Definition: os.hpp:501
JNIEXPORT jboolean JNICALL Java_sun_misc_Unsafe_getBoolean(JNIEnv *env, jobject _this, jobject o, jlong offset)
JNIEXPORT jshort JNICALL Java_sun_misc_Unsafe_getShort__J(JNIEnv *env, jobject _this, jlong address)
JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_getLongVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
JNIEXPORT jbyte JNICALL Java_sun_misc_Unsafe_getByte__J(JNIEnv *env, jobject _this, jlong address)
JNIEnv jthread jmethodID jlocation jclass jobject jfieldID field
Definition: jvmti.h:221
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putIntVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jint x)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putInt__JI(JNIEnv *env, jobject _this, jlong address, jint value)
T compare_and_swap(T *p, T o, T n)
Definition: atomic.hpp:92
Table containing all native methods registered with the VM.
Definition: native.hpp:132
NativeMethods & get_nativemethods()
Definition: vm.hpp:128
void register_methods(Utf8String classname, const JNINativeMethod *methods, size_t count)
Register native methods with the VM.
Definition: native.cpp:242
JNIEXPORT jchar JNICALL Java_sun_misc_Unsafe_getCharVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
JNIEXPORT jclass JNICALL Java_sun_misc_Unsafe_defineClass__Ljava_lang_String_2_3BIILjava_lang_ClassLoader_2Ljava_security_ProtectionDomain_2(JNIEnv *env, jobject _this, jstring name, jbyteArray b, jint off, jint len, jobject loader, jobject protectionDomain)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putShort__Ljava_lang_Object_2JS(JNIEnv *env, jobject _this, jobject o, jlong offset, jshort x)
_Jv_JNIEnv JNIEnv
Definition: jni.hpp:112
JNIEXPORT jbyte JNICALL Java_sun_misc_Unsafe_getByteVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
void threads_unpark(threadobject *t)
Unpark the specified thread.
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putFloat__Ljava_lang_Object_2JF(JNIEnv *env, jobject _this, jobject o, jlong offset, jfloat x)
JNIEXPORT jshort JNICALL Java_sun_misc_Unsafe_getShort__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
#define NATIVE_METHODS_COUNT
Definition: native.hpp:45
JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_addressSize(JNIEnv *env, jobject _this)
int8_t * get_raw_data_ptr()
Definition: array.hpp:333
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObject(JNIEnv *env, jobject _this, jobject o, jlong offset, jobject x)
s4 state
Definition: class.hpp:115
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_copyMemory_jdk6(JNIEnv *env, jobject _this, jlong srcAddress, jlong destAddress, jlong bytes)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putFloatVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jfloat x)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedLong(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong x)
void set_pd(java_handle_t *value)
JNIEXPORT jchar JNICALL Java_sun_misc_Unsafe_getChar__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
GNU Classpath java/lang/reflect/Field.
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong__Ljava_lang_Object_2JJ(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong x)
JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_pageSize(JNIEnv *env, jobject _this)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putFloat__JF(JNIEnv *env, jobject _this, jlong address, jfloat value)
JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_getLong__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
static void set(java_handle_t *h, const off_t offset, T value)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putBoolean(JNIEnv *env, jobject _this, jobject o, jlong offset, jboolean x)
JNIEXPORT jobject JNICALL Java_sun_misc_Unsafe_getObject(JNIEnv *env, jobject _this, jobject o, jlong offset)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong__JJ(JNIEnv *env, jobject _this, jlong address, jlong value)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putDouble__Ljava_lang_Object_2JD(JNIEnv *env, jobject _this, jobject o, jlong offset, jdouble x)
JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_staticFieldOffset(JNIEnv *env, jobject _this, jobject f)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_copyMemory_jdk7(JNIEnv *env, jobject _this, jobject srcBase, jlong srcOffset, jobject destBase, jlong destOffset, jlong bytes)
JNIEnv jclass jobject const char * name
Definition: jvmti.h:312
JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_getInt__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
void set_element(int32_t index, T value)
Definition: array.hpp:255
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLongVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong x)
JNIEXPORT jfloat JNICALL Java_sun_misc_Unsafe_getFloat__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
JNIEXPORT jobject JNICALL Java_sun_misc_Unsafe_staticFieldBase(JNIEnv *env, jobject _this, jobject field)
JNIEXPORT jfloat JNICALL Java_sun_misc_Unsafe_getFloat__J(JNIEnv *env, jobject _this, jlong address)
classloader_t * loader_hashtable_classloader_add(java_handle_t *cl)
Definition: loader.cpp:305
java_handle_t * builtin_new(classinfo *c)
Definition: builtin.cpp:816
JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_getLong__J(JNIEnv *env, jobject _this, jlong address)
static void set_volatile(java_handle_t *h, const off_t offset, T value)
JNIEXPORT jobject JNICALL Java_sun_misc_Unsafe_allocateInstance(JNIEnv *env, jobject _this, jclass cls)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_freeMemory(JNIEnv *env, jobject _this, jlong address)
#define LLNI_classinfo_wrap(classinfo)
Definition: llni.hpp:110
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putByte__JB(JNIEnv *env, jobject _this, jlong address, jbyte value)
JNIEXPORT jboolean JNICALL Java_sun_misc_Unsafe_compareAndSwapLong(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong expected, jlong x)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedInt(JNIEnv *env, jobject _this, jobject o, jlong offset, jint x)
#define MFREE(ptr, type, num)
Definition: memory.hpp:97
int32_t get_length() const
Definition: array.hpp:189
JNIEXPORT jdouble JNICALL Java_sun_misc_Unsafe_getDouble__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
void exceptions_set_exception(java_handle_t *e)
Definition: exceptions.cpp:101
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putShort__JS(JNIEnv *env, jobject _this, jlong address, jshort value)
JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_getIntVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putDouble__JD(JNIEnv *env, jobject _this, jlong address, jdouble value)
int32_t offset
Definition: field.hpp:66
static int getpagesize(void)
Definition: os.hpp:433
void exceptions_throw_nullpointerexception(void)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_setMemory_jdk7(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong bytes, jbyte value)
imm_union * value
Definition: field.hpp:67
void exceptions_throw_internalerror(const char *message,...)
Definition: exceptions.cpp:805
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putDoubleVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jdouble x)
JNIEnv jthread thread
Definition: jvmti.h:207
static Utf8String from_utf8(const char *, size_t)
Definition: utf8.cpp:335
JNIEnv jthread jmethodID void * address
Definition: jvmti.h:264
JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_allocateMemory(JNIEnv *env, jobject _this, jlong bytes)
MIIterator i
JNIEnv jclass jobject loader
Definition: jvmti.h:312
static void * memcpy(void *dest, const void *src, size_t n)
Definition: os.hpp:492
JNIEXPORT jboolean JNICALL Java_sun_misc_Unsafe_compareAndSwapInt(JNIEnv *env, jobject _this, jobject o, jlong offset, jint expected, jint x)
JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_arrayBaseOffset(JNIEnv *env, jobject _this, jclass arrayClass)
JNIEXPORT jboolean JNICALL Java_sun_misc_Unsafe_compareAndSwapObject(JNIEnv *env, jobject _this, jobject o, jlong offset, jobject expected, jobject x)
JNIEXPORT jboolean JNICALL Java_sun_misc_Unsafe_getBooleanVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_ensureClassInitialized(JNIEnv *env, jobject _this, jclass clazz)
bool initialize_class(classinfo *c)
Definition: initialize.cpp:110
JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_getAddress(JNIEnv *env, jobject _this, jlong address)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedObject(JNIEnv *env, jobject _this, jobject o, jlong offset, jobject x)
JNIEXPORT jchar JNICALL Java_sun_misc_Unsafe_getChar__J(JNIEnv *env, jobject _this, jlong address)
threadobject * thread_get_thread(java_handle_t *h)
Definition: thread.cpp:874
JNIEXPORT jdouble JNICALL Java_sun_misc_Unsafe_getDouble__J(JNIEnv *env, jobject _this, jlong address)
arraydescriptor * arraydesc
Definition: vftbl.hpp:101
#define MNEW(type, num)
Definition: memory.hpp:96
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putByte__Ljava_lang_Object_2JB(JNIEnv *env, jobject _this, jobject o, jlong offset, jbyte x)
void exceptions_throw_arrayindexoutofboundsexception(void)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putInt__Ljava_lang_Object_2JI(JNIEnv *env, jobject _this, jobject o, jlong offset, jint x)
vftbl_t * vftbl
Definition: class.hpp:121
java_handle_t * get_vmThread() const
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putShortVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jshort x)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_registerNatives(JNIEnv *env, jclass clazz)
void _Jv_sun_misc_Unsafe_init()
void memory_barrier(void)
Definition: atomic.hpp:96
#define MAX_SAMPLES
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObjectVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jobject x)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putCharVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jchar x)
void threads_park(bool absolute, int64_t nanos)
Park the current thread for the specified amount of time or until a specified deadline.
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_throwException(JNIEnv *env, jobject _this, jobject ee)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putChar__Ljava_lang_Object_2JC(JNIEnv *env, jobject _this, jobject o, jlong offset, jchar x)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putAddress(JNIEnv *env, jobject _this, jlong address, jlong value)
java_handle_t * get_f() const
GNU Classpath java/lang/Thread.
s4 componentsize
Definition: array.hpp:78
JNIEXPORT jdouble JNICALL Java_sun_misc_Unsafe_getDoubleVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
fieldinfo * get_field() const
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_setMemory_jdk6(JNIEnv *env, jobject _this, jlong address, jlong bytes, jbyte value)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_unpark(JNIEnv *env, jobject _this, jobject thread)
#define LLNI_classinfo_unwrap(clazz)
Definition: llni.hpp:113
JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_getLoadAverage(JNIEnv *env, jobject _this, jdoubleArray loadavg, jint nelem)
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putBooleanVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jboolean x)
GNU Classpath java/lang/Class.
JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_getInt__J(JNIEnv *env, jobject _this, jlong address)
JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_arrayIndexScale(JNIEnv *env, jobject _this, jclass arrayClass)
JNIEXPORT jobject JNICALL Java_sun_misc_Unsafe_getObjectVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
void instruction_barrier(void)
Definition: atomic.hpp:98
static int getloadavg(double loadavg[], int nelem)
Definition: os.hpp:424
const char const void jint length
Definition: jvmti.h:352
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putByteVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jbyte x)
classinfo * class_define(Utf8String name, classloader_t *cl, int32_t length, uint8_t *data, java_handle_t *pd)
Definition: class.cpp:243
JNIEXPORT jbyte JNICALL Java_sun_misc_Unsafe_getByte__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
GNU Classpath java/lang/reflect/VMField.
static VM * get_current()
Definition: vm.hpp:99
JNIEXPORT jfloat JNICALL Java_sun_misc_Unsafe_getFloatVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_objectFieldOffset(JNIEnv *env, jobject _this, jobject field)
static JNINativeMethod methods[]
JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putChar__JC(JNIEnv *env, jobject _this, jlong address, jchar value)
Utf8String to_utf8_dot_to_slash() const
Definition: string.cpp:450