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

UseNz, UseIsNull & FoldNotInJmp to handle if(a==null), if(a==0) #1213

Merged
merged 12 commits into from
Oct 27, 2024

Conversation

Hecate2
Copy link
Contributor

@Hecate2 Hecate2 commented Oct 24, 2024

Terrible conflicts with #1203 . I will have to change codes when they are being merged.
Artifacts and GAS assertions not updated.

@Hecate2
Copy link
Contributor Author

Hecate2 commented Oct 24, 2024

For if (a != null), we used:

PUSHNULL
NOTEQUAL
JMPIFNOT

Now we can fold it to ISNULL NOT JMPIFNOT, and then to ISNULL JMPIF.
Typically saves 120 Datoshi in each test case of UnitTest_NullableType.

@Hecate2 Hecate2 changed the title UseIsNull & FoldNotInJmp to handle if(a==null) UseNz, UseIsNull & FoldNotInJmp to handle if(a==null) Oct 24, 2024
@Hecate2 Hecate2 changed the title UseNz, UseIsNull & FoldNotInJmp to handle if(a==null) UseNz, UseIsNull & FoldNotInJmp to handle if(a==null), if(a==0) Oct 24, 2024
This reverts commit 792c299.
PUSH0 EQUAL -> NOT and PUSH0 NOTEQUAL -> NZ are both wrong because of null
…to use-isnull

# Conflicts:
#	src/Neo.Compiler.CSharp/Optimizer/Strategies/Optimizer.cs
#	src/Neo.Compiler.CSharp/Optimizer/Strategies/Peephole.cs
@Hecate2
Copy link
Contributor Author

Hecate2 commented Oct 24, 2024

(Will handle the GAS and test artifacts in 24 hours)

@Hecate2 Hecate2 marked this pull request as ready for review October 25, 2024 03:01
shargon
shargon previously approved these changes Oct 26, 2024
@Jim8y
Copy link
Contributor

Jim8y commented Oct 27, 2024

Impreassive

@Jim8y Jim8y merged commit 667ace7 into neo-project:master Oct 27, 2024
4 checks passed
@Jim8y Jim8y deleted the use-isnull branch October 27, 2024 06:36
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