337
338 DEFINE_GETSETOOP_VOLATILE(jboolean, Boolean)
339 DEFINE_GETSETOOP_VOLATILE(jbyte, Byte)
340 DEFINE_GETSETOOP_VOLATILE(jshort, Short);
341 DEFINE_GETSETOOP_VOLATILE(jchar, Char);
342 DEFINE_GETSETOOP_VOLATILE(jint, Int);
343 DEFINE_GETSETOOP_VOLATILE(jlong, Long);
344 DEFINE_GETSETOOP_VOLATILE(jfloat, Float);
345 DEFINE_GETSETOOP_VOLATILE(jdouble, Double);
346
347 #undef DEFINE_GETSETOOP_VOLATILE
348
349 UNSAFE_LEAF(void, Unsafe_FullFence(JNIEnv *env, jobject unsafe)) {
350 OrderAccess::fence();
351 } UNSAFE_END
352
353 ////// Allocation requests
354
355 UNSAFE_ENTRY(jobject, Unsafe_AllocateInstance(JNIEnv *env, jobject unsafe, jclass cls)) {
356 JvmtiVMObjectAllocEventCollector oam;
357 instanceOop i = InstanceKlass::allocate_instance(JNIHandles::resolve_non_null(cls), CHECK_NULL);
358 return JNIHandles::make_local(THREAD, i);
359 } UNSAFE_END
360
361 UNSAFE_LEAF(jlong, Unsafe_AllocateMemory0(JNIEnv *env, jobject unsafe, jlong size)) {
362 size_t sz = (size_t)size;
363
364 assert(is_aligned(sz, HeapWordSize), "sz not aligned");
365
366 void* x = os::malloc(sz, mtOther);
367
368 return addr_to_java(x);
369 } UNSAFE_END
370
371 UNSAFE_LEAF(jlong, Unsafe_ReallocateMemory0(JNIEnv *env, jobject unsafe, jlong addr, jlong size)) {
372 void* p = addr_from_java(addr);
373 size_t sz = (size_t)size;
374
375 assert(is_aligned(sz, HeapWordSize), "sz not aligned");
376
377 void* x = os::realloc(p, sz, mtOther);
|
337
338 DEFINE_GETSETOOP_VOLATILE(jboolean, Boolean)
339 DEFINE_GETSETOOP_VOLATILE(jbyte, Byte)
340 DEFINE_GETSETOOP_VOLATILE(jshort, Short);
341 DEFINE_GETSETOOP_VOLATILE(jchar, Char);
342 DEFINE_GETSETOOP_VOLATILE(jint, Int);
343 DEFINE_GETSETOOP_VOLATILE(jlong, Long);
344 DEFINE_GETSETOOP_VOLATILE(jfloat, Float);
345 DEFINE_GETSETOOP_VOLATILE(jdouble, Double);
346
347 #undef DEFINE_GETSETOOP_VOLATILE
348
349 UNSAFE_LEAF(void, Unsafe_FullFence(JNIEnv *env, jobject unsafe)) {
350 OrderAccess::fence();
351 } UNSAFE_END
352
353 ////// Allocation requests
354
355 UNSAFE_ENTRY(jobject, Unsafe_AllocateInstance(JNIEnv *env, jobject unsafe, jclass cls)) {
356 JvmtiVMObjectAllocEventCollector oam;
357 instanceOop i = InstanceKlass::allocate_instance(JNIHandles::resolve_non_null(cls), "unsafe", CHECK_NULL);
358 return JNIHandles::make_local(THREAD, i);
359 } UNSAFE_END
360
361 UNSAFE_LEAF(jlong, Unsafe_AllocateMemory0(JNIEnv *env, jobject unsafe, jlong size)) {
362 size_t sz = (size_t)size;
363
364 assert(is_aligned(sz, HeapWordSize), "sz not aligned");
365
366 void* x = os::malloc(sz, mtOther);
367
368 return addr_to_java(x);
369 } UNSAFE_END
370
371 UNSAFE_LEAF(jlong, Unsafe_ReallocateMemory0(JNIEnv *env, jobject unsafe, jlong addr, jlong size)) {
372 void* p = addr_from_java(addr);
373 size_t sz = (size_t)size;
374
375 assert(is_aligned(sz, HeapWordSize), "sz not aligned");
376
377 void* x = os::realloc(p, sz, mtOther);
|