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

Remove the three-pass codegen step. #277

Merged
merged 1 commit into from Dec 1, 2018
Merged

Remove the three-pass codegen step. #277

merged 1 commit into from Dec 1, 2018

Conversation

@dvander
Copy link
Member

@dvander dvander commented Nov 26, 2018

Code generation happens in three full passes over the assembly stream.
The first pass collects label addresses. The second pass generates code.
The final pass generates data. This is unnecessary; the first pass can
be eliminated via a lazy back-patch list. The last two passes can be
combined into one.

Copy link
Member

@Headline Headline left a comment

One question inline

@@ -384,32 +391,41 @@ static void do_call(CellWriter* writer, AsmReader* reader, cell opcode)
writer->append(sym->addr());
}

static void write_label(CellWriter* writer, int index)
Copy link
Member

@Headline Headline Nov 30, 2018

Choose a reason for hiding this comment

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

Is there any reason this isn't a member of CellWriter?

Copy link
Member Author

@dvander dvander Dec 1, 2018

Choose a reason for hiding this comment

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

Good call, done.

Code generation happens in three full passes over the assembly stream.
The first pass collects label addresses. The second pass generates code.
The final pass generates data. This is unnecessary; the first pass can
be eliminated via a lazy back-patch list. The last two passes can be
combined into one.
@dvander dvander merged commit 765d3d7 into master Dec 1, 2018
2 checks passed
@dvander dvander deleted the asmone branch Dec 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants