Skip to content

Commit

Permalink
Merge pull request #2486 from DanHeidinga/djh/formatting
Browse files Browse the repository at this point in the history
Ensure JNI_ERR returned for all failure cases
  • Loading branch information
pshipton authored Jul 26, 2018
2 parents 7ce9449 + 7c4a0ab commit 6787865
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions runtime/vm/J9OMRHelpers.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2014 IBM Corp. and others
* Copyright (c) 1991, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -57,16 +57,15 @@ destroyOMRVMThread(J9JavaVM *vm, J9VMThread *vmThread)
jint
attachVMThreadToOMR(J9JavaVM *vm, J9VMThread *vmThread, omrthread_t osThread)
{
jint rc = JNI_OK;
jint rc = JNI_ERR;
OMR_VM *omrVM = vm->omrVM;
OMR_VMThread *omrVMThread = (OMR_VMThread*)(((UDATA)vmThread) + J9_VMTHREAD_SEGREGATED_ALLOCATION_CACHE_OFFSET + vm->segregatedAllocationCacheSize);
omrVMThread->_vm = omrVM;
omrVMThread->_language_vmthread = vmThread;
omrVMThread->_os_thread = osThread;
if (OMR_ERROR_NONE == omr_attach_vmthread_to_vm(omrVMThread)) {
vmThread->omrVMThread = omrVMThread;
} else {
rc = JNI_ERR;
rc = JNI_OK;
}
return rc;
}
Expand Down Expand Up @@ -94,15 +93,15 @@ allocateJavaVMWithOMR(J9PortLibrary *portLibrary)
UDATA vmAllocationSize = omrVMOffset + sizeof(OMR_VM);
J9JavaVM *vm = (J9JavaVM *)j9mem_allocate_memory(vmAllocationSize, OMRMEM_CATEGORY_VM);
if (vm != NULL) {
memset(vm, 0, vmAllocationSize);
memset(vm, 0, vmAllocationSize);
}
return vm;
}

jint
attachVMToOMR(J9JavaVM *vm)
{
jint rc = JNI_OK;
jint rc = JNI_ERR;
UDATA omrRuntimeOffset = ROUND_TO(8, sizeof(J9JavaVM));
UDATA omrVMOffset = ROUND_TO(8, omrRuntimeOffset + sizeof(OMR_Runtime));
OMR_Runtime *omrRuntime = (OMR_Runtime*)(((UDATA)vm) + omrRuntimeOffset);
Expand Down

0 comments on commit 6787865

Please sign in to comment.