Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions kmir/src/kmir/kdist/mir-semantics/symbolic/spl-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,22 @@ The `#initBorrow` helper resets borrow counters to 0 and sets the correct dynami
[preserves-definedness]
```

## Rent minimum_balance calculation simplification

The rent exemption check involves: `(int)((float)(data_len * lamports_per_byte_year) * 2.0)`
Since float casts create thunks, we simplify this pattern directly to `PRODUCT * 2`.

```k
// Simplify: (int)((float)PRODUCT * 2.0) => PRODUCT * 2
rule #cast(
thunk(#applyBinOp(binOpMul,
thunk(#cast(Integer(PRODUCT:Int, 64, false), castKindIntToFloat, INT_TY, FLOAT_TY)),
Float(0.20000000000000000e1, 64),
false)),
castKindFloatToInt, FLOAT_TY, INT_TY)
=> Integer(PRODUCT *Int 2, 64, false)
```

```k
endmodule
```