Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f2f18e9
Update CodeInfo struct and handling
mlechu Mar 28, 2025
f00f160
Don't produce raw symbol from globalref
mlechu Mar 31, 2025
51cd5ec
Updates to const and global lowering; add K"constdecl"; omit `wrap`
mlechu Apr 1, 2025
f4c25b4
Add `isdefinedglobal` builtin
mlechu Apr 1, 2025
9cc1ae8
:global no longer valid_ir_argument; rm `is_defined_nothrow_global`
mlechu Apr 1, 2025
817fc3f
Fix `is_defined_and_owned_global` (Core.Binding changes)
mlechu Apr 17, 2025
34c2f7b
Struct desugaring: "Undo decision to publish incomplete types..."
mlechu Apr 1, 2025
a3289af
Emit `latestworld` world age increments
mlechu Apr 2, 2025
d20fecb
bpart changes: `Core._typebody!` signature
mlechu Apr 4, 2025
7b3ab31
bpart changes: struct desugaring
mlechu Apr 18, 2025
141e66d
Additional argument in `new_opaque_closure`
mlechu Apr 4, 2025
039627c
Adapt to different `GeneratedFunctionStub` signature
mlechu Apr 8, 2025
c5a8942
Fix `public` and `export`
mlechu Apr 8, 2025
e783612
Fix modules.jl test
mlechu Apr 8, 2025
3b26733
Regenerate IR tests
mlechu Apr 30, 2025
3c3a646
Update README to known-good julia, JuliaSyntax versions
mlechu Jun 25, 2025
a3d647d
Fix small bug from #16 so tests pass
mlechu Jul 29, 2025
6e2a2c4
Changes from code review: const/global lowering
mlechu Jul 30, 2025
85db358
Remove a special case
mlechu Jul 31, 2025
c92584c
Changes from code review
mlechu Aug 1, 2025
c5a1acd
Fix + test for assignment in value but not tail position
c42f Aug 4, 2025
8a52e0c
Disallow `static_parameter` as `valid_ir_argument`
mlechu Aug 4, 2025
89fdf02
Change printing of `K"latestworld"`
mlechu Aug 4, 2025
8e7bc39
Move most `latestworld`s to linearization
mlechu Aug 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ This work is intended to

Note this is a work in progress; many types of syntax are not yet handled.

1. You need a 1.12-DEV build of Julia: At least 1.12.0-DEV.512. Commit `263928f9ad4` is currentl known to work. Note that JuliaLowering relies on Julia internals and may be broken on the latest Julia dev version from time to time. (In fact it is currently broken on the latest `1.12-DEV`.)
2. Check out the main branch of [JuliaSyntax](https://github.com/JuliaLang/JuliaSyntax.jl)
1. You need a 1.13.0-DEV build of Julia: At least 1.13.0-DEV.880. Commit `5ebc5b463ea` is currently known to work. Note that JuliaLowering relies on Julia internals and may be broken on the latest Julia dev version from time to time.
2. Use commit `46723f0` of [JuliaSyntax](https://github.com/JuliaLang/JuliaSyntax.jl)
3. Get the latest version of [JuliaSyntaxFormatter](https://github.com/c42f/JuliaSyntaxFormatter.jl)
4. Run the demo `include("test/demo.jl")`

Expand Down
2 changes: 1 addition & 1 deletion src/ast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function makeleaf(ctx, srcref, k::Kind, value; kws...)
makeleaf(graph, srcref, k; id=value, kws...)
elseif k == K"symbolic_label"
makeleaf(graph, srcref, k; name_val=value, kws...)
elseif k == K"TOMBSTONE" || k == K"SourceLocation"
elseif k in KSet"TOMBSTONE SourceLocation latestworld latestworld_if_toplevel"
makeleaf(graph, srcref, k; kws...)
else
val = k == K"Integer" ? convert(Int, value) :
Expand Down
23 changes: 17 additions & 6 deletions src/closure_conversion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ function convert_global_assignment(ctx, ex, var, rhs0)
end
push!(stmts, @ast ctx ex [K"=" var rhs])
@ast ctx ex [K"block"
[K"globaldecl" var]
stmts...
rhs1
]
Expand Down Expand Up @@ -337,19 +338,27 @@ function _convert_closures(ctx::ClosureConversionCtx, ex)
elseif binfo.is_always_defined || is_self_captured(ctx, var)
# Captured but unboxed vars are always defined
@ast ctx ex true::K"Bool"
elseif binfo.kind == :global
# Normal isdefined won't work for globals (#56985)
@ast ctx ex [K"call"
"isdefinedglobal"::K"core"
ctx.mod::K"Value"
binfo.name::K"Symbol"
false::K"Bool"]
else
ex
end
elseif k == K"decl"
@assert kind(ex[1]) == K"BindingId"
binfo = lookup_binding(ctx, ex[1])
if binfo.kind == :global
@ast ctx ex [K"call"
"set_binding_type!"::K"core"
binfo.mod::K"Value"
binfo.name::K"Symbol"
_convert_closures(ctx, ex[2])
]
@ast ctx ex [K"block"
# flisp has this, but our K"assert" handling is in a previous pass
# [K"assert" "toplevel_only"::K"Symbol" [K"inert" ex]]
[K"globaldecl"
ex[1]
_convert_closures(ctx, ex[2])]
"nothing"::K"core"]
else
makeleaf(ctx, ex, K"TOMBSTONE")
end
Expand Down Expand Up @@ -382,6 +391,7 @@ function _convert_closures(ctx::ClosureConversionCtx, ex)
type_for_closure(ctx, ex, name_str, field_syms, field_is_box)
if !ctx.is_toplevel_seq_point
push!(ctx.toplevel_stmts, closure_type_def)
push!(ctx.toplevel_stmts, @ast ctx ex (::K"latestworld_if_toplevel"))
closure_type_def = nothing
end
closure_info = ClosureInfo(closure_type_, field_syms, field_inds)
Expand All @@ -406,6 +416,7 @@ function _convert_closures(ctx::ClosureConversionCtx, ex)
end
@ast ctx ex [K"block"
closure_type_def
(::K"latestworld_if_toplevel")
closure_type := if isempty(type_params)
closure_type_
else
Expand Down
Loading
Loading