9
9
used to index/access it, representing the actual low-level index flowing to `SSTORE`/`SLOAD` stmts.
10
10
*/
11
11
.type StorageIndex = ConstantIndex {value: Value}
12
- | ConstArrayAccessIndex {parIndex: StorageIndex, arraySize: number, indexVar: Variable}
12
+ | StaticArrayAccessIndex {parIndex: StorageIndex, arraySize: number, indexVar: Variable}
13
13
| ArrayAccessIndex {parIndex: StorageIndex, indexVar: Variable}
14
14
| ArrayDataStartIndex {parIndex: StorageIndex}
15
15
| MappingAccessIndex {parIndex: StorageIndex, keyVar: Variable}
19
19
`StorageConstruct` contains the information of `StorageIndex`, stripped of indexing/access vars
20
20
*/
21
21
.type StorageConstruct = Constant {value: Value}
22
- | ConstArray {parConstruct: StorageConstruct, arraySize: number}
22
+ | StaticArray {parConstruct: StorageConstruct, arraySize: number}
23
23
| Array {parConstruct: StorageConstruct}
24
24
| Mapping {parConstruct: StorageConstruct}
25
25
| Offset {parConstruct: StorageConstruct, offset: number}
@@ -187,12 +187,12 @@ Variable_StorageIndex(def, $ArrayAccessIndex(parentIndex, newIndexVar)):-
187
187
ADDFix(_, indexVar, minusOneConstVar2, newIndexVar),
188
188
Variable_Value(minusOneConstVar2, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").
189
189
190
- Variable_StorageIndex(def, $ConstArrayAccessIndex (parentIndex, arraySize, checkedVar)):-
190
+ Variable_StorageIndex(def, $StaticArrayAccessIndex (parentIndex, arraySize, checkedVar)):-
191
191
Variable_StorageIndex(var, parentIndex),
192
192
ADDFix(_, var, checkedVar, def),
193
193
RevertEnforcesEnum(checkedVar, arraySize, _).
194
194
195
- Variable_StorageIndex(def, $ConstArrayAccessIndex (parentIndex, arraySize, checkedVarDiv)):-
195
+ Variable_StorageIndex(def, $StaticArrayAccessIndex (parentIndex, arraySize, checkedVarDiv)):-
196
196
Variable_StorageIndex(var, parentIndex),
197
197
ADDFix(_, var, checkedVarDiv, def),
198
198
DIV(_, checkedVar, const, checkedVarDiv),
@@ -218,8 +218,8 @@ StorageIndex_StorageConstruct($OffsetIndex(parentIndex, offset), $Offset(parentC
218
218
ActualStorageIndex($OffsetIndex(parentIndex, offset)), offset != 0,
219
219
StorageIndex_StorageConstruct(parentIndex, parentCons).
220
220
221
- StorageIndex_StorageConstruct($ConstArrayAccessIndex (parentIndex, arraySize, indexVar), $ConstArray (parentCons, arraySize)):-
222
- ActualStorageIndex($ConstArrayAccessIndex (parentIndex, arraySize, indexVar)),
221
+ StorageIndex_StorageConstruct($StaticArrayAccessIndex (parentIndex, arraySize, indexVar), $StaticArray (parentCons, arraySize)):-
222
+ ActualStorageIndex($StaticArrayAccessIndex (parentIndex, arraySize, indexVar)),
223
223
StorageIndex_StorageConstruct(parentIndex, parentCons).
224
224
225
225
/**
@@ -244,7 +244,7 @@ StorageIndex_ParentIndex(index, parentIndex):-
244
244
(
245
245
(index = $ArrayAccessIndex(parentIndex, indexVar), indexVar = indexVar); // suppress warning
246
246
(index = $ArrayDataStartIndex(parentIndex));
247
- (index = $ConstArrayAccessIndex (parentIndex, arraySize, indexVar), indexVar = indexVar, arraySize = arraySize); // suppress warning
247
+ (index = $StaticArrayAccessIndex (parentIndex, arraySize, indexVar), indexVar = indexVar, arraySize = arraySize); // suppress warning
248
248
(index = $MappingAccessIndex(parentIndex, indexVar), indexVar = indexVar); // suppress warning
249
249
(index = $OffsetIndex(parentIndex, offset), offset = offset) // suppress warning
250
250
).
@@ -254,7 +254,7 @@ StorageIndex_ParentIndexExclOffset(index, parentIndex):-
254
254
(
255
255
(index = $ArrayAccessIndex(parentIndex, indexVar), indexVar = indexVar); // suppress warning
256
256
(index = $ArrayDataStartIndex(parentIndex));
257
- (index = $ConstArrayAccessIndex (parentIndex, arraySize, indexVar), indexVar = indexVar, arraySize = arraySize); // suppress warning
257
+ (index = $StaticArrayAccessIndex (parentIndex, arraySize, indexVar), indexVar = indexVar, arraySize = arraySize); // suppress warning
258
258
(index = $MappingAccessIndex(parentIndex, indexVar), indexVar = indexVar) // suppress warning
259
259
// commenting this out for now, helps some cases but is not right
260
260
// ;(index = $OffsetIndex(parentIndex, offset), offset > 0) // suppress warning
@@ -289,13 +289,13 @@ ActualStorageIndex(parentIndex):-
289
289
290
290
StorageIndex_HighLevelUses(index, accessVar, 0, 0, 1):-
291
291
ActualStorageIndex(index),
292
- (index = $ArrayAccessIndex($ConstantIndex(const), accessVar); (index = $ConstArrayAccessIndex ($ConstantIndex(const), arraySize, accessVar), arraySize=arraySize); index = $MappingAccessIndex($ConstantIndex(const), accessVar)),
292
+ (index = $ArrayAccessIndex($ConstantIndex(const), accessVar); (index = $StaticArrayAccessIndex ($ConstantIndex(const), arraySize, accessVar), arraySize=arraySize); index = $MappingAccessIndex($ConstantIndex(const), accessVar)),
293
293
const = const.
294
294
295
295
StorageIndex_HighLevelUses(index, otherVar, prevOffset, i, prevNestedness + 1),
296
296
StorageIndex_HighLevelUses(index, accessVar, 0, prevNestedness, prevNestedness + 1):-
297
297
ActualStorageIndex(index),
298
- (index = $ArrayAccessIndex(parIndex, accessVar); (index = $ConstArrayAccessIndex (parIndex, arraySize, accessVar), arraySize=arraySize); index = $MappingAccessIndex(parIndex, accessVar)),
298
+ (index = $ArrayAccessIndex(parIndex, accessVar); (index = $StaticArrayAccessIndex (parIndex, arraySize, accessVar), arraySize=arraySize); index = $MappingAccessIndex(parIndex, accessVar)),
299
299
StorageIndex_HighLevelUses(parIndex, otherVar, prevOffset, i, prevNestedness).
300
300
301
301
StorageIndex_HighLevelUses($OffsetIndex(parentIndex, offset), accessVar, prevOffset, i, prevNestedness):-
@@ -331,19 +331,19 @@ IsStorageConstruct(cons),
331
331
IsDataStructureConstruct(cons):-
332
332
ActualStorageIndex(index),
333
333
StorageIndex_StorageConstruct(index, cons),
334
- (cons = $Array(parentCons); cons = $Mapping(parentCons); (cons = $ConstArray (parentCons, arraySize), arraySize=arraySize)), // filter intermediate constructs
334
+ (cons = $Array(parentCons); cons = $Mapping(parentCons); (cons = $StaticArray (parentCons, arraySize), arraySize=arraySize)), // filter intermediate constructs
335
335
parentCons = parentCons. // suppress warning
336
336
337
337
StorageConstruct_ParentAndOffset(cons, paparentCons, offset):-
338
338
IsStorageConstruct(cons),
339
- (cons = $Array(parentCons); cons = $Mapping(parentCons); (cons = $ConstArray (parentCons, arraySize), arraySize=arraySize); cons = $Variable(parentCons)),
339
+ (cons = $Array(parentCons); cons = $Mapping(parentCons); (cons = $StaticArray (parentCons, arraySize), arraySize=arraySize); cons = $Variable(parentCons)),
340
340
parentCons = $Offset(paparentCons, offset),
341
341
offset = offset. // suppress warning
342
342
343
343
StorageConstruct_ParentAndOffset(cons, parentCons, 0):-
344
344
IsStorageConstruct(cons),
345
- (cons = $Array(parentCons); cons = $Mapping(parentCons); (cons = $ConstArray (parentCons, arraySize), arraySize=arraySize); cons = $Variable(parentCons)),
346
- (parentCons = $Array(paparentCons) ; parentCons = $Mapping(paparentCons); (parentCons = $ConstArray (paparentCons, arraySize2), arraySize2=arraySize2); parentCons = $Variable(paparentCons)),
345
+ (cons = $Array(parentCons); cons = $Mapping(parentCons); (cons = $StaticArray (parentCons, arraySize), arraySize=arraySize); cons = $Variable(parentCons)),
346
+ (parentCons = $Array(paparentCons) ; parentCons = $Mapping(paparentCons); (parentCons = $StaticArray (paparentCons, arraySize2), arraySize2=arraySize2); parentCons = $Variable(paparentCons)),
347
347
paparentCons = paparentCons. // suppress warning
348
348
349
349
DataStructure_ElemNum(cons, elemNum):-
@@ -448,8 +448,8 @@ DataStructure_Type($Array(parentCons), "string"):-
448
448
IsDataStructureConstruct($Array(parentCons)),
449
449
BytesOrStringLengthV2($Array(parentCons), _).
450
450
451
- DataStructure_Type($ConstArray (parentCons, arraySize), cat(type, cat("[", cat(to_string(arraySize), "]")))):-
452
- DataStructure_ValueOrElementType($ConstArray (parentCons, arraySize), type).
451
+ DataStructure_Type($StaticArray (parentCons, arraySize), cat(type, cat("[", cat(to_string(arraySize), "]")))):-
452
+ DataStructure_ValueOrElementType($StaticArray (parentCons, arraySize), type).
453
453
454
454
// // Disable general rule for now
455
455
// StorageStmtToIndexAndConstruct(stmt, "ACCESS", index, $Variable(cons)):-
@@ -520,7 +520,7 @@ StorageStmtToIndexAndConstruct(store, "ACCESS", index, $TightlyPackedVariable(co
520
520
521
521
StorageOffset_Type(offset, type):-
522
522
DataStructure_Type(cons, type),
523
- (cons = $Array(parentCons); cons = $Mapping(parentCons); (cons = $ConstArray (parentCons, arraySize), arraySize=arraySize)),
523
+ (cons = $Array(parentCons); cons = $Mapping(parentCons); (cons = $StaticArray (parentCons, arraySize), arraySize=arraySize)),
524
524
parentCons = $Constant(offset).
525
525
526
526
@@ -673,7 +673,7 @@ DEBUG_OUTPUT(IsPackedArray)
673
673
IsPackedArray(cons, byteWidth):-
674
674
SLOAD(_, sindexVar, loadedVar),
675
675
Variable_StorageIndex(sindexVar, sindex),
676
- ((sindex = $ConstArrayAccessIndex (parIndex, arraySize, indexVar), arraySize=arraySize);
676
+ ((sindex = $StaticArrayAccessIndex (parIndex, arraySize, indexVar), arraySize=arraySize);
677
677
sindex = $ArrayAccessIndex(parIndex, indexVar)),
678
678
parIndex=parIndex,
679
679
StorageIndex_StorageConstruct(sindex, cons),
@@ -690,7 +690,7 @@ IsPackedArray(cons, byteWidth):-
690
690
IsPackedArray(cons, @hex_to_number(@div_256("0x20", const))):-
691
691
SLOAD(_, sindexVar, loadedVar),
692
692
Variable_StorageIndex(sindexVar, sindex),
693
- ((sindex = $ConstArrayAccessIndex (parIndex, arraySize, indexVar), arraySize=arraySize);
693
+ ((sindex = $StaticArrayAccessIndex (parIndex, arraySize, indexVar), arraySize=arraySize);
694
694
sindex = $ArrayAccessIndex(parIndex, indexVar)),
695
695
parIndex=parIndex,
696
696
StorageIndex_StorageConstruct(sindex, cons),
0 commit comments