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

when nimvm visible in runtime code causing misexecution due to matching preference rules #23688

Open
arnetheduck opened this issue Jun 6, 2024 · 2 comments

Comments

@arnetheduck
Copy link
Contributor

arnetheduck commented Jun 6, 2024

Description

when nimvm:
  proc mytest(a: int) =
    echo a
else:
  template mytest(a: untyped) =
    echo a + 42


proc xxx() =
  mytest(100)
xxx()

Nim Version

1.6, 2.0

Current Output

100

Expected Output

142

Possible Solution

No response

Additional Information

No response

@arnetheduck arnetheduck changed the title when nimvm silenty swallows code causing misexecution when nimvm silently swallows code causing misexecution Jun 6, 2024
@arnetheduck arnetheduck changed the title when nimvm silently swallows code causing misexecution when nimvm visible at runtime code causing misexecution due to matching preference rules Jun 6, 2024
@arnetheduck arnetheduck changed the title when nimvm visible at runtime code causing misexecution due to matching preference rules when nimvm visible in runtime code causing misexecution due to matching preference rules Jun 6, 2024
@arnetheduck
Copy link
Contributor Author

a variation on #23687

arnetheduck added a commit to status-im/nimcrypto that referenced this issue Jun 6, 2024
nim-lang/Nim#23688 causes the implementation
to fall into the `when nimvm` versions of THETA1, CHI etc - these
operate on openArray and get interspersed with range checks and other
random inefficiencies.

This fix doubles the speed of the 256-bit keccak.
cheatfate pushed a commit to cheatfate/nimcrypto that referenced this issue Jun 6, 2024
nim-lang/Nim#23688 causes the implementation
to fall into the `when nimvm` versions of THETA1, CHI etc - these
operate on openArray and get interspersed with range checks and other
random inefficiencies.

This fix doubles the speed of the 256-bit keccak.
@Araq
Copy link
Member

Araq commented Jun 7, 2024

Well the VM evals the toplevel statement and thus the "proc" branch is the active one. It produces the output that I would have predicted.

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

No branches or pull requests

2 participants