Skip to content

If statement for Iulia / Inline Assembly#3220

Merged
chriseth merged 5 commits intodevelopfrom
IuliaIf
Nov 27, 2017
Merged

If statement for Iulia / Inline Assembly#3220
chriseth merged 5 commits intodevelopfrom
IuliaIf

Conversation

@chriseth
Copy link
Contributor

This will be much more useful in the ABI decoder (only the encoder is part of develop as of now).

AbstractAssembly::LabelID end = m_assembly.newLabelId();
m_assembly.appendJumpToIf(end);
(*this)(_if.body);
m_assembly.setSourceLocation(_if.location);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the sourcelocation be before the body or even the condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, the source location of the label is correct, but what is wrong is the source location of the ISZERO and the jump above.

Copy link
Contributor

Choose a reason for hiding this comment

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

Will you look into this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Done.

@axic
Copy link
Contributor

axic commented Nov 21, 2017

I think this is missing the evm1.5 codegen part?

@chriseth
Copy link
Contributor Author

No, AbstractAssembly handles both of them.

@axic
Copy link
Contributor

axic commented Nov 22, 2017

No, AbstractAssembly handles both of them.

Never mind, it is EVMCodeTransform and the if code has no need for evm15 specific stuff.

Copy link
Contributor

@axic axic left a comment

Choose a reason for hiding this comment

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

Please include the if statement in the formal spec

@chriseth chriseth force-pushed the IuliaIf branch 2 times, most recently from 6f4ac0e to 239e456 Compare November 22, 2017 13:22
@axic
Copy link
Contributor

axic commented Nov 22, 2017

It is lacking tests:

  • printing test
  • assemble test
  • scope tests (if iszero() { let x := 1 } x := 2)
  • tests in the julia suite

Though it seems for loop isn't covered in the printing test either.

@chriseth
Copy link
Contributor Author

There is and end-to-end test for if - do we have an "assemble test suite"?

@axic
Copy link
Contributor

axic commented Nov 22, 2017

BOOST_AUTO_TEST_SUITE(Analysis) in test/solidity/InlineAssembly

@chriseth
Copy link
Contributor Author

Tests added.


BOOST_AUTO_TEST_CASE(if_statement)
{
BOOST_CHECK(successParse("{ if 42:u256 {} }"));
Copy link
Contributor

@axic axic Nov 22, 2017

Choose a reason for hiding this comment

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

Hmm, shouldn't in Julia this operate on boolean? if true:bool {}. It currently has a hidden behaviour of if iszero(cond) {}

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 can change the test, but we do not yet enforce types anyway, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, not yet. It is fine to leave as it is, we'll at least see if the enforcement triggers this failure :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I see you've updated it, it is fine that way too.

docs/julia.rst Outdated
G, L, continue
E(G, L, <if condition body>: If) =
let G0, L0, v = E(G, L, condition)
if v is true or non-zero:
Copy link
Contributor

Choose a reason for hiding this comment

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

This part is about julia, I think that is more strict and only considers if v is true.

@chriseth
Copy link
Contributor Author

Updated.

@axic
Copy link
Contributor

axic commented Nov 23, 2017

Perhaps we're failing zeppelin tests now as they've checking for even warnings:

> zeppelin-solidity@1.3.0 test /tmp/tmp.Cblq5apBSn
> scripts/test.sh
Starting our own testrpc instance
Error parsing /tmp/tmp.Cblq5apBSn/contracts/Bounty.sol: Warning: This is a pre-release compiler version, please do not use it in production.
Compilation failed. See above.

@chriseth
Copy link
Contributor Author

@axic hm, I fear we have to patch that out, we cannot wait for modified zeppelin code when we introduce a new warning.

@axic
Copy link
Contributor

axic commented Nov 27, 2017

Test failures are due to the Zeppelin issue. This should be fine to merge though as everything else works and it only adds the if feature.

@chriseth chriseth merged commit a1f59cb into develop Nov 27, 2017
@axic axic deleted the IuliaIf branch November 27, 2017 14:05
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.

2 participants