solang icon indicating copy to clipboard operation
solang copied to clipboard

`Expression::ReturnData` should be an Instruction

Open LucasSte opened this issue 3 years ago • 0 comments

Expressions in the CFG are moved around freely by our optimizations passes. The Borsh decoding implementation leverages such a property to make decoding more efficient but avoiding creating a new variable for each new read value. In theory, they can just be accessed by dereferencing the buffer pointer casted to the desired type (this is how the LLVM backend works).

The existence of Expression::RetrunData makes it impossible to take advantage of the aforementioned optimizations. As noted in #1053, the Borsh encoding is now less efficient as we need a new variable for each read value.

Expression::ReturnData must be transformed into an instruction, as it cannot be move around freely and depends on the result of the last executed external call.

LucasSte avatar Oct 27 '22 16:10 LucasSte