Skip to content

Commit 14bce58

Browse files
committed
fix(rt): Clarify struct offsets and add pointer tests
1 parent 1818704 commit 14bce58

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,6 @@ syntax Int ::= #msBytes ( MachineSize ) [function, total]
100100
rule #msBytes(machineSize(mirInt(NBITS))) => NBITS /Int 8 [preserves-definedness]
101101
rule #msBytes(machineSize(NBITS)) => NBITS /Int 8 [owise, preserves-definedness]
102102
103-
// Extract field offsets from the struct layout when available (Arbitrary only).
104-
syntax MachineSizes ::= #structOffsets ( MaybeLayoutShape ) [function, total]
105-
rule #structOffsets(someLayoutShape(layoutShape(fieldsShapeArbitrary(mk(OFFSETS)), _, _, _, _))) => OFFSETS
106-
rule #structOffsets(noLayoutShape) => .MachineSizes
107-
rule #structOffsets(_) => .MachineSizes [owise]
108-
109103
// Minimum number of input bytes required to decode all fields by the chosen offsets.
110104
// Uses builtin maxInt to compute max(offset + size). The lists of types and
111105
// offsets must have the same length; if not, this function returns -1 to signal

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ Pointers to structs with a single zero-offset field are compatible with pointers
8181
orBool #structOffsets(LAYOUT) ==K machineSize(mirInt(0)) .MachineSizes
8282
orBool #structOffsets(LAYOUT) ==K machineSize(0) .MachineSizes
8383
84+
// Extract field offsets from the struct layout when available (Arbitrary only).
8485
syntax MachineSizes ::= #structOffsets ( MaybeLayoutShape ) [function, total]
85-
8686
rule #structOffsets(someLayoutShape(layoutShape(fieldsShapeArbitrary(mk(OFFSETS)), _, _, _, _))) => OFFSETS
8787
rule #structOffsets(_) => .MachineSizes [owise]
8888
```

0 commit comments

Comments
 (0)