From 33db60082554c323f66369e02808d3df5970a36d Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Tue, 20 Jun 2006 15:17:58 +0000 Subject: [PATCH] fix sloppy conditionals --- rts/Exception.cmm | 4 ++-- rts/PrimOps.cmm | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rts/Exception.cmm b/rts/Exception.cmm index 5c2ee95..6e656e0 100644 --- a/rts/Exception.cmm +++ b/rts/Exception.cmm @@ -329,7 +329,7 @@ raisezh_fast /* ToDo: currently this is a hack. Would be much better if * the info was only displayed for an *uncaught* exception. */ - if (RtsFlags_ProfFlags_showCCSOnException(RtsFlags)) { + if (RtsFlags_ProfFlags_showCCSOnException(RtsFlags) != 0) { foreign "C" fprintCCS_stderr(W_[CCCS] "ptr"); } #endif @@ -348,7 +348,7 @@ retry_pop_stack: r = foreign "C" stmValidateNestOfTransactions(trec "ptr"); foreign "C" stmAbortTransaction(MyCapability() "ptr", trec "ptr"); StgTSO_trec(CurrentTSO) = NO_TREC; - if (r) { + if (r != 0) { // Transaction was valid: continue searching for a catch frame Sp = Sp + SIZEOF_StgAtomicallyFrame; goto retry_pop_stack; diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index f1c214e..5246f56 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -1005,7 +1005,7 @@ INFO_TABLE_RET(stg_catch_retry_frame, trec = StgTSO_trec(CurrentTSO); "ptr" outer = foreign "C" stmGetEnclosingTRec(trec "ptr") []; r = foreign "C" stmCommitNestedTransaction(MyCapability() "ptr", trec "ptr") []; - if (r) { + if (r != 0) { /* Succeeded (either first branch or second branch) */ StgTSO_trec(CurrentTSO) = outer; Sp = Sp + SIZEOF_StgCatchRetryFrame; @@ -1016,7 +1016,7 @@ INFO_TABLE_RET(stg_catch_retry_frame, W_ new_trec; "ptr" new_trec = foreign "C" stmStartTransaction(MyCapability() "ptr", outer "ptr") []; StgTSO_trec(CurrentTSO) = new_trec; - if (StgCatchRetryFrame_running_alt_code(frame)) { + if (StgCatchRetryFrame_running_alt_code(frame) != 0::I32) { R1 = StgCatchRetryFrame_alt_code(frame); } else { R1 = StgCatchRetryFrame_first_code(frame); @@ -1075,7 +1075,7 @@ INFO_TABLE_RET(stg_atomically_frame, /* The TSO is not currently waiting: try to commit the transaction */ valid = foreign "C" stmCommitTransaction(MyCapability() "ptr", trec "ptr") []; - if (valid) { + if (valid != 0) { /* Transaction was valid: commit succeeded */ StgTSO_trec(CurrentTSO) = NO_TREC; Sp = Sp + SIZEOF_StgAtomicallyFrame; @@ -1109,7 +1109,7 @@ INFO_TABLE_RET(stg_atomically_waiting_frame, /* The TSO is currently waiting: should we stop waiting? */ valid = foreign "C" stmReWait(MyCapability() "ptr", CurrentTSO "ptr") []; - if (valid) { + if (valid != 0) { /* Previous attempt is still valid: no point trying again yet */ IF_NOT_REG_R1(Sp_adj(-2); Sp(1) = stg_NO_FINALIZER_closure; @@ -1295,7 +1295,7 @@ retry_pop_stack: if (frame_type == CATCH_RETRY_FRAME) { // The retry reaches a CATCH_RETRY_FRAME before the atomic frame ASSERT(outer != NO_TREC); - if (!StgCatchRetryFrame_running_alt_code(frame)) { + if (!StgCatchRetryFrame_running_alt_code(frame) != 0::I32) { // Retry in the first code: try the alternative "ptr" trec = foreign "C" stmStartTransaction(MyCapability() "ptr", outer "ptr") []; StgTSO_trec(CurrentTSO) = trec; @@ -1307,12 +1307,12 @@ retry_pop_stack: W_ other_trec; other_trec = StgCatchRetryFrame_first_code_trec(frame); r = foreign "C" stmCommitNestedTransaction(MyCapability() "ptr", other_trec "ptr") []; - if (r) { + if (r != 0) { r = foreign "C" stmCommitNestedTransaction(MyCapability() "ptr", trec "ptr") []; } else { foreign "C" stmAbortTransaction(MyCapability() "ptr", trec "ptr") []; } - if (r) { + if (r != 0) { // Merge between siblings succeeded: commit it back to enclosing transaction // and then propagate the retry StgTSO_trec(CurrentTSO) = outer; @@ -1334,7 +1334,7 @@ retry_pop_stack: ASSERT(frame_type == ATOMICALLY_FRAME); ASSERT(outer == NO_TREC); r = foreign "C" stmWait(MyCapability() "ptr", CurrentTSO "ptr", trec "ptr") []; - if (r) { + if (r != 0) { // Transaction was valid: stmWait put us on the TVars' queues, we now block StgHeader_info(frame) = stg_atomically_waiting_frame_info; Sp = frame; -- 1.7.10.4