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

Increased TInstr field sizes: allow long jumps and 65535 VM registers #12777

Merged
merged 3 commits into from Dec 10, 2019

Conversation

zevv
Copy link
Contributor

@zevv zevv commented Nov 30, 2019

Increases range from from 32K to 8M instructions. Leaves plenty of space in TInstr that can later be used for other purposes.

Fixes #12727, supersedes #12742

@Araq
Copy link
Member

Araq commented Dec 1, 2019

Can we get some benchmark numbers? How much memory is wasted? I expect the number of VM instructions in the thousands so we lose about 10_000 * 4 = 40K bytes. Not really significant. And why not also increase the number of registers we have?

@zevv
Copy link
Contributor Author

zevv commented Dec 1, 2019

I split my inital commit into smaller functional pieces because discussions were diverging to places that were not yet relevant imho. This PR only scratches my itch, the next PR after this will increase A,B and C sizes to 16 bits to allow more registers. That would leave 8 bits unused only, so not really space for another register - but I'd like to save discussions about this for the next PR, this one is only about increasing Bx.

@zevv
Copy link
Contributor Author

zevv commented Dec 1, 2019

  • Memory: when running a hefty npeg compiler I end up with tens of thousands of instructions, so that's in the tens-of-kilobytes range.
  • Performance: My tests consists of timing the nim vm/ test suites, for which I don't see any significant impact over the noise.

I'd be happy to do more thorough testing, but I'd needs some hints on what to test.

@zevv zevv changed the title Increased regBx size from 16 to 24 bits to increase jump range in the VM Increased TInstr field sizes: allow long jumps and 65535 VM registers Dec 5, 2019
@zevv zevv force-pushed the zevv-regbx branch 3 times, most recently from 76228e6 to 3f5b285 Compare December 10, 2019 11:17
@Araq Araq merged commit e61d702 into nim-lang:devel Dec 10, 2019
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.

VM instruction addressing limitation: Error: internal error: (filename: "vmgen.nim", line: 179, column: 16)
2 participants