Skip to content
Snippets Groups Projects
Commit e75f2001 authored by Jesper's avatar Jesper
Browse files

Fix error in concurrent circular eval

Unconditional approximation updates caused unsafe update of attribute value,
didn't match the reference algorithm.
parent 9dbf53aa
No related branches found
No related tags found
No related merge requests found
...@@ -84,16 +84,15 @@ $else ...@@ -84,16 +84,15 @@ $else
$endif $endif
state.setChangeInCycle(); state.setChangeInCycle();
$include(AttrDecl.traceCircularCase1Change) $include(AttrDecl.traceCircularCase1Change)
}
$if(#getNTA) $if(#getNTA)
if (_next != null) { if (_next != null) {
_next.setParent(#ntaParent); _next.setParent(#ntaParent);
} }
$endif $endif
// Always update the approximation, so that the !canRewrite() NTA case is handled correctly.
if (!#(signature)_value.compareAndSet(_previous, _next)) { if (!#(signature)_value.compareAndSet(_previous, _next)) {
_next = (#boxedType) #(signature)_value.get(); _next = (#boxedType) #(signature)_value.get();
} }
}
_previous = _next; _previous = _next;
#tracePrintStartingCycle #tracePrintStartingCycle
#cycleLimitCheck #cycleLimitCheck
...@@ -121,8 +120,6 @@ $else ...@@ -121,8 +120,6 @@ $else
$endif $endif
state.setChangeInCycle(); state.setChangeInCycle();
$include(AttrDecl.traceCircularCase2Change) $include(AttrDecl.traceCircularCase2Change)
}
// Always update the approximation, so that the !canRewrite() NTA case is handled correctly.
$if(#getNTA) $if(#getNTA)
if (_next != null) { if (_next != null) {
_next.setParent(#ntaParent); _next.setParent(#ntaParent);
...@@ -131,6 +128,7 @@ $endif ...@@ -131,6 +128,7 @@ $endif
if (!#(signature)_value.compareAndSet(_previous, _next)) { if (!#(signature)_value.compareAndSet(_previous, _next)) {
_next = (#boxedType) #(signature)_value.get(); _next = (#boxedType) #(signature)_value.get();
} }
}
$TracePrintReturnNewValue $TracePrintReturnNewValue
$include(AttrDecl.traceCircularExitCase2) $include(AttrDecl.traceCircularExitCase2)
return _next; return _next;
...@@ -198,8 +196,6 @@ $else ...@@ -198,8 +196,6 @@ $else
$endif $endif
state.setChangeInCycle(); state.setChangeInCycle();
$include(AttrDecl.traceCircularCase1Change) $include(AttrDecl.traceCircularCase1Change)
}
// Always update the approximation, so that the !canRewrite() NTA case is handled correctly.
$if(#getNTA) $if(#getNTA)
if (_next != null) { if (_next != null) {
if (#(signature)_list.get() == null) { if (#(signature)_list.get() == null) {
...@@ -213,6 +209,7 @@ $endif ...@@ -213,6 +209,7 @@ $endif
if (!_value.compareAndSet(_previous, _next)) { if (!_value.compareAndSet(_previous, _next)) {
_previous = (#boxedType) _value.get(); _previous = (#boxedType) _value.get();
} }
}
#tracePrintStartingCycle #tracePrintStartingCycle
#cycleLimitCheck #cycleLimitCheck
} while (state.testAndClearChangeInCycle()); } while (state.testAndClearChangeInCycle());
...@@ -239,8 +236,6 @@ $else ...@@ -239,8 +236,6 @@ $else
$endif $endif
state.setChangeInCycle(); state.setChangeInCycle();
$include(AttrDecl.traceCircularCase2Change) $include(AttrDecl.traceCircularCase2Change)
}
// Always update the approximation, so that the !canRewrite() NTA case is handled correctly.
$if(#getNTA) $if(#getNTA)
if (_next != null) { if (_next != null) {
if (#(signature)_list.get() == null) { if (#(signature)_list.get() == null) {
...@@ -254,6 +249,7 @@ $endif ...@@ -254,6 +249,7 @@ $endif
if (!_value.compareAndSet(_previous, _next)) { if (!_value.compareAndSet(_previous, _next)) {
_next = (#boxedType) _value.get(); _next = (#boxedType) _value.get();
} }
}
$TracePrintReturnNewValue $TracePrintReturnNewValue
$include(AttrDecl.traceCircularExitCase2) $include(AttrDecl.traceCircularExitCase2)
return _next; return _next;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment