Skip to content

Generate Bytecode #167

Closed
Closed

Activity

  1. yovoslav commented on Nov 4, 2019

    @yovoslav
    Contributor

    Has any work been done on this?

  2. jasonwilliams commented on Nov 4, 2019

    @jasonwilliams
    MemberAuthor

    @IovoslavIovchev Nope not yet

  3. added
    A-Enhancement
    on Apr 3, 2020
  4. Razican commented on May 19, 2020

    @Razican
    Member

    This will require a fundamental change on how the interpreter works, but it would be very useful to cache bytecode in the future, and to implement an optimization pass (or multiple optimization passes). Some overview on how V8 does this can be found here: https://v8.dev/blog/ignition-interpreter

  5. jasonwilliams commented on May 20, 2020

    @jasonwilliams
    MemberAuthor

    My guess is a new interpreter would be created along side the current one which reads the AST and generates bytecode, there would most likely be a switch for a while ‘—bytecode’

    Design doc for ignition
    https://docs.google.com/document/d/11T2CRex9hXxoJwbYqVQ32yIPMh0uouUZLdyrtmMoL44/mobilebasic#h.z0c1oogsbnnq

  6. jasonwilliams commented on Jun 3, 2020

    @jasonwilliams
    MemberAuthor

    Do we want to come up with a set of instructions that would work for us, that would get the ball rolling

  7. yovoslav commented on Jun 4, 2020

    @yovoslav
    Contributor

    @jasonwilliams are there any ideas for the VM design/any work done? Are we aiming for a register-based VM? I reckon we need to have some idea what the VM is going to be like before we come up with the instruction set.

  8. jasonwilliams commented on Jun 4, 2020

    @jasonwilliams
    MemberAuthor

    Are we aiming for a register-based VM?

    Yes i would imagine it being similar to the V8 VM with registers and an accumulator

  9. jasonwilliams commented on Jun 6, 2020

    @jasonwilliams
    MemberAuthor

    Will attempt to base of Jason’s example here:
    jorendorff@266319f#diff-8a4e02ddeeda9cccf194eab4892b1c1cR162-R167

    There is an issue here though.
    Operations on Values have been promoted to the Value level, so the stack needs to either use Values (which isn’t efficient because it will point to the heap for everything) or each instruction will need to box to a Value do the operation then come back down.

    For now we will need to do the former, but in future we may have to refactor Values again, so that they’re not so coupled with the Gc.

    Similar to the Executable trait we will need a CodeGen trait that each node implements

  10. yovoslav commented on Jun 7, 2020

    @yovoslav
    Contributor

    There is currently a POC branch, with the aim to explore the different options we have.

    The current implementation is based on the aforementioned example.

  11. jasonwilliams commented on Jun 7, 2020

    @jasonwilliams
    MemberAuthor

    #461 POC from @IovoslavIovchev
    I've:

    1. Moved instructions into their own file
    2. Implemented Default for Realm (so that VM can implement Default)
    3. Looked into accumulators
    4. Implemented CodeGen for Node
  12. added
    E-Hard
    on Sep 30, 2020
  13. Razican commented on Jan 2, 2021

    @Razican
    Member

    Is this really closed?

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

    A-EnhancementE-Hard

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions