-
Notifications
You must be signed in to change notification settings - Fork 68
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
Fewer anonymous funcs and despecialize inference #2131
base: main
Are you sure you want to change the base?
Conversation
Benchmark Results
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
src/utils.jl
Outdated
|
||
define i64 @f({} addrspace(10)* %obj) readnone alwaysinline { | ||
%c = addrspacecast {} addrspace(10)* %obj to {} addrspace(11)* | ||
%r = call {}* @julia.pointer_from_objref({} addrspace(11)* %c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh? Doesn't this break code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
surprisingly no (I mean this is what the implementation is supposed to do anyways) and now we don't have a cfunction ptr we have to ccall
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should just use Base.unsafe_pointer_to_objref
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was some reason historically why that wasn’t possible, eg some types saying that wasn’t valid for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed that my brain read something correctly
unsafe_pointer_to_objref(x::Ptr) = ccall(:jl_value_ptr, Any, (Ptr{Cvoid},), x
function pointer_from_objref(@nospecialize(x))
@inline
ismutable(x) || error("pointer_from_objref cannot be used on immutable objects")
ccall(:jl_value_ptr, Ptr{Cvoid}, (Any,), x)
en
So unsafe_pointer_from_objref(x) = ccall(:jl_value_ptr, Ptr{Cvoid}, (Any,), x)
@@ -1,6 +1,6 @@ | |||
# For julia runtime function emission | |||
|
|||
function emit_allocobj!( | |||
Base.@nospecializeinfer function emit_allocobj!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we import Base: @nospecializeinfer
?
src/compiler/validation.jl
Outdated
for lbb in blocks(initfn), linst in collect(instructions(lbb)) | ||
for lbb in blocks(initfn) | ||
liter = LLVM.API.LLVMGetFirstInstruction(lbb) | ||
while liter != C_NULL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not simply for linst in instructions(lbb)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm will look at, elsewhere it is required because we may delete the present instruction (so this is akin to the pre increment iterator in llvm)
|
||
const swiftself_kind = enum_attr_kind("swiftself") | ||
|
||
Base.@assume_effects :removable :foldable :nothrow function has_swiftself(fn::LLVM.Function)::Bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why those effects? We shouldn't add them to every function, and I kinda doubt they apply here or are useful?
@@ -81,7 +81,7 @@ end | |||
export unsafe_to_ptr | |||
|
|||
# This mimicks literal_pointer_val / literal_pointer_val_slot | |||
function unsafe_to_llvm(B::LLVM.IRBuilder, @nospecialize(val))::LLVM.Value | |||
Base.@nospecializeinfer function unsafe_to_llvm(B::LLVM.IRBuilder, @nospecialize(val))::LLVM.Value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do all these @nospecializeinfer
actually do anything?
No description provided.