Skip to content

Commit 77abeec

Browse files
committed
kmir/rt/data: add back in mutability check on final searched value
1 parent 881f30a commit 77abeec

File tree

1 file changed

+7
-7
lines changed
  • kmir/src/kmir/kdist/mir-semantics/rt

1 file changed

+7
-7
lines changed

kmir/src/kmir/kdist/mir-semantics/rt/data.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,8 @@ The solution is to use rewrite operations in a downward pass through the project
447447
[preserves-definedness] // valid list indexing checked upon context construction
448448
449449
syntax ProjectedUpdate ::= #readProjection(WriteTo, TypedLocal, ProjectionElems, Contexts, List, List) [function] // total
450-
| ProjectedUpdate(WriteTo, Contexts)
451-
// ----------------------------------------------------------
450+
| ProjectedUpdate(WriteTo, TypedValue, Contexts)
451+
// ----------------------------------------------------------------------
452452
rule #readProjection(
453453
_DEST,
454454
typedValue(Aggregate(IDX, ARGS), TY, MUT) => {ARGS[I]}:>TypedLocal,
@@ -532,16 +532,16 @@ The solution is to use rewrite operations in a downward pass through the project
532532
andBool I <Int size(LOCALS)
533533
[preserves-definedness]
534534
535-
rule #readProjection(DEST, _:TypedValue, .ProjectionElems, CONTEXTS, _, _)
536-
=> ProjectedUpdate(DEST, CONTEXTS)
535+
rule #readProjection(DEST, TV:TypedValue, .ProjectionElems, CONTEXTS, _, _)
536+
=> ProjectedUpdate(DEST, TV, CONTEXTS)
537537
538-
rule <k> #projectedUpdate(ProjectedUpdate(toLocal(I), CONTEXTS), NEW, false)
538+
rule <k> #projectedUpdate(ProjectedUpdate(toLocal(I), typedValue(_, _, mutabilityMut), CONTEXTS), NEW, false)
539539
=> #setLocalValue(place(local(I), .ProjectionElems), #buildUpdate(NEW, CONTEXTS))
540540
...
541541
</k>
542542
[preserves-definedness] // valid conmtext ensured upon context construction
543543
544-
rule <k> #projectedUpdate(ProjectedUpdate(toLocal(I), CONTEXTS), NEW, true)
544+
rule <k> #projectedUpdate(ProjectedUpdate(toLocal(I), _, CONTEXTS), NEW, true)
545545
=> #forceSetLocal(local(I), #buildUpdate(NEW, CONTEXTS))
546546
...
547547
</k>
@@ -556,7 +556,7 @@ The solution is to use rewrite operations in a downward pass through the project
556556
andBool I <Int size(LOCALS)
557557
[preserves-definedness] // valid list indexing checked
558558
559-
rule <k> #projectedUpdate(ProjectedUpdate(toStack(FRAME, local(I)), CONTEXTS), NEW, _) => .K ... </k>
559+
rule <k> #projectedUpdate(ProjectedUpdate(toStack(FRAME, local(I)), typedValue(_, _, mutabilityMut), CONTEXTS), NEW, _) => .K ... </k>
560560
<stack> STACK => STACK[(FRAME -Int 1) <- #updateStackLocal({STACK[FRAME -Int 1]}:>StackFrame, I, #buildUpdate(NEW, CONTEXTS)) ] </stack>
561561
requires 0 <Int FRAME
562562
andBool FRAME <=Int size(STACK)

0 commit comments

Comments
 (0)