Skip to content

EOF container assembler prototype - #148

Closed
gumb0 wants to merge 7 commits into
quilt:masterfrom
gumb0:eof
Closed

EOF container assembler prototype#148
gumb0 wants to merge 7 commits into
quilt:masterfrom
gumb0:eof

Conversation

@gumb0

@gumb0 gumb0 commented May 26, 2024

Copy link
Copy Markdown

This is a prototype for emitting EOF container bytecode from assembler.

The following syntax for defining EOF sections is proposed:

section .code
stop

section .code outputs=1
push0
retf

section .code inputs=1 outputs=nonret max_stack_height=2
pop
push0
push0
return

section .data
%include_hex("data.etk")
  • EOF container is generated in case at least one section is defined, otherwise legacy code is generated.
  • Code sections and data section are supported.
  • Code sections may declare their number of inputs/outputs and max stack height (this data goes into EOF type section)
  • Section attributes are optional and by default are inputs=0 outputs=nonret max_stack_height=0
  • outputs=nonret means sections is non-returning.

TODO

  • Each code section should be in a separate scope
  • Test that sections get correct size when variable-size pushes are used
  • max_stack_height may be automatically calculated within a forward pass during assembly

Known issues / limitations:

  • Attributes are allowed for data sections too, but are ignored (probably shoud be disallowed)
  • Attributes can be duplicated, only last mentioned value is used (better should not be allowed)
  • No bounds checking for attribute values, panic when above the limit

Future work for EOF support

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.

1 participant