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

compiler/passes: clearPasses, registerPass does not attach to ModuleGraph #9068

Closed
alaviss opened this issue Sep 25, 2018 · 5 comments
Closed
Labels

Comments

@alaviss
Copy link
Collaborator

alaviss commented Sep 25, 2018

Currently they operates on global vars:

Nim/compiler/passes.nim

Lines 60 to 69 in 1074cc1

var
gPasses: array[0..maxPasses - 1, TPass]
gPassesLen*: int
proc clearPasses*(g: ModuleGraph) =
gPassesLen = 0
proc registerPass*(g: ModuleGraph; p: TPass) =
gPasses[gPassesLen] = p
inc(gPassesLen)

Despite taking a ModuleGraph as argument.

See #8590 (comment)

@alaviss
Copy link
Collaborator Author

alaviss commented Oct 4, 2018

Looks like nimble might be bitten by this issue nim-lang/nimble#456

@timotheecour
Copy link
Member

indeed!

@dom96 dom96 added the Severe label Oct 4, 2018
@dom96
Copy link
Contributor

dom96 commented Oct 4, 2018

Marking as high priority because it affects Nimble in a pretty bad way.

@LemonBoy
Copy link
Contributor

LemonBoy commented Oct 4, 2018

The problem here is that we get a circular dependency we have to break somehow:
moduleGraphs cannot include passes because it includes reorder that in turn includes moduleGraphs.
We may:

  • Move the "base" types and routines into another module
  • Move processModule somewhere else
  • Move the type definitions to moduleGraphs
  • Make reorder a proper pass that runs before everything else (this means you lose the per-module granularity unless you add a filtering system an so on)

CC @Araq, choose your favourite option

@Araq
Copy link
Member

Araq commented Oct 9, 2018

I pick "Move the type definitions to moduleGraphs"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants