#include "native/llni.h"
#include "native/native.h"
-#include "native/include/java_lang_Object.h" /* before c.l.C */
-#include "native/include/java_lang_String.h" /* required by j.l.CL */
-
-#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
-# include "native/include/java_nio_ByteBuffer.h" /* required by j.l.CL */
-#endif
-
-#include "native/include/java_lang_ClassLoader.h" /* required by j.l.C */
-#include "native/include/java_lang_Class.h"
-#include "native/include/java_lang_reflect_Field.h"
-#include "native/include/java_lang_Thread.h" /* required by s.m.U */
-#include "native/include/java_lang_Throwable.h"
-
-#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
-# include "native/include/java_lang_reflect_VMField.h"
+#if defined(ENABLE_JNI_HEADERS)
+# include "native/include/sun_misc_Unsafe.h"
#endif
-#include "native/include/java_security_ProtectionDomain.h" /* required by smU */
-
-// FIXME
-extern "C" {
-#include "native/include/sun_misc_Unsafe.h"
-}
-
#include "vm/builtin.h"
#include "vm/exceptions.hpp"
#include "vm/initialize.h"
#include "vm/string.hpp"
+#include "vmcore/javaobjects.hpp"
#include "vmcore/os.hpp"
#include "vmcore/utf8.h"
* Method: getInt
* Signature: (Ljava/lang/Object;J)I
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getInt__Ljava_lang_Object_2J(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset)
+JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_getInt__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
{
int32_t *p;
int32_t value;
* Method: putInt
* Signature: (Ljava/lang/Object;JI)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putInt__Ljava_lang_Object_2JI(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, int32_t x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putInt__Ljava_lang_Object_2JI(JNIEnv *env, jobject _this, jobject o, jlong offset, jint x)
{
int32_t *p;
* Method: getObject
* Signature: (Ljava/lang/Object;J)Ljava/lang/Object;
*/
-JNIEXPORT java_lang_Object* JNICALL Java_sun_misc_Unsafe_getObject(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset)
+JNIEXPORT jobject JNICALL Java_sun_misc_Unsafe_getObject(JNIEnv *env, jobject _this, jobject o, jlong offset)
{
void **p;
void *value;
value = *p;
- return (java_lang_Object*) value;
+ return (jobject) value;
}
* Method: putObject
* Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObject(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, java_lang_Object *x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObject(JNIEnv *env, jobject _this, jobject o, jlong offset, jobject x)
{
void **p;
* Method: getBoolean
* Signature: (Ljava/lang/Object;J)Z
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getBoolean(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset)
+JNIEXPORT jboolean JNICALL Java_sun_misc_Unsafe_getBoolean(JNIEnv *env, jobject _this, jobject o, jlong offset)
{
int32_t *p;
int32_t value;
* Method: putBoolean
* Signature: (Ljava/lang/Object;JZ)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putBoolean(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, int32_t x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putBoolean(JNIEnv *env, jobject _this, jobject o, jlong offset, jboolean x)
{
int32_t *p;
* Method: getByte
* Signature: (Ljava/lang/Object;J)B
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getByte__Ljava_lang_Object_2J(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset)
+JNIEXPORT jbyte JNICALL Java_sun_misc_Unsafe_getByte__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
{
int32_t *p;
int32_t value;
* Method: putByte
* Signature: (Ljava/lang/Object;JB)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putByte__Ljava_lang_Object_2JB(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, int32_t x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putByte__Ljava_lang_Object_2JB(JNIEnv *env, jobject _this, jobject o, jlong offset, jbyte x)
{
int32_t *p;
* Method: getShort
* Signature: (Ljava/lang/Object;J)S
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getShort__Ljava_lang_Object_2J(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset)
+JNIEXPORT jshort JNICALL Java_sun_misc_Unsafe_getShort__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
{
int32_t *p;
int32_t value;
* Method: putShort
* Signature: (Ljava/lang/Object;JS)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putShort__Ljava_lang_Object_2JS(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, int32_t x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putShort__Ljava_lang_Object_2JS(JNIEnv *env, jobject _this, jobject o, jlong offset, jshort x)
{
int32_t *p;
* Method: getChar
* Signature: (Ljava/lang/Object;J)C
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getChar__Ljava_lang_Object_2J(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset)
+JNIEXPORT jchar JNICALL Java_sun_misc_Unsafe_getChar__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
{
int32_t *p;
int32_t value;
* Method: putChar
* Signature: (Ljava/lang/Object;JC)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putChar__Ljava_lang_Object_2JC(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, int32_t x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putChar__Ljava_lang_Object_2JC(JNIEnv *env, jobject _this, jobject o, jlong offset, jchar x)
{
int32_t *p;
* Method: getLong
* Signature: (Ljava/lang/Object;J)J
*/
-JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_getLong__Ljava_lang_Object_2J(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset)
+JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_getLong__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
{
int64_t *p;
int64_t value;
* Method: putLong
* Signature: (Ljava/lang/Object;JJ)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong__Ljava_lang_Object_2JJ(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, int64_t x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong__Ljava_lang_Object_2JJ(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong x)
{
int64_t *p;
* Method: getFloat
* Signature: (Ljava/lang/Object;J)F
*/
-JNIEXPORT float JNICALL Java_sun_misc_Unsafe_getFloat__Ljava_lang_Object_2J(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset)
+JNIEXPORT jfloat JNICALL Java_sun_misc_Unsafe_getFloat__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
{
float *p;
float value;
* Method: putFloat
* Signature: (Ljava/lang/Object;JF)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putFloat__Ljava_lang_Object_2JF(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, float x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putFloat__Ljava_lang_Object_2JF(JNIEnv *env, jobject _this, jobject o, jlong offset, jfloat x)
{
float *p;
* Method: getDouble
* Signature: (Ljava/lang/Object;J)D
*/
-JNIEXPORT double JNICALL Java_sun_misc_Unsafe_getDouble__Ljava_lang_Object_2J(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset)
+JNIEXPORT jdouble JNICALL Java_sun_misc_Unsafe_getDouble__Ljava_lang_Object_2J(JNIEnv *env, jobject _this, jobject o, jlong offset)
{
double *p;
double value;
* Method: putDouble
* Signature: (Ljava/lang/Object;JD)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putDouble__Ljava_lang_Object_2JD(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, double x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putDouble__Ljava_lang_Object_2JD(JNIEnv *env, jobject _this, jobject o, jlong offset, jdouble x)
{
double *p;
* Method: getByte
* Signature: (J)B
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getByte__J(JNIEnv *env, sun_misc_Unsafe *_this, int64_t address)
+JNIEXPORT jbyte JNICALL Java_sun_misc_Unsafe_getByte__J(JNIEnv *env, jobject _this, jlong address)
{
int8_t *p;
int8_t value;
* Method: putByte
* Signature: (JB)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putByte__JB(JNIEnv *env, sun_misc_Unsafe *_this, int64_t address, int32_t value)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putByte__JB(JNIEnv *env, jobject _this, jlong address, jbyte value)
{
int8_t *p;
* Method: getShort
* Signature: (J)S
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getShort__J(JNIEnv *env, sun_misc_Unsafe *_this, int64_t address)
+JNIEXPORT jshort JNICALL Java_sun_misc_Unsafe_getShort__J(JNIEnv *env, jobject _this, jlong address)
{
int16_t *p;
int16_t value;
* Method: putShort
* Signature: (JS)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putShort__JS(JNIEnv *env, sun_misc_Unsafe *_this, int64_t address, int32_t value)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putShort__JS(JNIEnv *env, jobject _this, jlong address, jshort value)
{
int16_t *p;
* Method: getChar
* Signature: (J)C
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getChar__J(JNIEnv *env, sun_misc_Unsafe *_this, int64_t address)
+JNIEXPORT jchar JNICALL Java_sun_misc_Unsafe_getChar__J(JNIEnv *env, jobject _this, jlong address)
{
uint16_t *p;
uint16_t value;
* Method: putChar
* Signature: (JC)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putChar__JC(JNIEnv *env, sun_misc_Unsafe *_this, int64_t address, int32_t value)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putChar__JC(JNIEnv *env, jobject _this, jlong address, jchar value)
{
uint16_t *p;
* Method: getInt
* Signature: (J)I
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getInt__J(JNIEnv *env, sun_misc_Unsafe *_this, int64_t address)
+JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_getInt__J(JNIEnv *env, jobject _this, jlong address)
{
int32_t *p;
int32_t value;
* Method: putInt
* Signature: (JI)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putInt__JI(JNIEnv *env, struct sun_misc_Unsafe* _this, int64_t address, int32_t value)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putInt__JI(JNIEnv *env, jobject _this, jlong address, jint value)
{
int32_t *p;
* Method: getLong
* Signature: (J)J
*/
-JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_getLong__J(JNIEnv *env, sun_misc_Unsafe *_this, int64_t address)
+JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_getLong__J(JNIEnv *env, jobject _this, jlong address)
{
int64_t *p;
int64_t value;
* Method: putLong
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong__JJ(JNIEnv *env, sun_misc_Unsafe *_this, int64_t address, int64_t value)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong__JJ(JNIEnv *env, jobject _this, jlong address, jlong value)
{
int64_t *p;
* Method: getFloat
* Signature: (J)F
*/
-JNIEXPORT float JNICALL Java_sun_misc_Unsafe_getFloat__J(JNIEnv *env, sun_misc_Unsafe *_this, int64_t address)
+JNIEXPORT jfloat JNICALL Java_sun_misc_Unsafe_getFloat__J(JNIEnv *env, jobject _this, jlong address)
{
float *p;
float value;
* Method: putFloat
* Signature: (JF)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putFloat__JF(JNIEnv *env, struct sun_misc_Unsafe* __this, int64_t address, float value)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putFloat__JF(JNIEnv *env, jobject _this, jlong address, jfloat value)
{
float* p;
* Method: objectFieldOffset
* Signature: (Ljava/lang/reflect/Field;)J
*/
-JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_objectFieldOffset(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_reflect_Field *field)
+JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_objectFieldOffset(JNIEnv *env, jobject _this, jobject field)
{
- classinfo *c;
- fieldinfo *f;
- int32_t slot;
-
-#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
- java_lang_reflect_VMField *rvmf;
-#endif
-
#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
- LLNI_field_get_ref(field, f, rvmf);
- LLNI_field_get_cls(rvmf, clazz, c);
- LLNI_field_get_val(rvmf, slot , slot);
+ java_lang_reflect_Field rf(field);
+ java_lang_reflect_VMField rvmf(rf.get_f());
+ fieldinfo* f = rvmf.get_field();
#elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
- LLNI_field_get_cls(field, clazz, c);
- LLNI_field_get_val(field, slot , slot);
+ LLNI_field_get_cls((java_lang_reflect_Field *) field, clazz, c);
+ LLNI_field_get_val((java_lang_reflect_Field *) field, slot , slot);
#else
# error unknown configuration
#endif
- f = &(c->fields[slot]);
-
- return (int64_t) f->offset;
+ return (jlong) f->offset;
}
* Method: allocateMemory
* Signature: (J)J
*/
-JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_allocateMemory(JNIEnv *env, sun_misc_Unsafe *_this, int64_t bytes)
+JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_allocateMemory(JNIEnv *env, jobject _this, jlong bytes)
{
size_t length;
void *p;
* Method: setMemory
* Signature: (Ljava/lang/Object;JJB)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_setMemory(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, int64_t bytes, int32_t value)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_setMemory(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong bytes, jbyte value)
{
size_t length;
void *p;
* Method: copyMemory
* Signature: (Ljava/lang/Object;JLjava/lang/Object;JJ)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_copyMemory(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *srcBase, int64_t srcOffset, java_lang_Object *destBase, int64_t destOffset, int64_t bytes)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_copyMemory(JNIEnv *env, jobject _this, jobject srcBase, jlong srcOffset, jobject destBase, jlong destOffset, jlong bytes)
{
size_t length;
void *src;
* Method: setMemory
* Signature: (JJB)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_setMemory(JNIEnv *env, sun_misc_Unsafe *_this, int64_t address, int64_t bytes, int32_t value)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_setMemory(JNIEnv *env, jobject _this, jlong address, jlong bytes, jbyte value)
{
size_t length;
void *p;
* Method: copyMemory
* Signature: (JJJ)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_copyMemory(JNIEnv *env, sun_misc_Unsafe *_this, int64_t srcAddress, int64_t destAddress, int64_t bytes)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_copyMemory(JNIEnv *env, jobject _this, jlong srcAddress, jlong destAddress, jlong bytes)
{
size_t length;
void *src;
* Method: freeMemory
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_freeMemory(JNIEnv *env, sun_misc_Unsafe *_this, int64_t address)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_freeMemory(JNIEnv *env, jobject _this, jlong address)
{
void *p;
* Method: staticFieldOffset
* Signature: (Ljava/lang/reflect/Field;)J
*/
-JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_staticFieldOffset(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_reflect_Field *f)
+JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_staticFieldOffset(JNIEnv *env, jobject _this, jobject f)
{
/* The offset of static fields is 0. */
* Method: staticFieldBase
* Signature: (Ljava/lang/reflect/Field;)Ljava/lang/Object;
*/
-JNIEXPORT java_lang_Object* JNICALL Java_sun_misc_Unsafe_staticFieldBase(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_reflect_Field *rf)
+JNIEXPORT jobject JNICALL Java_sun_misc_Unsafe_staticFieldBase(JNIEnv *env, jobject _this, jobject field)
{
- classinfo *c;
- fieldinfo *f;
- int32_t slot;
-
-#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
- java_lang_reflect_VMField *rvmf;
-#endif
-
#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
- LLNI_field_get_ref(rf, f, rvmf);
- LLNI_field_get_cls(rvmf, clazz, c);
- LLNI_field_get_val(rvmf, slot , slot);
+ java_lang_reflect_Field rf(field);
+ java_lang_reflect_VMField rvmf(rf.get_f());
+ fieldinfo* f = rvmf.get_field();
#elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
- LLNI_field_get_cls(rf, clazz, c);
- LLNI_field_get_val(rf, slot , slot);
+ LLNI_field_get_cls((java_lang_reflect_Field *) rf, clazz, c);
+ LLNI_field_get_val((java_lang_reflect_Field *) rf, slot , slot);
#else
# error unknown configuration
#endif
- f = &(c->fields[slot]);
-
- return (java_lang_Object *) (f->value);
+ return (jobject) (f->value);
}
* Method: ensureClassInitialized
* Signature: (Ljava/lang/Class;)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_ensureClassInitialized(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Class *clazz)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_ensureClassInitialized(JNIEnv *env, jobject _this, jclass clazz)
{
classinfo *c;
* Method: arrayBaseOffset
* Signature: (Ljava/lang/Class;)I
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_arrayBaseOffset(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Class *arrayClass)
+JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_arrayBaseOffset(JNIEnv *env, jobject _this, jclass arrayClass)
{
classinfo *c;
arraydescriptor *ad;
* Method: arrayIndexScale
* Signature: (Ljava/lang/Class;)I
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_arrayIndexScale(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Class *arrayClass)
+JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_arrayIndexScale(JNIEnv *env, jobject _this, jclass arrayClass)
{
classinfo *c;
arraydescriptor *ad;
* Method: addressSize
* Signature: ()I
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_addressSize(JNIEnv *env, sun_misc_Unsafe *_this)
+JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_addressSize(JNIEnv *env, jobject _this)
{
return SIZEOF_VOID_P;
}
* Method: pageSize
* Signature: ()I
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_pageSize(JNIEnv *env, sun_misc_Unsafe *_this)
+JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_pageSize(JNIEnv *env, jobject _this)
{
int sz;
* Method: defineClass
* Signature: (Ljava/lang/String;[BIILjava/lang/ClassLoader;Ljava/security/ProtectionDomain;)Ljava/lang/Class;
*/
-JNIEXPORT java_lang_Class* JNICALL Java_sun_misc_Unsafe_defineClass__Ljava_lang_String_2_3BIILjava_lang_ClassLoader_2Ljava_security_ProtectionDomain_2(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_String *name, java_handle_bytearray_t *b, int32_t off, int32_t len, java_lang_ClassLoader *loader, java_security_ProtectionDomain *protectionDomain)
+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)
{
classloader_t *cl;
utf *utfname;
classinfo *c;
- java_lang_Class *o;
cl = loader_hashtable_classloader_add((java_handle_t *) loader);
/* define the class */
- c = class_define(utfname, cl, len, (uint8_t *) &(LLNI_array_direct(b, off)),
+ c = class_define(utfname, cl, len, (uint8_t *) &(LLNI_array_direct((java_handle_bytearray_t*) b, off)),
(java_handle_t *) protectionDomain);
if (c == NULL)
return NULL;
- /* for convenience */
-
- o = LLNI_classinfo_wrap(c);
+ java_handle_t* h = LLNI_classinfo_wrap(c);
+ java_lang_Class jlc(h);
#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
- /* set ProtectionDomain */
-
- LLNI_field_set_ref(o, pd, protectionDomain);
+ // Set ProtectionDomain.
+ jlc.set_pd(protectionDomain);
#endif
- return o;
+ return (jclass) jlc.get_handle();
}
* Method: allocateInstance
* Signature: (Ljava/lang/Class;)Ljava/lang/Object;
*/
-JNIEXPORT java_lang_Object* JNICALL Java_sun_misc_Unsafe_allocateInstance(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Class *cls)
+JNIEXPORT jobject JNICALL Java_sun_misc_Unsafe_allocateInstance(JNIEnv *env, jobject _this, jclass cls)
{
classinfo *c;
java_handle_t *o;
o = builtin_new(c);
- return (java_lang_Object *) o;
+ return (jobject ) o;
}
* Method: throwException
* Signature: (Ljava/lang/Throwable;)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_throwException(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Throwable *ee)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_throwException(JNIEnv *env, jobject _this, jobject ee)
{
java_handle_t *o;
* Method: compareAndSwapObject
* Signature: (Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapObject(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, java_lang_Object *expected, java_lang_Object *x)
+JNIEXPORT jboolean JNICALL Java_sun_misc_Unsafe_compareAndSwapObject(JNIEnv *env, jobject _this, jobject o, jlong offset, jobject expected, jobject x)
{
volatile void **p;
void *result;
* Method: compareAndSwapInt
* Signature: (Ljava/lang/Object;JII)Z
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapInt(JNIEnv *env, sun_misc_Unsafe* _this, java_lang_Object* o, int64_t offset, int32_t expected, int32_t x)
+JNIEXPORT jboolean JNICALL Java_sun_misc_Unsafe_compareAndSwapInt(JNIEnv *env, jobject _this, jobject o, jlong offset, jint expected, jint x)
{
uint32_t *p;
uint32_t result;
* Method: compareAndSwapLong
* Signature: (Ljava/lang/Object;JJJ)Z
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapLong(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, int64_t expected, int64_t x)
+JNIEXPORT jboolean JNICALL Java_sun_misc_Unsafe_compareAndSwapLong(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong expected, jlong x)
{
uint64_t *p;
uint64_t result;
* Method: getObjectVolatile
* Signature: (Ljava/lang/Object;J)Ljava/lang/Object;
*/
-JNIEXPORT java_lang_Object* JNICALL Java_sun_misc_Unsafe_getObjectVolatile(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset)
+JNIEXPORT jobject JNICALL Java_sun_misc_Unsafe_getObjectVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
{
volatile void **p;
volatile void *value;
value = *p;
- return (java_lang_Object *) value;
+ return (jobject ) value;
}
* Method: putObjectVolatile
* Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObjectVolatile(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, java_lang_Object *x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObjectVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jobject x)
{
volatile void **p;
* Method: getIntVolatile
* Signature: (Ljava/lang/Object;J)I
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getIntVolatile(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset)
+JNIEXPORT jint JNICALL Java_sun_misc_Unsafe_getIntVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
{
UNSAFE_GET_VOLATILE(int32_t);
}
* Method: putIntVolatile
* Signature: (Ljava/lang/Object;JI)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putIntVolatile(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, int32_t x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putIntVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jint x)
{
UNSAFE_PUT_VOLATILE(int32_t);
}
* Method: getLongVolatile
* Signature: (Ljava/lang/Object;J)J
*/
-JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_getLongVolatile(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset)
+JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_getLongVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset)
{
UNSAFE_GET_VOLATILE(int64_t);
}
* Method: putLongVolatile
* Signature: (Ljava/lang/Object;JJ)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLongVolatile(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, int64_t x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLongVolatile(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong x)
{
UNSAFE_PUT_VOLATILE(int64_t);
}
* Method: getDoubleVolatile
* Signature: (Ljava/lang/Object;J)D
*/
-JNIEXPORT double JNICALL Java_sun_misc_Unsafe_getDoubleVolatile(JNIEnv *env, sun_misc_Unsafe* __this, java_lang_Object* o, int64_t offset)
+JNIEXPORT jdouble JNICALL Java_sun_misc_Unsafe_getDoubleVolatile(JNIEnv *env, jobject __this, jobject o, jlong offset)
{
UNSAFE_GET_VOLATILE(double);
}
* Method: putOrderedObject
* Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedObject(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, java_lang_Object *x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedObject(JNIEnv *env, jobject _this, jobject o, jlong offset, jobject x)
{
java_handle_t *_h;
java_handle_t *_hx;
* Method: putOrderedInt
* Signature: (Ljava/lang/Object;JI)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedInt(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, int32_t x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedInt(JNIEnv *env, jobject _this, jobject o, jlong offset, jint x)
{
UNSAFE_PUT_VOLATILE(int32_t);
}
* Method: putOrderedLong
* Signature: (Ljava/lang/Object;JJ)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedLong(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *o, int64_t offset, int64_t x)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedLong(JNIEnv *env, jobject _this, jobject o, jlong offset, jlong x)
{
UNSAFE_PUT_VOLATILE(int64_t);
}
* Method: unpark
* Signature: (Ljava/lang/Object;)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_unpark(JNIEnv *env, sun_misc_Unsafe *_this, java_lang_Object *thread)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_unpark(JNIEnv *env, jobject _this, jobject thread)
{
/* XXX IMPLEMENT ME */
}
* Method: park
* Signature: (ZJ)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_park(JNIEnv *env, sun_misc_Unsafe *_this, int32_t isAbsolute, int64_t time)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_park(JNIEnv *env, jobject _this, jboolean isAbsolute, jlong time)
{
/* XXX IMPLEMENT ME */
}