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

generate method dispatchers prior to code-gen #734

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

zerbina
Copy link
Collaborator

@zerbina zerbina commented Jun 1, 2023

Summary

Move the method dispatcher generation out of the code generators (cgen
and jsgen) and into the orchestrators. This is another step towards
unifying the backend processing.

Methods are now also subject to dead-code elimination, meaning that if
none of the methods attached to an object hierarchy are called, no code
will be generated for them.

Details

The dispatchers do not appear in calls prior to transf, so the DCE
implementation used by IC backend cannot analyze them. For this reason,
cgen continues to special-case methods.

In addition, remove the unused objHasKidsValid enum value.

Future Direction

Given that all backends need to generate method dispatchers, this step
(lowering methods into procedures) should happen through some common
facility in the future.

@zerbina zerbina added refactor Implementation refactor compiler/backend Related to backend system of the compiler simplification Removal of the old, unused, unnecessary or un/under-specified language features. labels Jun 1, 2023
@saem
Copy link
Collaborator

saem commented Jun 1, 2023

FYI, I made a few minor grammar edits to PR body.

@saem
Copy link
Collaborator

saem commented Jun 1, 2023

/merge

@github-actions
Copy link

github-actions bot commented Jun 1, 2023

Merge requested by: @saem

Contents after the first section break of the PR description has been removed and preserved below:


Notes for Reviewers

  • implementing method support for the VM backend is now trivial

@chore-runner chore-runner bot enabled auto-merge June 1, 2023 22:20
@chore-runner chore-runner bot added this pull request to the merge queue Jun 1, 2023
Summary
=======

Move the method dispatcher generation out of the code generators (`cgen`
and `jsgen`) and into the orchestrators. This is another step towards
unifying the backend processing.

Methods are now also subject to dead-code elimination, meaning that if
none of the methods attached to an object hierarchy is called, no code
will be generated for them.

Details
=======

The dispatchers do not appear in calls prior to `transf`, so the DCE
implementation used by IC backend cannot analyze them. For this reason,
`cgen` continues to special-case methods them.

In addition, remove the unused `objHasKidsValid` enum value.

Future Direction
----------------

Given that all backends need to generate method dispatchers, this step
(lowering methods into procedures) should happen through some common
facility in the future.
Merged via the queue into nim-works:devel with commit 96ebe3d Jun 1, 2023
@zerbina zerbina deleted the common-dispatcher-generation branch June 3, 2023 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/backend Related to backend system of the compiler refactor Implementation refactor simplification Removal of the old, unused, unnecessary or un/under-specified language features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants