-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Change the order of compilation passes, transformation is made lazy at code gen #8489
Conversation
Sure, but it already fails at bootstrapping and that's usually easy enough to test locally. ;-) |
This now bootstrap's compiler. |
|
Could you please review this change? Is it the release that blocks the review, in this it can wait? |
I reviewed it, it's mostly fine but |
I have merged the conflicts, ready for review. There is one problem, travis has failed with error that seems related to my change. But I can't replicate it on any of my machines. Need help to progress, can't travis give at least stack trace of the problem's location? Can somesome try on their linux desks and say where is the problem if any? Much appreciated. |
The failure is:
|
Now fails with |
Ready for review. I had to add silly |
@@ -30,6 +30,11 @@ proc checkConstructedType*(conf: ConfigRef; info: TLineInfo, typ: PType) = | |||
localError(conf, info, "type 'var var' is not allowed") | |||
elif computeSize(conf, t) == szIllegalRecursion: | |||
localError(conf, info, "illegal recursion in type '" & typeToString(t) & "'") | |||
|
|||
t = typ.skipTypes({tyGenericInst}) | |||
if t.kind == tyArray and tfUncheckedArray in t.flags: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tyUncheckedArray
here?
@@ -145,7 +145,7 @@ else: | |||
else: | |||
dec gTicker | |||
|
|||
proc hook(st: StackTrace) {.nimcall.} = | |||
proc hook(st: StackTrace) {.nimcall locks: 0.} = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: use a comma here.
That's not good but we'll find a better solution for this later. :-) |
…t code gen (nim-lang#8489) * Ast no transformation * Add getImplNoTransform to the macros module * progress on delaying transf * Fix methods tranformation * Fix lazy lambdalifting * fix create thread wrapper * transform for lambda lifting * improve getImplTransformed * Fix destructor tests * try to fix nimprof for linux
@@ -237,6 +237,10 @@ else: # bootstrapping substitute | |||
else: | |||
n.strValOld | |||
|
|||
when defined(nimSymImplTransform): | |||
proc getImplTransformed*(symbol: NimNode): NimNode {.magic: "GetImplTransf", noSideEffect.} | |||
## for a typed proc returns the AST after transformation pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To this day, there is not a single test for this proc in the entire test suite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing it in 14924
Ready for the first review.
Original goal was to make
getImpl
return semantically checked AST but before transf pass.Transformations can change regularly (examples: closure iterators and destructors) and user does not need to know about them. I have added
getImplTransformed
for backwards compatibility, in case someone needs it and requires time to migrate.Performance numbers are actually pleasing:
Running koch boot -d:release second time (no invocation of c compiler).
Before:
After:
I have noticed much bigger performance improvements for projects importing a lot but using a little. Quite common these days. Nim compiler is not one of them.
I also noticed startup time for nimsuggest improved.
P.S.
I have made also a good progress to reorder transf and lambdalifting passes, almost everything works
except closure iterators work. Changes in this PRs are required to make it happen anyway, it is easier
to split the work and unblock my project.