Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use jxbt_get_jfield instead of jxbt_get_sfield (faster)
authorSamuel Lepetit <samuel.lepetit@inria.fr>
Mon, 14 May 2012 15:16:21 +0000 (17:16 +0200)
committerSamuel Lepetit <samuel.lepetit@inria.fr>
Mon, 14 May 2012 15:16:21 +0000 (17:16 +0200)
src/jmsg_comm.c
src/jmsg_host.c
src/jmsg_task.c

index 27b57c0..4a394cd 100644 (file)
@@ -58,9 +58,9 @@ Java_org_simgrid_msg_Comm_nativeInit(JNIEnv *env, jclass cls) {
                jxbt_throw_native(env,bprintf("Can't find the org/simgrid/msg/Comm class."));
                return;
        }
-       jcomm_field_Comm_bind = jxbt_get_sfield(env, "org/simgrid/msg/Comm", "bind", "J");
-       jcomm_field_Comm_taskBind  = jxbt_get_sfield(env, "org/simgrid/msg/Comm", "taskBind", "J");
-       jcomm_field_Comm_receiving = jxbt_get_sfield(env, "org/simgrid/msg/Comm", "receiving", "Z");
+       jcomm_field_Comm_bind = jxbt_get_jfield(env, jfield_class_Comm, "bind", "J");
+       jcomm_field_Comm_taskBind  = jxbt_get_jfield(env, jfield_class_Comm, "taskBind", "J");
+       jcomm_field_Comm_receiving = jxbt_get_jfield(env, jfield_class_Comm, "receiving", "Z");
        jtask_field_Comm_task = jxbt_get_jfield(env, jfield_class_Comm, "task", "Lorg/simgrid/msg/Task;");
        if (!jcomm_field_Comm_bind || !jcomm_field_Comm_taskBind || !jcomm_field_Comm_receiving || !jtask_field_Comm_task) {
        jxbt_throw_native(env,bprintf("Can't find some fields in Java class."));
index da4426b..c01a132 100644 (file)
@@ -57,7 +57,7 @@ Java_org_simgrid_msg_Host_nativeInit(JNIEnv *env, jclass cls) {
        jclass class_Host = (*env)->FindClass(env, "org/simgrid/msg/Host");
        jhost_method_Host_constructor = (*env)->GetMethodID(env, class_Host, "<init>", "()V");
        //FIXME: Don't use jxbt_get_sfield directly, it is slower.
-       jhost_field_Host_bind = jxbt_get_sfield(env,"org/simgrid/msg/Host", "bind", "J");
+       jhost_field_Host_bind = jxbt_get_jfield(env,class_Host, "bind", "J");
        jhost_field_Host_name = jxbt_get_jfield(env, class_Host, "name", "Ljava/lang/String;");
        if (!class_Host || !jhost_field_Host_name || !jhost_method_Host_constructor || !jhost_field_Host_bind) {
        jxbt_throw_native(env,bprintf("Can't find some fields in Java class. You should report this bug."));
index 6c48518..86fe919 100644 (file)
@@ -48,12 +48,11 @@ Java_org_simgrid_msg_Task_nativeInit(JNIEnv *env, jclass cls) {
        jclass jtask_class_Task = (*env)->FindClass(env, "org/simgrid/msg/Task");
 
        jtask_method_Comm_constructor = (*env)->GetMethodID(env, jtask_class_Comm, "<init>", "()V");
-       //FIXME: Don't use jxbt_get_sfield directly, it is slower.
-       jtask_field_Task_bind = jxbt_get_sfield(env, "org/simgrid/msg/Task", "bind", "J");
+       jtask_field_Task_bind = jxbt_get_jfield(env, jtask_class_Task, "bind", "J");
        jtask_field_Task_name = jxbt_get_jfield(env, jtask_class_Task, "name", "Ljava/lang/String;");
-       jtask_field_Comm_bind = jxbt_get_sfield(env, "org/simgrid/msg/Comm", "bind", "J");
-       jtask_field_Comm_taskBind = jxbt_get_sfield(env, "org/simgrid/msg/Comm", "taskBind", "J");
-       jtask_field_Comm_receiving = jxbt_get_sfield(env, "org/simgrid/msg/Comm", "receiving", "Z");
+       jtask_field_Comm_bind = jxbt_get_jfield(env, jtask_class_Comm, "bind", "J");
+       jtask_field_Comm_taskBind = jxbt_get_jfield(env, jtask_class_Comm, "taskBind", "J");
+       jtask_field_Comm_receiving = jxbt_get_jfield(env, jtask_class_Comm, "receiving", "Z");
        if (!jtask_field_Task_bind || !jtask_class_Task || !jtask_field_Comm_bind || !jtask_field_Comm_taskBind ||
                  !jtask_field_Comm_receiving || !jtask_method_Comm_constructor) {
                        jxbt_throw_native(env,bprintf("Can't find some fields in Java class."));