Skip to content

Why not make CLR register-based?Β #4775

Closed

Description

@ygc369

CLR is a kind of Virtual Machine(VM), which is stack-based. I think that register-based VM is more effective, that is why android use it. So why not rewrite CLR to make it register-based?

Activity

  1. mikedn commented on Dec 11, 2015

    @mikedn
    Contributor

    I think that register-based VM is more effective

    Why?

    So why not rewrite CLR to make it register-based?

    Why rewrite the CLR instead of improving what's already there?

  2. ygc369 commented on Dec 11, 2015

    @ygc369
    Author

    Many tests show that register-based VM is more effective.

  3. mikedn commented on Dec 11, 2015

    @mikedn
    Contributor

    Many tests show that register-based VM is more effective.

    Well, show some of those test results here. And be sure that they're not taken out of context.

  4. jakobbotsch commented on Dec 11, 2015

    @jakobbotsch
    Member

    Changing the VM to be register-based would be an extremely breaking change, considering that all code assemblies contains CIL and the CIL spec right now dictates the stack-based format. It's so breaking that I think this is very unrealistic, regardless of performance differences.

  5. canton7 commented on Dec 11, 2015

    @canton7

    Also remember that CIL is not executed directly on a VM. The JIT turns it into (register-based) machine code, which is executed by the CPU. So the question is not "is a register-based VM more efficient to run than a stack-based VM?", it's "can a JIT turn a register-based intermediate language into machine code more efficiently than it can a stack-based intermediate language?". My strong suspicion is that no, no it can't.

    This would also break so much compatibility that I can't even begin to comprehend it all...

  6. mikedn commented on Dec 11, 2015

    @mikedn
    Contributor

    Also remember that CIL is not executed directly on a VM.

    Indeed, that's why I was hoping to see some relevant test results. Register base representations are more likely to help interpreters rather than compilers. This is because register based representations tend to use fewer instructions and thus an interpreter has less work to do.

    For compilers the situation isn't as clear cut. A register based representation may make reading the representation faster (for the same reason it helps interpreters) but it may introduce issues in later compilation stages.

    Android's VM isn't really representative in this regard, AFAIK it started life as an interpreter. Besides, most Android devices run on ARM and that may help a register based implementation because the number of hardware registers is known in advance.

  7. transferred this issue fromdotnet/coreclron Jan 30, 2020
  8. ghost locked as resolved and limited conversation to collaborators on Jan 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions