109bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes/* 209bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes * Copyright (C) 2013 The Android Open Source Project 309bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes * 409bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes * Licensed under the Apache License, Version 2.0 (the "License"); 509bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes * you may not use this file except in compliance with the License. 609bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes * You may obtain a copy of the License at 709bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes * 809bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 909bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes * 1009bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes * Unless required by applicable law or agreed to in writing, software 1109bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 1209bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1309bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes * See the License for the specific language governing permissions and 1409bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes * limitations under the License. 1509bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes */ 1609bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes 1709bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes#define LOG_TAG "Unsafe" 1809bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes 1909bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes#include "JNIHelp.h" 2009bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes#include "JniConstants.h" 2109bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes 2209bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughesstatic jobject Unsafe_allocateInstance(JNIEnv* env, jclass, jclass c) { 2309bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes return env->AllocObject(c); 2409bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes} 2509bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes 2609bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughesstatic JNINativeMethod gMethods[] = { 2709bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes NATIVE_METHOD(Unsafe, allocateInstance, "(Ljava/lang/Class;)Ljava/lang/Object;"), 2809bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes}; 2909bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughesvoid register_sun_misc_Unsafe(JNIEnv* env) { 3009bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes jniRegisterNativeMethods(env, "sun/misc/Unsafe", gMethods, NELEM(gMethods)); 3109bcea1fd2a0bade07ab034352fde6c6ff6e01a6Elliott Hughes} 32