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

settings.sourcepath redirected to Ysourcepath #4

Conversation

VladUreche
Copy link

settings.sourcepath redirected to Ysourcepath
checkin build: https://scala-webapps.epfl.ch/jenkins/job/scala-checkin-manual/79/console

Review by @dragos.

@xeno-by
Copy link
Member

xeno-by commented Jun 6, 2012

Integrated your changes from fa2015f into pullrequest/reflection. Could you, please, submit the upcoming stuff (if any) against pullrequest/reflection (it's been updated today, so I can't merge cleanly the patches that are made against yesterday's version)?

@xeno-by xeno-by closed this Jun 6, 2012
@VladUreche
Copy link
Author

@retronym: There are two sides to the compatibility problem: the command line options and the internal settings.sourcepath.

The -sourcepath command-line option and the sourcepath in the scaladoc ant task point to the doc-source-path as they should, but add a deprecation warning. Same thing for scalac, -sourcepath points to -Ysourcepath + warning.

On the other hand I'm not sure what to do about the settings.sorucepath, which may be used by external programs in both the scalac and scaladoc context. That's why I opted for immediately throwing an exception, so everyone updates their use of sourcepath to either Ysourcepath of docSourcePath. But now it's wired to Ysorucepath and theoretically we could rewire it to docSorucePath for scaladoc settings. What's your take on that?

@xeno-by: Sorry I didn't know what branch to file the pull request against. I'll send pull reqs against pullrequest/reflection from now on.

@dragos
Copy link

dragos commented Jun 7, 2012

Can you explain shortly why we need two different source paths, and why 'sourcepath' should go? If we needed a second one, isn't it easier to simply add it, and leave the old one in place, with the previous semantics?

@VladUreche
Copy link
Author

@dragos: We basically had two semantics added to sourcepath and we actually wanted to use either one or the other, but not both at the same time. The motivation to remove sourcepath came when the scaladoc for the reflection build started failing because we used -sourcepath as -doc-source-path but at the same time the typer picked up the option as "please bootstrap the library" -- and the typer was failing while bootstrapping.
The cleanest solution was to isolate Ysourcepath for bootstrapping and -doc-source-path for generating links to github in scaladoc and make anything that used sourcepath before fail quickly so the programmers adjust to either of the options.

@dragos
Copy link

dragos commented Jun 7, 2012

Shouldn't we have a 'bootstrap the library' option then? sourcepath is a perfectly legitimate option to pass when building any project, not just the library... What is the special thing that made it fail in the reflection scenario?

@VladUreche
Copy link
Author

-Ysourcepath now means bootstrap the library. I don't understand why you would pass -sourcepath to any project unless you want to bootstrap it.

@dragos
Copy link

dragos commented Jun 7, 2012

sourcepath lets the compiler choose, for a given class, whether to use the binary or the source, based on the timestamp. It's essential for performance and correctness in the presentation compiler. It's the way it always worked. What exactly means to 'bootstrap' the library? What's the special treatment there? What is the different meaning that -Ysourcepath has now?

@VladUreche
Copy link
Author

Now I see that there was a third player in the -sourcepath world: the presentation compiler, which gives its own semantic :)) I didn't know it's also used in the presentation compiler. So, currently, -Ysourcepath maintains the semantics -sourcepath had before in the case of the compiler (and I assume also the presentation compiler). You can continue using the -sourcepath and settings.sourcepath -- it's just going to issue deprecation warnings and encourage you to switch over to -Ysourcepath.

I think it would make sense to disambiguate between scalac's -Ysourcepath and the presentation compiler's date-driven -sourcepath, so all three semantically-different options are clearly separated. What do you think?

@dragos
Copy link

dragos commented Jun 7, 2012

Hm, the presentation compiler relies on the standard compiler semantics of sourcepath (prefer source files over classfiles if they are newer).

1 similar comment
@dragos
Copy link

dragos commented Jun 7, 2012

Hm, the presentation compiler relies on the standard compiler semantics of sourcepath (prefer source files over classfiles if they are newer).

odersky added a commit that referenced this pull request Jul 20, 2012
broke out findMembers as a separate operation to streamline the code. findMember itself still needs to be optimized.
xeno-by added a commit that referenced this pull request Feb 2, 2013
First of all, GIL should only apply to runtime reflection, because noone
is going to run toolboxes in multiple threads: a) that's impossible, b/c
the compiler isn't thread safe, b) ToolBox api prevents that.

Secondly, the only things in symbols which require synchronization are:
1) info/validTo (completers aren't thread-safe),
2) rawInfo and its dependencies (it shares a mutable field with info)
3) non-trivial caches like in typeAsMemberOfLock

If you think about it, other things like sourceModule or associatedFile
don't need synchronization, because they are either set up when a symbol
is created or cloned or when it's completed.

We can say that symbols can be in four possible states: 1) being created,
2) created, but not yet initialized, 3) initializing, 4) initialized.
single thread. #2 and #4 don't need synchronization either, because the
only mutation symbols in runtime reflection can undergo is init. #3 is
dangerous and needs protection.
xeno-by added a commit that referenced this pull request Feb 2, 2013
First of all, GIL should only apply to runtime reflection, because noone
is going to run toolboxes in multiple threads: a) that's impossible, b/c
the compiler isn't thread safe, b) ToolBox api prevents that.

Secondly, the only things in symbols which require synchronization are:
1) info/validTo (completers aren't thread-safe),
2) rawInfo and its dependencies (it shares a mutable field with info)
3) non-trivial caches like in typeAsMemberOfLock

If you think about it, other things like sourceModule or associatedFile
don't need synchronization, because they are either set up when a symbol
is created or cloned or when it's completed.

We can say that symbols can be in four possible states: 1) being created,
2) created, but not yet initialized, 3) initializing, 4) initialized.
single thread. #2 and #4 don't need synchronization either, because the
only mutation symbols in runtime reflection can undergo is init. #3 is
dangerous and needs protection.
xeno-by added a commit that referenced this pull request Feb 6, 2013
First of all, GIL should only apply to runtime reflection, because noone
is going to run toolboxes in multiple threads: a) that's impossible, b/c
the compiler isn't thread safe, b) ToolBox api prevents that.

Secondly, the only things in symbols which require synchronization are:
1) info/validTo (completers aren't thread-safe),
2) rawInfo and its dependencies (it shares a mutable field with info)
3) non-trivial caches like in typeAsMemberOfLock

If you think about it, other things like sourceModule or associatedFile
don't need synchronization, because they are either set up when a symbol
is created or cloned or when it's completed.

We can say that symbols can be in four possible states: 1) being created,
2) created, but not yet initialized, 3) initializing, 4) initialized.
single thread. #2 and #4 don't need synchronization either, because the
only mutation symbols in runtime reflection can undergo is init. #3 is
dangerous and needs protection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants