forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpaqueClosure - Runtime & Codegen only (JuliaLang#39023)
This is JuliaLang#37849 modulo inference/optimization support. This is self-contained and the functionality tests pass, though the tests testing for various optimizations of course don't (they're marked as test_broken).
- Loading branch information
1 parent
b06af8d
commit f04931a
Showing
28 changed files
with
827 additions
and
105 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,4 +252,7 @@ function show_error_hints(io, ex, args...) | |
end | ||
end | ||
|
||
# OpaqueClosure | ||
include("opaque_closure.jl") | ||
|
||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
function show(io::IO, oc::Core.OpaqueClosure) | ||
A, R = typeof(oc).parameters | ||
show_tuple_as_call(io, Symbol(""), A; hasfirst=false) | ||
print(io, "::", R) | ||
print(io, "->◌") | ||
end | ||
|
||
function show(io::IO, ::MIME"text/plain", oc::Core.OpaqueClosure{A, R}) where {A, R} | ||
show(io, oc) | ||
end | ||
|
||
""" | ||
@opaque (args...) -> body | ||
Marks a given closure as "opaque". Opaque closures capture the | ||
world age of their creation (as opposed to their invocation). | ||
This allows for more aggressive optimization of the capture | ||
list, but trades off against the ability to inline opaque | ||
closures at the call site, if their creation is not statically | ||
visible. | ||
!!! warning | ||
This interface is experimental and subject to change or removal without notice. | ||
""" | ||
macro opaque(ex) | ||
esc(Expr(:opaque_closure, ex)) | ||
end |
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
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
Oops, something went wrong.