Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
change the way computation tracing is handled in smpi
[simgrid.git] / src / bindings / java / jmsg_vm.c
index 7e98a81..5c54c1f 100644 (file)
@@ -1,9 +1,10 @@
 /* Functions related to the MSG VM API. */
 
-/* Copyright (c) 2012. The SimGrid Team. */
+/* Copyright (c) 2012-2013. The SimGrid Team.
+ * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
 * under the terms of the license (GNU LGPL) which comes with this package. */
+ * under the terms of the license (GNU LGPL) which comes with this package. */
 #include "jmsg_vm.h"
 #include "jmsg_host.h"
 #include "jmsg_process.h"
 #include "msg/msg.h"
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
+static jfieldID jvm_field_bind;
+
 void jvm_bind(JNIEnv *env, jobject jvm, msg_vm_t vm) {
-  (*env)->SetLongField(env, jvm, jvm_field_bind, (jlong) (long) (vm));
+  (*env)->SetLongField(env, jvm, jvm_field_bind, (intptr_t)vm);
 }
 msg_vm_t jvm_get_native(JNIEnv *env, jobject jvm) {
-       msg_vm_t vm = (msg_vm_t)(*env)->GetLongField(env, jvm, jvm_field_bind);
-       return vm;
+  return (msg_vm_t)(intptr_t)(*env)->GetLongField(env, jvm, jvm_field_bind);
 }
 
 JNIEXPORT void JNICALL
@@ -61,8 +63,8 @@ Java_org_simgrid_msg_VM_bind(JNIEnv *env, jobject jvm, jobject jprocess) {
   msg_vm_t vm = jvm_get_native(env,jvm);
   msg_process_t process = jprocess_to_native_process(jprocess,env);
 
-  xbt_assert((vm != NULL), "VM object is not binded");
-  xbt_assert((process != NULL), "Process object is not binded.");
+  xbt_assert((vm != NULL), "VM object is not bound");
+  xbt_assert((process != NULL), "Process object is not bound.");
 
   MSG_vm_bind(vm,process);
 }