comparison src/share/vm/prims/unsafe.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 4ca6dc0799b6 78bbf4d43a14
children 7848fc12602b
comparison
equal deleted inserted replaced
17606:45d7b2c7029d 18041:52b4284cb496
1 /* 1 /*
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
38 #include "services/threadService.hpp" 38 #include "services/threadService.hpp"
39 #include "trace/tracing.hpp" 39 #include "trace/tracing.hpp"
40 #include "utilities/copy.hpp" 40 #include "utilities/copy.hpp"
41 #include "utilities/dtrace.hpp" 41 #include "utilities/dtrace.hpp"
42 42
43 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
44
43 /* 45 /*
44 * Implementation of class sun.misc.Unsafe 46 * Implementation of class sun.misc.Unsafe
45 */ 47 */
46 48
47 #ifndef USDT2 49 #ifndef USDT2
160 oop p = JNIHandles::resolve(obj); \ 162 oop p = JNIHandles::resolve(obj); \
161 *(type_name*)index_oop_from_field_offset_long(p, offset) = x 163 *(type_name*)index_oop_from_field_offset_long(p, offset) = x
162 164
163 #define GET_FIELD_VOLATILE(obj, offset, type_name, v) \ 165 #define GET_FIELD_VOLATILE(obj, offset, type_name, v) \
164 oop p = JNIHandles::resolve(obj); \ 166 oop p = JNIHandles::resolve(obj); \
167 if (support_IRIW_for_not_multiple_copy_atomic_cpu) { \
168 OrderAccess::fence(); \
169 } \
165 volatile type_name v = OrderAccess::load_acquire((volatile type_name*)index_oop_from_field_offset_long(p, offset)); 170 volatile type_name v = OrderAccess::load_acquire((volatile type_name*)index_oop_from_field_offset_long(p, offset));
166 171
167 #define SET_FIELD_VOLATILE(obj, offset, type_name, x) \ 172 #define SET_FIELD_VOLATILE(obj, offset, type_name, x) \
168 oop p = JNIHandles::resolve(obj); \ 173 oop p = JNIHandles::resolve(obj); \
169 OrderAccess::release_store_fence((volatile type_name*)index_oop_from_field_offset_long(p, offset), x); 174 OrderAccess::release_store_fence((volatile type_name*)index_oop_from_field_offset_long(p, offset), x);
856 static inline void throw_new(JNIEnv *env, const char *ename) { 861 static inline void throw_new(JNIEnv *env, const char *ename) {
857 char buf[100]; 862 char buf[100];
858 strcpy(buf, "java/lang/"); 863 strcpy(buf, "java/lang/");
859 strcat(buf, ename); 864 strcat(buf, ename);
860 jclass cls = env->FindClass(buf); 865 jclass cls = env->FindClass(buf);
866 if (env->ExceptionCheck()) {
867 env->ExceptionClear();
868 tty->print_cr("Unsafe: cannot throw %s because FindClass has failed", buf);
869 return;
870 }
861 char* msg = NULL; 871 char* msg = NULL;
862 env->ThrowNew(cls, msg); 872 env->ThrowNew(cls, msg);
863 } 873 }
864 874
865 static jclass Unsafe_DefineClass_impl(JNIEnv *env, jstring name, jbyteArray data, int offset, int length, jobject loader, jobject pd) { 875 static jclass Unsafe_DefineClass_impl(JNIEnv *env, jstring name, jbyteArray data, int offset, int length, jobject loader, jobject pd) {