Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sol->Yul] Implement uint256[] memory arrays #7015

Merged
merged 1 commit into from
Jul 9, 2019
Merged

Conversation

Marenz
Copy link
Contributor

@Marenz Marenz commented Jun 27, 2019

Part of #8343.

}

return Whiskers(R"(
function <functionName>(baseRef, index) -> addr {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be slightly more complicated than that, maybe do it later.

@Marenz Marenz force-pushed the sol-yul-arrays branch 2 times, most recently from 0a91de5 to 4f7303f Compare July 3, 2019 10:31
@Marenz Marenz marked this pull request as ready for review July 3, 2019 10:48
@Marenz
Copy link
Contributor Author

Marenz commented Jul 3, 2019

This PR is ready for review/merge

@Marenz Marenz force-pushed the sol-yul-arrays branch 2 times, most recently from 69ab5e6 to 0dce871 Compare July 8, 2019 13:03
}
)")
("functionName", functionName)
("combine", combineExternalFunctionIdFunction())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this perform cleanup?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but I think we said we leave that for now as there was no function for cleaning up addr/selector. The evm code was only cleaning up addr I think and it used FunctionType for it..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the function actually already performs cleanup.

@@ -17,10 +17,6 @@ contract C {

return func() == internal_func();
}
function external_func() external pure returns (int8)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was useless and wasn't even called.

@leonardoalt
Copy link
Member

Can you please add a test where a function creates a memory array and passes it via parameter to an internal function?


string prepared = _value;

// Exists to see if this case ever happens
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it happen for implicit conversion?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the conversion is already requested earlier.

)")
("functionName", functionName)
("arrayLen", arrayLengthFunction(_type))
("headSize", to_string(_type.memoryHeadSize()))
Copy link
Member

@leonardoalt leonardoalt Jul 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? Isn't the idea to multiply the index by the size of each element? If so I would imagine this should use the base type.
In case the above is true, using ArrayType::memoryStride() would allow removing <?noByteArray>.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! #7015 (review)

@Marenz why didn't you include that change suggestion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the change locally but haven't pushed yet. I mark things as resolved as I fix them and then push.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing it to use memorystride

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, indeed, that seems like the perfect fit ;)

Copy link
Member

@leonardoalt leonardoalt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add out of bound tests with runtime values.
Otherwise looks good!

@Marenz
Copy link
Contributor Author

Marenz commented Jul 9, 2019

Updated

leonardoalt
leonardoalt previously approved these changes Jul 9, 2019
@chriseth
Copy link
Contributor

chriseth commented Jul 9, 2019

Test is failing.

@Marenz
Copy link
Contributor Author

Marenz commented Jul 9, 2019

That's what I get for not recompiling before pushing

@Marenz
Copy link
Contributor Author

Marenz commented Jul 9, 2019

pushed fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants