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

Optimise br_if boolean casting #24

Closed
SwadicalRag opened this issue Jun 9, 2019 · 1 comment
Closed

Optimise br_if boolean casting #24

SwadicalRag opened this issue Jun 9, 2019 · 1 comment
Labels
duplicate This issue or pull request already exists optimisation Implement this to make things run faster

Comments

@SwadicalRag
Copy link
Owner

(copied from discord)

if i were to do it i'll probably add an extra field inside a phantom register called
lastBoolTransformation: string
which is set (with the code snippet before it was converted into a bool) whenever a number is cast into a bool via an operation
and then i'd add an extra parameter to getPop called shouldReturnBool and inside the function, if:

  1. a phantom register is on the stack AND
  2. lastBoolTransformation is set, return lastBoolTransformation
  3. otherwrise, return (${phantomReg.value}) as normal

and in br_if, use that added parameter in getPop
lastBoolTransformation is guaranteed to be only written once because phantom registers should only ever be assigned to once

@SwadicalRag SwadicalRag added optimisation Implement this to make things run faster duplicate This issue or pull request already exists labels Jun 9, 2019
@SwadicalRag
Copy link
Owner Author

Duplicate of #16

@SwadicalRag SwadicalRag marked this as a duplicate of #16 Jun 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists optimisation Implement this to make things run faster
Projects
None yet
Development

No branches or pull requests

1 participant