-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use jl_filename/jl_lineno less (#53799)
I don't like `jl_filename`/`jl_lineno`. They are weird internal state, and they are also not thread safe, so if different threads are evaling different things at the same time, line numbers can get confused. This PR changes the core function `jl_toplevel_eval_flex` to keep track of its current file/line context on the stack, so at least there is no confusion within one call to this function. With this PR and #53797, the global `jl_filename`/`jl_lineno` are used for three purposes: 1. To initialize the filename/lineno used by lowering from `Core.eval`. 2. To give binding deprecation warnings. 3. For `jl_critical_error`. 4. By humans in the debugger. I think 3 and 4 are fine, they are exceptional cases. Case 2, I think could be changed to plumb through locations explicitly, but it's a bit annoying, so I didn't tackle it here. Case 1, I think can probably just be changed to consistently initialize, and if you want a proper line number, you need to put it in there explicitly. However, I didn't change that in this PR, because I think it could be slightly breaking, so should be pkgeval'd.
- Loading branch information
Showing
3 changed files
with
53 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters