Skip to content

Commit

Permalink
Merge pull request eclipse-openj9#343 from DanHeidinga/osx_compile_is…
Browse files Browse the repository at this point in the history
…sues

Minor OSX compile fixes
  • Loading branch information
charliegracie authored Oct 18, 2017
2 parents cd77bb2 + 2fe2911 commit 384d4c3
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 33 deletions.
10 changes: 4 additions & 6 deletions runtime/codert_vm/jswalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1791,9 +1791,8 @@ jitGetOwnedObjectMonitors(J9StackWalkState *walkState)
) {

if (liveMonitorMap) {
U_8 *inlineMonitorMask;

if (inlineMonitorMask = getMonitorMask(gcStackAtlas, inlinedCallSite)) {
U_8 *inlineMonitorMask = getMonitorMask(gcStackAtlas, inlinedCallSite);
if (NULL != inlineMonitorMask) {
walkLiveMonitorSlots(walkState, gcStackAtlas, liveMonitorMap, inlineMonitorMask, numberOfMapBits);
}
}
Expand Down Expand Up @@ -1844,9 +1843,8 @@ countOwnedObjectMonitors(J9StackWalkState *walkState)
) {

if (liveMonitorMap) {
U_8 *inlineMonitorMask;

if (inlineMonitorMask = getMonitorMask(gcStackAtlas, inlinedCallSite)) {
U_8 *inlineMonitorMask = getMonitorMask(gcStackAtlas, inlinedCallSite);
if (NULL != inlineMonitorMask) {
countLiveMonitorSlots(walkState, gcStackAtlas, liveMonitorMap, inlineMonitorMask, numberOfMapBits);
}
}
Expand Down
4 changes: 2 additions & 2 deletions runtime/util/fltconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ helperCConvertDoubleToInteger(jdouble src)
if (src >= 2147483648.0) {
result = 0x7FFFFFFF;
} else if (src <= -2147483648.0) {
result = -1 << 31;
result = (I_32)(((U_32)-1) << 31);
} else {
result = (I_32)src;
}
Expand Down Expand Up @@ -193,7 +193,7 @@ helperCConvertFloatToInteger(jfloat src)
if (src >= 2147483648.0) {
result = 0x7FFFFFFF;
}else if (src <= -2147483648.0) {
result = -1 << 31;
result = (I_32)(((U_32)-1) << 31);
} else {
result = (I_32)src;
}
Expand Down
9 changes: 6 additions & 3 deletions runtime/util/hshelp.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,8 @@ fixSubclassHierarchy(J9VMThread * currentThread, J9HashTable * classPairs)
* was replaced itself, make sure we use the new superclass
*/
exemplar.originalRAMClass = superclass;
if (result = hashTableFind(classPairs, &exemplar)) {
result = hashTableFind(classPairs, &exemplar);
if (NULL != result) {
if (NULL != result->replacementClass.ramClass) {
/* we found the original superclass inside the old-new
* mapping table and have determined a new RAM class
Expand Down Expand Up @@ -871,7 +872,8 @@ fixITables(J9VMThread * currentThread, J9HashTable * classPairs)

while (superClass) {
exemplar.originalRAMClass = superClass;
if (result = hashTableFind(classPairs, &exemplar)) {
result = hashTableFind(classPairs, &exemplar);
if (NULL != result) {
if (result->replacementClass.ramClass) {

/* Get the iTable of the replaced superclass */
Expand Down Expand Up @@ -1684,7 +1686,8 @@ reresolveHotSwappedConstantPool(J9ConstantPool * ramConstantPool, J9VMThread * c
J9JVMTIClassPair exemplar;
J9JVMTIClassPair * result;
exemplar.originalRAMClass = ((J9RAMClassRef *) ramConstantPool)[i].value;
if (result = hashTableFind(classHashTable, &exemplar)) {
result = hashTableFind(classHashTable, &exemplar);
if (NULL != result) {
((J9RAMClassRef *) ramConstantPool)[i].value = result->replacementClass.ramClass;
((J9RAMClassRef *) ramConstantPool)[i].modifiers = result->replacementClass.romClass->modifiers;
}
Expand Down
55 changes: 37 additions & 18 deletions runtime/util/srphashtable.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010, 2015 IBM Corp. and others
* Copyright (c) 2010, 2017 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 @@ -35,11 +35,6 @@

#undef SRPHASHTABLE_DEBUG

#ifdef SRPHASHTABLE_DEBUG
#define srpHashTable_printf j9tty_printf
#else
#define srpHashTable_printf
#endif
/*This is used in debug mode. It defines info of how many nodes to be printed*/
#define NUMBEROFNODESTOPRINT 25

Expand Down Expand Up @@ -158,7 +153,9 @@ srpHashTableNew(

/*Allocate memory for struct J9SRPHashTable*/
srpHashTable = OMRPORT_FROM_J9PORT(PORTLIB)->mem_allocate_memory(OMRPORT_FROM_J9PORT(PORTLIB), sizeof(J9SRPHashTable), tableName, OMRMEM_CATEGORY_VM);
srpHashTable_printf(PORTLIB, "srpHashTableNew <%s>: tableSize=%d, srpTable=%p\n", tableName, tableSize, srpHashTable);
#ifdef SRPHASHTABLE_DEBUG
j9tty_printf(PORTLIB, "srpHashTableNew <%s>: tableSize=%d, srpTable=%p\n", tableName, tableSize, srpHashTable);
#endif
if (!srpHashTable) {
Trc_srpHashTableNew_failedToAllocMemoryForSRPHashTable(tableSize, entrySize);
Trc_srpHashTableNew_Exit(NULL);
Expand Down Expand Up @@ -268,7 +265,9 @@ srpHashTableNewInRegion(

/*Allocate memory for struct J9SRPHashTable*/
srpHashTableTemp = OMRPORT_FROM_J9PORT(PORTLIB)->mem_allocate_memory(OMRPORT_FROM_J9PORT(PORTLIB), sizeof(J9SRPHashTable), tableName, OMRMEM_CATEGORY_VM);
srpHashTable_printf(PORTLIB, "srpHashTableNewInRegion <%s>: srpTable=%p\n", tableName, srpHashTable);
#ifdef SRPHASHTABLE_DEBUG
j9tty_printf(PORTLIB, "srpHashTableNewInRegion <%s>: srpTable=%p\n", tableName, srpHashTable);
#endif
if (!srpHashTableTemp) {
return NULL;
}
Expand Down Expand Up @@ -421,7 +420,9 @@ srpHashTableRecreate(

/*Allocate memory for struct J9SRPHashTable*/
srpHashTable = OMRPORT_FROM_J9PORT(PORTLIB)->mem_allocate_memory(OMRPORT_FROM_J9PORT(PORTLIB), sizeof(J9SRPHashTable), tableName, OMRMEM_CATEGORY_VM);
srpHashTable_printf(PORTLIB, "srpHashTableNew <%s>: tableSize=%d, srpTable=%p\n", tableName, srpHashTableInternal->tableSize, srpHashTable);
#ifdef SRPHASHTABLE_DEBUG
j9tty_printf(PORTLIB, "srpHashTableNew <%s>: tableSize=%d, srpTable=%p\n", tableName, srpHashTableInternal->tableSize, srpHashTable);
#endif
if (!srpHashTable) {
return NULL;
}
Expand Down Expand Up @@ -453,7 +454,9 @@ srpHashTableFree(J9SRPHashTable *srptable)
{
PORT_ACCESS_FROM_PORT(srptable->portLibrary);

srpHashTable_printf(PORTLIB, "hashTableFree <%s>: table=%p\n", srptable->tableName, srptable);
#ifdef SRPHASHTABLE_DEBUG
j9tty_printf(PORTLIB, "hashTableFree <%s>: table=%p\n", srptable->tableName, srptable);
#endif

if (srptable) {
if ((srptable->flags & SRPHASHTABLE_CREATED_BY_SRPHASHTABLENEW) != 0) {
Expand Down Expand Up @@ -489,7 +492,9 @@ srpHashTableFind(J9SRPHashTable *srptable, void *key)
J9SRP * srpnode = 0;
PORT_ACCESS_FROM_PORT(srptable->portLibrary);

srpHashTable_printf(PORTLIB, "srpHashTableFind <%s>: srptable=%p key=%p\n", srptable->tableName, srptable, key);
#ifdef SRPHASHTABLE_DEBUG
j9tty_printf(PORTLIB, "srpHashTableFind <%s>: srptable=%p key=%p\n", srptable->tableName, srptable, key);
#endif

srpnode = srpHashTableFindNode(srptable, key);

Expand Down Expand Up @@ -526,7 +531,9 @@ srpHashTableAdd(J9SRPHashTable *srptable, void *key)

PORT_ACCESS_FROM_PORT(srptable->portLibrary);

srpHashTable_printf(PORTLIB, "srpHashTableAdd <%s>: srptable=%p key=%p\n", srptable->tableName, srptable, key);
#ifdef SRPHASHTABLE_DEBUG
j9tty_printf(PORTLIB, "srpHashTableAdd <%s>: srptable=%p key=%p\n", srptable->tableName, srptable, key);
#endif

/*
* Find the right node in the hash array to make the insertion at. Node
Expand All @@ -535,7 +542,9 @@ srpHashTableAdd(J9SRPHashTable *srptable, void *key)
srpnode = srpHashTableFindNode(srptable, key);
if (*srpnode != 0) {
/* If entry is already hashed, return it */
srpHashTable_printf(PORTLIB, "--->ENTRY IS ALREADY HASHED\n");
#ifdef SRPHASHTABLE_DEBUG
j9tty_printf(PORTLIB, "--->ENTRY IS ALREADY HASHED\n");
#endif
return SRP_GET(*srpnode, void *);
}

Expand Down Expand Up @@ -577,12 +586,16 @@ srpHashTableRemove(J9SRPHashTable *srptable, void *key)

PORT_ACCESS_FROM_PORT(srptable->portLibrary);

srpHashTable_printf(PORTLIB, "srpHashTableRemove <%s>: table=%p, key=%p\n", srptable->tableName, srptable, key);
#ifdef SRPHASHTABLE_DEBUG
j9tty_printf(PORTLIB, "srpHashTableRemove <%s>: table=%p, key=%p\n", srptable->tableName, srptable, key);
#endif

srpnode = srpHashTableFindNode(srptable, key);
removedNode = SRP_GET(*srpnode, void *);
if (removedNode == NULL) {
srpHashTable_printf(PORTLIB, "\nRESULT : \tENTRY DOES NOT EXIST\n\n");
#ifdef SRPHASHTABLE_DEBUG
j9tty_printf(PORTLIB, "\nRESULT : \tENTRY DOES NOT EXIST\n\n");
#endif
/* failed to find a node matching entry */
return 1;
}
Expand Down Expand Up @@ -621,7 +634,9 @@ srpHashTableForEachDo(J9SRPHashTable *srptable, J9SRPHashTableDoFn doFn, void *o

Assert_srphashtable_true(NULL != nodes);

srpHashTable_printf(PORTLIB, "srpHashTableForEachDo <%s>: table=%p\n", srptable->tableName, srptable);
#ifdef SRPHASHTABLE_DEBUG
j9tty_printf(PORTLIB, "srpHashTableForEachDo <%s>: table=%p\n", srptable->tableName, srptable);
#endif

/* find the first non-empty bucket */
while ((bucketIndex < srptableInternal->tableSize) && (0 == nodes[bucketIndex])) {
Expand Down Expand Up @@ -923,7 +938,9 @@ srpHashTableFindNode(J9SRPHashTable *srptable, void *key)

/* calculate the key hash */
hash = srptable->hashFn(key, srptable->functionUserData) % srptable->srpHashtableInternal->tableSize;
srpHashTable_printf(PORTLIB, "HASH = %d, ENTRY VALUE = %d\n", hash, *((UDATA *)key));
#ifdef SRPHASHTABLE_DEBUG
j9tty_printf(PORTLIB, "HASH = %d, ENTRY VALUE = %d\n", hash, *((UDATA *)key));
#endif

/* find the right node for given key hash */
srpnodes = J9SRPHASHTABLEINTERNAL_NODES(srptable->srpHashtableInternal);
Expand All @@ -935,7 +952,9 @@ srpHashTableFindNode(J9SRPHashTable *srptable, void *key)

srpnode = &(srpnodes[hash]);

srpHashTable_printf(PORTLIB, "srphashTableFindNode <%s>: key=%p hash=%x in node=%x->%x\n", srptable->tableName, key, hash, srpnode, srpnode);
#ifdef SRPHASHTABLE_DEBUG
j9tty_printf(PORTLIB, "srphashTableFindNode <%s>: key=%p hash=%x in node=%x->%x\n", srptable->tableName, key, hash, srpnode, srpnode);
#endif
/*
* Look through the node looking for the correct key, use user supplied
* key compare function if available
Expand Down
14 changes: 10 additions & 4 deletions runtime/util/vmargs.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ findArgInVMArgs(J9PortLibrary *portLibrary, J9VMInitArgs* j9vm_args, UDATA match
success = FALSE;
optionValueOperations(PORTLIB, j9vm_args, optionCntr, GET_OPTION, &valueString, 0, ':', 0, NULL); /* assumes ':' */
if (valueString) {
if (cursor = strrchr(valueString, ':')) { /* Skip past any additional sub-options eg. -Xdump:java:<value> */
cursor = strrchr(valueString, ':'); /* Skip past any additional sub-options eg. -Xdump:java:<value> */
if (NULL != cursor) {
++cursor;
} else {
cursor = valueString;
Expand All @@ -187,7 +188,10 @@ findArgInVMArgs(J9PortLibrary *portLibrary, J9VMInitArgs* j9vm_args, UDATA match
break;
}
}
if (cursor = strchr(cursor, ',')) ++cursor; /* skip to next option */
cursor = strchr(cursor, ',');
if (NULL != cursor) {
cursor += 1; /* skip to next option */
}
}
}
}
Expand Down Expand Up @@ -455,8 +459,10 @@ optionValueOperations(J9PortLibrary *portLibrary, J9VMInitArgs* j9vm_args, IDATA
break;
case MAP_TWO_COLONS_TO_ONE :
cursor = j9vm_args->actualVMArgs->options[element].optionString;
if (cursor = strchr(cursor, ':')) {
if (cursor = strchr(++cursor, ':')) {
cursor = strchr(cursor, ':');
if (NULL != cursor) {
cursor = strchr(++cursor, ':');
if (NULL != cursor) {
if (bufSize > 0) {
strncpy(*valuesBuffer, ++cursor, (bufSize-1));
if (strlen(cursor) > (bufSize-1)) {
Expand Down

0 comments on commit 384d4c3

Please sign in to comment.