Skip to content

Fix/phases etc #97

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

Closed
wants to merge 6 commits into from
Closed

Fix/phases etc #97

wants to merge 6 commits into from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Mar 26, 2014

This contains the core fixes for phases and denotation transformers to unblock Dmitry and Tobias

@odersky
Copy link
Contributor Author

odersky commented Mar 26, 2014

Review by @DarkDimius @gzm0

@gzm0
Copy link
Contributor

gzm0 commented Mar 26, 2014

That's all

@@ -329,8 +329,8 @@ object Contexts {

def withProperty(prop: (String, Any)): this.type = withMoreProperties(moreProperties + prop)

override def withPhase(pid: PhaseId): this.type = withPeriod(Period(runId, pid))
override def withPhase(phase: Phase): this.type = withPhase(phase.id)
def withNewPhase(pid: PhaseId): this.type = withPeriod(Period(runId, pid))
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer to have all methods in this class start with "set" instead of "with"(as in #98). It will clearly indicate that there will be mutation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Let's do this, and at the same time rename all withNewXYZ methods in FreshContext to WithXYZ.

@odersky
Copy link
Contributor Author

odersky commented Mar 26, 2014

I think we all agree on the finishing touches and that we want to combine with the with...->set... renamings. Who wants to take the lead on this?

@DarkDimius
Copy link
Contributor

I've already done them in #98 , I'll make them rebased on this branch once again.

@odersky odersky closed this Mar 26, 2014
@odersky odersky reopened this Mar 26, 2014
@odersky
Copy link
Contributor Author

odersky commented Mar 26, 2014

@DarkDimius OK. Can you also shepard this PR? Thanks!

@DarkDimius
Copy link
Contributor

Ok, I will.
Regarding stillValid: maybe rename it to isValidInThisRun ?

@gzm0
Copy link
Contributor

gzm0 commented Mar 27, 2014

I don't see why putting the run test inside stillValid is a big overhead. Of course we'll have to add it as a shortcut so we don't recursively descend into other symbols.

IMHO doing so is a small cost for the simplification of the contract ("is this valid" v.s. "is this valid, given we are not in the run this denotation originated from").

odersky and others added 5 commits March 27, 2014 12:37
Aims

1) next/prev should be context-independent. Phase now stores
its ContextBase in a field.

2) More robust handling of phaseNamed and the phase properties
erasedTypes, flattened, refchecked, etc. These were previously
dependent on when the first call to any of these methods was made, which
led to a data race.

There is now an init method in phases which centralizes all necessary intialization.
It is checked that a phase is initialized only once.
Aim: Avoid expensive scanning of definitions in denotations other than the initial one.

Technique:

1. If phase is erased, type params is Nil (except for Array class)
2. Otherwise, type params is the same as it was in initial phase.
Previous version was wrong because every context is a fresh context at runtime,
so the overriding version would always be executed, which means that withPhase
becomes a side-effecting operation!
The logic for dealing with periods in denotation histories did not
correctly take into account the case where the current validity period of
a denotation ends some phases before the next type transformer starts.

And there was an off-by-one error in startPid.

And Types#computeDenot erroneously tried to reload denotations even
the run did not change.
@DarkDimius
Copy link
Contributor

@odersky @gzm0 please have a look.

@gzm0
Copy link
Contributor

gzm0 commented Mar 27, 2014

LGTM

This was referenced Mar 27, 2014
@DarkDimius
Copy link
Contributor

merged as part of #100

@DarkDimius DarkDimius closed this Mar 27, 2014
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.

3 participants