diff --git a/src/dev/flang/fuir/GeneratingFUIR.java b/src/dev/flang/fuir/GeneratingFUIR.java index 6f90b2248..a358d9a4c 100644 --- a/src/dev/flang/fuir/GeneratingFUIR.java +++ b/src/dev/flang/fuir/GeneratingFUIR.java @@ -2570,9 +2570,7 @@ public byte[] constData(int s) * @return clazz id of type of the subject */ @Override - public - synchronized /* NYI: remove once it is ensured that _siteClazzCache is no longer modified when _lookupDone */ - int matchStaticSubject(int s) + public int matchStaticSubject(int s) { if (PRECONDITIONS) require (s >= SITE_BASE, @@ -2581,10 +2579,8 @@ int matchStaticSubject(int s) codeAt(s) == ExprKind.Match); var rc = (Clazz) _siteClazzCache.get(s); - if (rc == null) + if (rc == null && !_lookupDone) { - if (CHECKS) check - (!_lookupDone); var cl = clazzAt(s); var cc = id2clazz(cl); var outerClazz = cc; @@ -2592,7 +2588,7 @@ int matchStaticSubject(int s) rc = clazz(m.subject(), outerClazz, _inh.get(s - SITE_BASE)); _siteClazzCache.put(s, rc); } - return rc._id; + return rc == null ? NO_CLAZZ : rc._id; } diff --git a/src/dev/flang/fuir/analysis/dfa/DfaFUIR.java b/src/dev/flang/fuir/analysis/dfa/DfaFUIR.java index 56ceb9030..398a1bc40 100644 --- a/src/dev/flang/fuir/analysis/dfa/DfaFUIR.java +++ b/src/dev/flang/fuir/analysis/dfa/DfaFUIR.java @@ -179,7 +179,7 @@ public byte[] serialize() !withinCode(s) ? NO_CLAZZ : codeAt(s) == ExprKind.Assign ? assignedType(s) : NO_CLAZZ, !withinCode(s) || codeAt(s) != ExprKind.Box ? NO_CLAZZ : safe(()->boxValueClazz(s0), NO_CLAZZ), !withinCode(s) || codeAt(s) != ExprKind.Box ? NO_CLAZZ : safe(()->boxResultClazz(s0), NO_CLAZZ), - !withinCode(s) ? NO_CLAZZ : codeAt(s) == ExprKind.Match ? safe(()->matchStaticSubject(s0), NO_CLAZZ) : NO_CLAZZ, + !withinCode(s) ? NO_CLAZZ : codeAt(s) == ExprKind.Match ? matchStaticSubject(s0) : NO_CLAZZ, !withinCode(s) ? -1 : codeAt(s) == ExprKind.Match ? matchCaseCount(s) : NO_CLAZZ, !withinCode(s) ? null : codeAt(s) == ExprKind.Match ? matchCaseTags(s) : null, !withinCode(s) ? null : codeAt(s) == ExprKind.Match ? matchCaseCode(s) : null,