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

chore: handle assembler refactoring changes #181

Merged
merged 9 commits into from
May 7, 2024

Conversation

bitwalker
Copy link
Contributor

This modifies various bits of the compiler that are tightly integrated with the Miden VM assembler components now that 0xPolygonMiden/miden-vm#1277 is merged. Notably:

  • The instruction set for MASM now is a 1:1 match, though for the time being we still have it duplicated in the compiler so that we can use the same patterns for analysis/building/translating as we do the IR. I plan to revisit that in the future, to try and unify them, but for now it is not important enough to tackle yet
  • Support for assertion error codes is added for assert and assertz instructions (fixes Implement support for assertion error codes #33)
  • We no longer need explicit imports for standard library functions (fixes Missing Miden stdlib import in the Module when emitting stdlib's function calls in stackify pass  #57)
  • The rules for procedure names/identifiers have been loosened (fixes Compiling an app target to MASM is broken due to __main is an invalid name for a procedure in the Miden Assembler #59)
  • Support for some basic advice provider ops is added to the emulator
  • Support for MASL libraries is removed, for the time being we only support emitting MASM text files, until the MAST changes are fully landed in the assembler, at which point we will emit MAST by default
  • We now use the formatting utilities from miden-core for pretty printing AST/IR
  • miden_codegen_masm::masm::Program is now more or less a container of modules + the global data segment table, it no longer contains the executable "main" function, that is now generated as part of a Module of executable type. I'm not super happy with how these structures are organized/used in the codegen backend right now, but until things stabilize a bit, I don't want to try and revisit it. I think longer term we'll want to have a more unified set of core libraries used between the compiler and assembler (or perhaps the assembler becomes more integrated into the compiler), and since most of the awkwardness here is a result of duplication/impedance mismatch, I think those sorts of changes would resolve the vast majority of my complaints.

Next up are the felt changes

@bitwalker bitwalker added codegen blocker This issue is one of our top priorities labels May 6, 2024
@bitwalker bitwalker requested a review from greenhat May 6, 2024 06:10
@bitwalker bitwalker self-assigned this May 6, 2024
@bitwalker bitwalker force-pushed the bitwalker/assembler-refactor branch from 682ed1c to 5ea9fde Compare May 6, 2024 06:13
Copy link
Contributor

@greenhat greenhat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great!

@greenhat
Copy link
Contributor

greenhat commented May 6, 2024

Do you want me to rebase my stack of PRs on top of this PR, or should I wait for the next one?

@bitwalker bitwalker merged commit 3dbdc0f into main May 7, 2024
2 checks passed
@bitwalker bitwalker deleted the bitwalker/assembler-refactor branch May 7, 2024 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker This issue is one of our top priorities codegen
Projects
None yet
2 participants