#include "native/llni.h"
#include "native/native.h"
-#include "native/include/java_lang_Object.h"
-#include "native/include/java_lang_Class.h"
-
// FIXME
-extern "C" {
-#include "native/include/sun_reflect_ConstantPool.h"
-}
+//#include "native/include/sun_reflect_ConstantPool.h"
-#include "native/vm/reflect.h"
+#include "native/vm/reflection.hpp"
#include "toolbox/logging.h"
#include "vm/string.hpp"
#include "vmcore/class.h"
+#include "vmcore/javaobjects.hpp"
#include "vmcore/utf8.h"
-/* native methods implemented by this file ************************************/
-
-static JNINativeMethod methods[] = {
- { (char*) "getSize0", (char*) "(Ljava/lang/Object;I)I", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getSize0 },
- { (char*) "getClassAt0", (char*) "(Ljava/lang/Object;I)Ljava/lang/Class;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getClassAt0 },
- { (char*) "getClassAtIfLoaded0", (char*) "(Ljava/lang/Object;I)Ljava/lang/Class;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getClassAtIfLoaded0 },
- { (char*) "getMethodAt0", (char*) "(Ljava/lang/Object;I)Ljava/lang/reflect/Member;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getMethodAt0 },
- { (char*) "getMethodAtIfLoaded0", (char*) "(Ljava/lang/Object;I)Ljava/lang/reflect/Member;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getMethodAtIfLoaded0 },
- { (char*) "getFieldAt0", (char*) "(Ljava/lang/Object;I)Ljava/lang/reflect/Field;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getFieldAt0 },
- { (char*) "getFieldAtIfLoaded0", (char*) "(Ljava/lang/Object;I)Ljava/lang/reflect/Field;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getFieldAtIfLoaded0 },
- { (char*) "getMemberRefInfoAt0", (char*) "(Ljava/lang/Object;I)[Ljava/lang/String;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getMemberRefInfoAt0 },
- { (char*) "getIntAt0", (char*) "(Ljava/lang/Object;I)I", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getIntAt0 },
- { (char*) "getLongAt0", (char*) "(Ljava/lang/Object;I)J", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getLongAt0 },
- { (char*) "getFloatAt0", (char*) "(Ljava/lang/Object;I)F", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getFloatAt0 },
- { (char*) "getDoubleAt0", (char*) "(Ljava/lang/Object;I)D", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getDoubleAt0 },
- { (char*) "getStringAt0", (char*) "(Ljava/lang/Object;I)Ljava/lang/String;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getStringAt0 },
- { (char*) "getUTF8At0", (char*) "(Ljava/lang/Object;I)Ljava/lang/String;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getUTF8At0 },
-};
-
-
-/* _Jv_sun_reflect_ConstantPool_init ******************************************
-
- Register native functions.
-
-*******************************************************************************/
-
-// FIXME
-extern "C" {
-void _Jv_sun_reflect_ConstantPool_init(void)
-{
- native_method_register(utf_new_char("sun/reflect/ConstantPool"), methods, NATIVE_METHODS_COUNT);
-}
-}
-
-
extern "C" {
/*
* Method: getSize0
* Signature: (Ljava/lang/Object;)I
*/
-JNIEXPORT int32_t JNICALL Java_sun_reflect_ConstantPool_getSize0(JNIEnv *env, struct sun_reflect_ConstantPool* _this, struct java_lang_Object* jcpool)
+JNIEXPORT jint JNICALL Java_sun_reflect_ConstantPool_getSize0(JNIEnv *env, jobject _this, jobject jcpool)
{
classinfo *cls = LLNI_classinfo_unwrap(jcpool);
return cls->cpcount;
* Method: getClassAt0
* Signature: (Ljava/lang/Object;I)Ljava/lang/Class;
*/
-JNIEXPORT struct java_lang_Class* JNICALL Java_sun_reflect_ConstantPool_getClassAt0(JNIEnv *env, struct sun_reflect_ConstantPool* _this, struct java_lang_Object* jcpool, int32_t index)
+JNIEXPORT jclass JNICALL Java_sun_reflect_ConstantPool_getClassAt0(JNIEnv *env, jobject _this, jobject jcpool, jint index)
{
constant_classref *ref;
classinfo *cls = LLNI_classinfo_unwrap(jcpool);
return NULL;
}
- return LLNI_classinfo_wrap(resolve_classref_eager(ref));
+ return (jclass) LLNI_classinfo_wrap(resolve_classref_eager(ref));
}
* Method: getClassAtIfLoaded0
* Signature: (Ljava/lang/Object;I)Ljava/lang/Class;
*/
-JNIEXPORT struct java_lang_Class* JNICALL Java_sun_reflect_ConstantPool_getClassAtIfLoaded0(JNIEnv *env, struct sun_reflect_ConstantPool* _this, struct java_lang_Object* jcpool, int32_t index)
+JNIEXPORT jclass JNICALL Java_sun_reflect_ConstantPool_getClassAtIfLoaded0(JNIEnv *env, jobject _this, jobject jcpool, jint index)
{
constant_classref *ref;
classinfo *c = NULL;
return NULL;
}
- return LLNI_classinfo_wrap(c);
+ return (jclass) LLNI_classinfo_wrap(c);
}
* Method: getMethodAt0
* Signature: (Ljava/lang/Object;I)Ljava/lang/reflect/Member;
*/
-JNIEXPORT struct java_lang_reflect_Member* JNICALL Java_sun_reflect_ConstantPool_getMethodAt0(JNIEnv *env, struct sun_reflect_ConstantPool* _this, struct java_lang_Object* jcpool, int32_t index)
+JNIEXPORT jobject JNICALL Java_sun_reflect_ConstantPool_getMethodAt0(JNIEnv *env, jobject _this, jobject jcpool, jint index)
{
constant_FMIref *ref;
classinfo *cls = LLNI_classinfo_unwrap(jcpool);
}
/* XXX: is that right? or do I have to use resolve_method_*? */
- return (struct java_lang_reflect_Member*) reflect_method_new(ref->p.method);
+ return (jobject) java_lang_reflect_Method::create(ref->p.method);
}
* Method: getMethodAtIfLoaded0
* Signature: (Ljava/lang/Object;I)Ljava/lang/reflect/Member;
*/
-JNIEXPORT struct java_lang_reflect_Member* JNICALL Java_sun_reflect_ConstantPool_getMethodAtIfLoaded0(JNIEnv *env, struct sun_reflect_ConstantPool* _this, struct java_lang_Object* jcpool, int32_t index)
+JNIEXPORT jobject JNICALL Java_sun_reflect_ConstantPool_getMethodAtIfLoaded0(JNIEnv *env, jobject _this, jobject jcpool, jint index)
{
constant_FMIref *ref;
classinfo *c = NULL;
return NULL;
}
- return (struct java_lang_reflect_Member*) reflect_method_new(ref->p.method);
+ return (jobject) java_lang_reflect_Method::create(ref->p.method);
}
* Method: getFieldAt0
* Signature: (Ljava/lang/Object;I)Ljava/lang/reflect/Field;
*/
-JNIEXPORT struct java_lang_reflect_Field* JNICALL Java_sun_reflect_ConstantPool_getFieldAt0(JNIEnv *env, struct sun_reflect_ConstantPool* _this, struct java_lang_Object* jcpool, int32_t index)
+JNIEXPORT jobject JNICALL Java_sun_reflect_ConstantPool_getFieldAt0(JNIEnv *env, jobject _this, jobject jcpool, jint index)
{
constant_FMIref *ref;
classinfo *cls = LLNI_classinfo_unwrap(jcpool);
return NULL;
}
- return (struct java_lang_reflect_Field*) reflect_field_new(ref->p.field);
+ return (jobject) java_lang_reflect_Field::create(ref->p.field);
}
* Method: getFieldAtIfLoaded0
* Signature: (Ljava/lang/Object;I)Ljava/lang/reflect/Field;
*/
-JNIEXPORT struct java_lang_reflect_Field* JNICALL Java_sun_reflect_ConstantPool_getFieldAtIfLoaded0(JNIEnv *env, struct sun_reflect_ConstantPool* _this, struct java_lang_Object* jcpool, int32_t index)
+JNIEXPORT jobject JNICALL Java_sun_reflect_ConstantPool_getFieldAtIfLoaded0(JNIEnv *env, jobject _this, jobject jcpool, jint index)
{
constant_FMIref *ref;
classinfo *c;
return NULL;
}
- return (struct java_lang_reflect_Field*) reflect_field_new(ref->p.field);
+ return (jobject) java_lang_reflect_Field::create(ref->p.field);
}
* Method: getMemberRefInfoAt0
* Signature: (Ljava/lang/Object;I)[Ljava/lang/String;
*/
-JNIEXPORT java_handle_objectarray_t* JNICALL Java_sun_reflect_ConstantPool_getMemberRefInfoAt0(JNIEnv *env, struct sun_reflect_ConstantPool* _this, struct java_lang_Object* jcpool, int32_t index)
+JNIEXPORT jobjectArray JNICALL Java_sun_reflect_ConstantPool_getMemberRefInfoAt0(JNIEnv *env, jobject _this, jobject jcpool, jint index)
{
log_println("Java_sun_reflect_ConstantPool_getMemberRefInfoAt0(env=%p, jcpool=%p, index=%d): IMPLEMENT ME!", env, jcpool, index);
return NULL;
* Method: getIntAt0
* Signature: (Ljava/lang/Object;I)I
*/
-JNIEXPORT int32_t JNICALL Java_sun_reflect_ConstantPool_getIntAt0(JNIEnv *env, struct sun_reflect_ConstantPool* _this, struct java_lang_Object* jcpool, int32_t index)
+JNIEXPORT jint JNICALL Java_sun_reflect_ConstantPool_getIntAt0(JNIEnv *env, jobject _this, jobject jcpool, jint index)
{
constant_integer *ref;
classinfo *cls = LLNI_classinfo_unwrap(jcpool);
* Method: getLongAt0
* Signature: (Ljava/lang/Object;I)J
*/
-JNIEXPORT int64_t JNICALL Java_sun_reflect_ConstantPool_getLongAt0(JNIEnv *env, struct sun_reflect_ConstantPool* _this, struct java_lang_Object* jcpool, int32_t index)
+JNIEXPORT jlong JNICALL Java_sun_reflect_ConstantPool_getLongAt0(JNIEnv *env, jobject _this, jobject jcpool, jint index)
{
constant_long *ref;
classinfo *cls = LLNI_classinfo_unwrap(jcpool);
* Method: getFloatAt0
* Signature: (Ljava/lang/Object;I)F
*/
-JNIEXPORT float JNICALL Java_sun_reflect_ConstantPool_getFloatAt0(JNIEnv *env, struct sun_reflect_ConstantPool* _this, struct java_lang_Object* jcpool, int32_t index)
+JNIEXPORT float JNICALL Java_sun_reflect_ConstantPool_getFloatAt0(JNIEnv *env, jobject _this, jobject jcpool, jint index)
{
constant_float *ref;
classinfo *cls = LLNI_classinfo_unwrap(jcpool);
* Method: getDoubleAt0
* Signature: (Ljava/lang/Object;I)D
*/
-JNIEXPORT double JNICALL Java_sun_reflect_ConstantPool_getDoubleAt0(JNIEnv *env, struct sun_reflect_ConstantPool* _this, struct java_lang_Object* jcpool, int32_t index)
+JNIEXPORT double JNICALL Java_sun_reflect_ConstantPool_getDoubleAt0(JNIEnv *env, jobject _this, jobject jcpool, jint index)
{
constant_double *ref;
classinfo *cls = LLNI_classinfo_unwrap(jcpool);
* Method: getStringAt0
* Signature: (Ljava/lang/Object;I)Ljava/lang/String;
*/
-JNIEXPORT struct java_lang_String* JNICALL Java_sun_reflect_ConstantPool_getStringAt0(JNIEnv *env, struct sun_reflect_ConstantPool* _this, struct java_lang_Object* jcpool, int32_t index)
+JNIEXPORT jstring JNICALL Java_sun_reflect_ConstantPool_getStringAt0(JNIEnv *env, jobject _this, jobject jcpool, jint index)
{
utf *ref;
classinfo *cls = LLNI_classinfo_unwrap(jcpool);
}
/* XXX: I hope literalstring_new is the right Function. */
- return (java_lang_String*)literalstring_new(ref);
+ return (jstring) literalstring_new(ref);
}
* Method: getUTF8At0
* Signature: (Ljava/lang/Object;I)Ljava/lang/String;
*/
-JNIEXPORT struct java_lang_String* JNICALL Java_sun_reflect_ConstantPool_getUTF8At0(JNIEnv *env, struct sun_reflect_ConstantPool* _this, struct java_lang_Object* jcpool, int32_t index)
+JNIEXPORT jstring JNICALL Java_sun_reflect_ConstantPool_getUTF8At0(JNIEnv *env, jobject _this, jobject jcpool, jint index)
{
utf *ref;
classinfo *cls = LLNI_classinfo_unwrap(jcpool);
}
/* XXX: I hope literalstring_new is the right Function. */
- return (java_lang_String*)literalstring_new(ref);
+ return (jstring) literalstring_new(ref);
}
} // extern "C"
+/* native methods implemented by this file ************************************/
+
+static JNINativeMethod methods[] = {
+ { (char*) "getSize0", (char*) "(Ljava/lang/Object;I)I", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getSize0 },
+ { (char*) "getClassAt0", (char*) "(Ljava/lang/Object;I)Ljava/lang/Class;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getClassAt0 },
+ { (char*) "getClassAtIfLoaded0", (char*) "(Ljava/lang/Object;I)Ljava/lang/Class;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getClassAtIfLoaded0 },
+ { (char*) "getMethodAt0", (char*) "(Ljava/lang/Object;I)Ljava/lang/reflect/Member;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getMethodAt0 },
+ { (char*) "getMethodAtIfLoaded0", (char*) "(Ljava/lang/Object;I)Ljava/lang/reflect/Member;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getMethodAtIfLoaded0 },
+ { (char*) "getFieldAt0", (char*) "(Ljava/lang/Object;I)Ljava/lang/reflect/Field;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getFieldAt0 },
+ { (char*) "getFieldAtIfLoaded0", (char*) "(Ljava/lang/Object;I)Ljava/lang/reflect/Field;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getFieldAtIfLoaded0 },
+ { (char*) "getMemberRefInfoAt0", (char*) "(Ljava/lang/Object;I)[Ljava/lang/String;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getMemberRefInfoAt0 },
+ { (char*) "getIntAt0", (char*) "(Ljava/lang/Object;I)I", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getIntAt0 },
+ { (char*) "getLongAt0", (char*) "(Ljava/lang/Object;I)J", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getLongAt0 },
+ { (char*) "getFloatAt0", (char*) "(Ljava/lang/Object;I)F", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getFloatAt0 },
+ { (char*) "getDoubleAt0", (char*) "(Ljava/lang/Object;I)D", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getDoubleAt0 },
+ { (char*) "getStringAt0", (char*) "(Ljava/lang/Object;I)Ljava/lang/String;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getStringAt0 },
+ { (char*) "getUTF8At0", (char*) "(Ljava/lang/Object;I)Ljava/lang/String;", (void*) (uintptr_t) &Java_sun_reflect_ConstantPool_getUTF8At0 },
+};
+
+
+/* _Jv_sun_reflect_ConstantPool_init ******************************************
+
+ Register native functions.
+
+*******************************************************************************/
+
+// FIXME
+extern "C" {
+void _Jv_sun_reflect_ConstantPool_init(void)
+{
+ native_method_register(utf_new_char("sun/reflect/ConstantPool"), methods, NATIVE_METHODS_COUNT);
+}
+}
+
+
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where