Commit 86c567f
authored
This slightly improves our (LLVM) codegen for `Core.throw_methoderror`
and `Core.current_scope`
```julia
julia> foo() = Core.current_scope()
julia> bar() = Core.throw_methoderror(+, nothing)
```
Before:
```llvm
; Function Signature: foo()
define nonnull ptr @julia_foo_2488() #0 {
top:
%0 = call ptr @jl_get_builtin_fptr(ptr nonnull @"+Core.#current_scope#2491.jit")
%Builtin_ret = call nonnull ptr %0(ptr nonnull @"jl_global#2492.jit", ptr null, i32 0)
ret ptr %Builtin_ret
}
; Function Signature: bar()
define void @julia_bar_589() #0 {
top:
%jlcallframe1 = alloca [2 x ptr], align 8
%0 = call ptr @jl_get_builtin_fptr(ptr nonnull @"+Core.#throw_methoderror#591.jit")
%jl_nothing = load ptr, ptr @jl_nothing, align 8
store ptr @"jl_global#593.jit", ptr %jlcallframe1, align 8
%1 = getelementptr inbounds ptr, ptr %jlcallframe1, i64 1
store ptr %jl_nothing, ptr %1, align 8
%Builtin_ret = call nonnull ptr %0(ptr nonnull @"jl_global#592.jit", ptr nonnull %jlcallframe1, i32 2)
call void @llvm.trap()
unreachable
}
```
After:
```llvm
; Function Signature: foo()
define nonnull ptr @julia_foo_713() #0 {
top:
%thread_ptr = call ptr asm "movq %fs:0, $0", "=r"() #5
%tls_ppgcstack = getelementptr inbounds i8, ptr %thread_ptr, i64 -8
%tls_pgcstack = load ptr, ptr %tls_ppgcstack, align 8
%current_scope = getelementptr inbounds i8, ptr %tls_pgcstack, i64 -72
%0 = load ptr, ptr %current_scope, align 8
ret ptr %0
}
; Function Signature: bar()
define void @julia_bar_1581() #0 {
top:
%jlcallframe1 = alloca [2 x ptr], align 8
%jl_nothing = load ptr, ptr @jl_nothing, align 8
store ptr @"jl_global#1583.jit", ptr %jlcallframe1, align 8
%0 = getelementptr inbounds ptr, ptr %jlcallframe1, i64 1
store ptr %jl_nothing, ptr %0, align 8
%jl_f_throw_methoderror_ret = call nonnull ptr @jl_f_throw_methoderror(ptr null, ptr nonnull %jlcallframe1, i32 2)
call void @llvm.trap()
unreachable
}
```
1 parent 441bcd0 commit 86c567f
3 files changed
+15
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2444 | 2444 | | |
2445 | 2445 | | |
2446 | 2446 | | |
2447 | | - | |
| 2447 | + | |
2448 | 2448 | | |
2449 | 2449 | | |
2450 | 2450 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1619 | 1619 | | |
1620 | 1620 | | |
1621 | 1621 | | |
| 1622 | + | |
1622 | 1623 | | |
1623 | 1624 | | |
1624 | 1625 | | |
| |||
1644 | 1645 | | |
1645 | 1646 | | |
1646 | 1647 | | |
1647 | | - | |
| 1648 | + | |
| 1649 | + | |
1648 | 1650 | | |
1649 | 1651 | | |
1650 | 1652 | | |
| |||
2117 | 2119 | | |
2118 | 2120 | | |
2119 | 2121 | | |
| 2122 | + | |
2120 | 2123 | | |
2121 | 2124 | | |
2122 | 2125 | | |
| |||
4944 | 4947 | | |
4945 | 4948 | | |
4946 | 4949 | | |
| 4950 | + | |
| 4951 | + | |
| 4952 | + | |
| 4953 | + | |
| 4954 | + | |
| 4955 | + | |
| 4956 | + | |
| 4957 | + | |
4947 | 4958 | | |
4948 | 4959 | | |
4949 | 4960 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| 315 | + | |
315 | 316 | | |
316 | 317 | | |
317 | 318 | | |
| |||
0 commit comments