You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
contract Foo {
int x;
}
transaction t1() {
Foo f = new Foo(42); // allocate space on a heap somewhere
f.x // looks in memory for x
return f;
}
transaction t2() {
Foo f = new Foo(42); // Want Foo to be allocated cheaply
f.doStuff();
// If f is owned AND there are no unowned aliases, want f to be freed here
}
If you assign a reference to a heap-allocated object to a field of a contract, then the object must be migrated to storage. At the end of the transaction, sweep the fields and move objects from memory to storage as needed.
Update
As of EOB on 6 August, here are some things that are different between our output and the analagous solc output that need to get addressed:
the output yul contains repeated objects and oddly duplicated ones, like x_deployed_deployed. this is because of the way that YulObject invokes the printer in a way that i don't quite understand. it's both redundant and is wrong enough to break solc.
we emit code like set(value : u256); type annotations are in the spec but not accepted by solc right now
write a bug report for the above in solc
the dispatch table needs to get rewritten so that it can handle functions that take arguments.
there are literal tab characters in the output rather than all spaces; i do not know how they get there, but they make it hard to reformat the file and read it. (it's fine for functionality in that it doesn't break solc but it is not ergonomic for working on the code)
This list is not exhaustive.
The text was updated successfully, but these errors were encountered:
This task has been broken down into enough smaller parts that the monolithic issue no longer really makes sense. Parts of it have been addressed and others are either small fixes that aren't on the critical path or no longer in scope. I'm going to close it to clean up the board instead of keeping it around kind of inactive forever.
Original Description
A possible approach:
If you assign a reference to a heap-allocated object to a field of a contract, then the object must be migrated to storage. At the end of the transaction, sweep the fields and move objects from memory to storage as needed.
Update
As of EOB on 6 August, here are some things that are different between our output and the analagous
solc
output that need to get addressed:x_deployed_deployed
. this is because of the way thatYulObject
invokes the printer in a way that i don't quite understand. it's both redundant and is wrong enough to breaksolc
.set(value : u256)
; type annotations are in the spec but not accepted bysolc
right nowsolc
but it is not ergonomic for working on the code)This list is not exhaustive.
The text was updated successfully, but these errors were encountered: