Skip to content

Commit

Permalink
avoid phase change on error
Browse files Browse the repository at this point in the history
  • Loading branch information
heshanpadmasiri committed Dec 17, 2024
1 parent 8229d95 commit 4487308
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,12 @@ public static boolean isNever(SemType t) {
public static boolean isSubType(Context cx, SemType t1, SemType t2) {
try {
cx.enterTypeCheckingPhase(t1, t2);
return isEmpty(cx, diff(t1, t2));
boolean res = isEmpty(cx, diff(t1, t2));
cx.exitTypeCheckingPhase();
return res;
} catch (Exception e) {
cx.registerAbruptTypeCheckEnd(e);
throw e;
} finally {
cx.exitTypeCheckingPhase();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,16 @@ void enterTypeResolutionPhase(Context cx, MutableSemType t) throws InterruptedEx
}

void exitTypeResolutionPhaseAbruptly(Context cx, Exception ex) {
typeResolutionSemaphore.release();
typeResolutionPhaser.arriveAndDeregister();
releaseLock((ReentrantReadWriteLock) atomLock);
releaseLock((ReentrantReadWriteLock) recListLock);
releaseLock((ReentrantReadWriteLock) recMapLock);
releaseLock((ReentrantReadWriteLock) recFunctionLock);
try {
typeResolutionSemaphore.release();
typeResolutionPhaser.arriveAndDeregister();
releaseLock((ReentrantReadWriteLock) atomLock);
releaseLock((ReentrantReadWriteLock) recListLock);
releaseLock((ReentrantReadWriteLock) recMapLock);
releaseLock((ReentrantReadWriteLock) recFunctionLock);
} catch (Exception ignored) {

}
this.selfDiagnosticsRunner.registerAbruptTypeResolutionEnd(cx, ex);
}

Expand Down

0 comments on commit 4487308

Please sign in to comment.