symbols.set(i, curMethod.loadAddress(Offset.fromInt(BYTES_IN_ADDRESS * 2)));
symbols.set(i, curMethod.loadAddress(Offset.fromIntSignExtend(BYTES_IN_ADDRESS * 2)));
  private static int RegisterNatives(VM_JNIEnvironment env, int classJREF, Address methodsAddress, int nmethods) {    if (traceJNI) VM.sysWrite("JNI called: RegisterNatives  \n");    try {      // get the target class       Class jcls = (Class) env.getJNIRef(classJREF);      VM_Type type = java.lang.JikesRVMSupport.getTypeForClass(jcls);      if (!type.isClassType()) {        env.recordException(new NoSuchMethodError());        return 0;      }       VM_Class klass = type.asClass();      if (!klass.isInitialized()) {        VM_Runtime.initializeClassForDynamicLink(klass);      }      // Create list of methods and verify them to avoid partial success      VM_NativeMethod[] methods = new VM_NativeMethod[nmethods];      AddressArray symbols = AddressArray.create(nmethods);      Address curMethod = methodsAddress;      for (int i = 0; i < nmethods; i++) {        String methodString = VM_JNIHelpers.createStringFromC(curMethod.loadAddress());        VM_Atom methodName = VM_Atom.findOrCreateAsciiAtom(methodString);        String sigString = VM_JNIHelpers.createStringFromC(curMethod.loadAddress(Offset.fromInt(BYTES_IN_ADDRESS)));        VM_Atom sigName  = VM_Atom.findOrCreateAsciiAtom(sigString);                // Find the target method        VM_Method meth = klass.findDeclaredMethod(methodName, sigName);        if (meth == null || !meth.isNative()) {          env.recordException(new NoSuchMethodError(klass + ": " + methodName + " " + sigName));          return -1;        }         methods[i] = (VM_NativeMethod)meth;        symbols.set(i, curMethod.loadAddress(Offset.fromInt(BYTES_IN_ADDRESS * 2)));        curMethod = curMethod.add(3 * BYTES_IN_ADDRESS);      }      // Register methods      for (int i = 0; i < nmethods; i++) {        methods[i].registerNativeSymbol(symbols.get(i));      }      return 0;    } catch (Throwable unexpected) {      if (traceJNI) unexpected.printStackTrace(System.err);      env.recordException(unexpected);      return -1;     }  }