if (traceJNI) VM.sysWrite("JNI called: GetByteArrayElements for ");
if (traceJNI) VM.sysWrite("JNI called: GetByteArrayElements \n");
  private static VM_Address GetByteArrayElements(int envJREF, int arrayJREF, VM_Address isCopyAddress) {    if (traceJNI) VM.sysWrite("JNI called: GetByteArrayElements for ");    VM_JNIEnvironment env = VM_Thread.getCurrentThread().getJNIEnv();    try {      byte sourceArray[] = (byte []) env.getJNIRef(arrayJREF);      int size = sourceArray.length;      // alloc non moving buffer in C heap for a copy of string contents      VM_Address copyBuffer = VM_SysCall.sysMalloc(size);      if(copyBuffer.isZero()) {        env.recordException(new OutOfMemoryError());        return VM_Address.zero();      }      VM_Memory.memcopy(copyBuffer, VM_Magic.objectAsAddress(sourceArray), size);      // set callers isCopy boolean to true, if it's a valid address      if (!isCopyAddress.isZero()) {        int temp = VM_Magic.getMemoryInt(isCopyAddress);        if (VM.LittleEndian) {          VM_Magic.setMemoryInt(isCopyAddress, ((temp & 0xffffff00) | 0x00000001));        } else {          VM_Magic.setMemoryInt(isCopyAddress, ((temp & 0x00ffffff) | 0x01000000));        }      }      return copyBuffer;    } catch (Throwable unexpected) {      if (traceJNI) unexpected.printStackTrace(System.err);      env.recordException(unexpected);      return VM_Address.zero();    }  }