Skip to content
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

optimize primary constructors of Core types #9731

Merged
merged 1 commit into from
Jan 13, 2015
Merged

optimize primary constructors of Core types #9731

merged 1 commit into from
Jan 13, 2015

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Jan 11, 2015

this allows julia to optimize the Core type constructors

julia> f() = TopNode(:asdf)
f (generic function with 1 method)

julia> code_typed(f,())
1-element Array{Any,1}:
 :($(Expr(:lambda, Any[], Any[Any[],Any[],Any[]], :(begin  # none, line 1:
        return $(Expr(:new, :TopNode, :(:asdf)))
    end::TopNode))))

julia> code_llvm(f,())

define %jl_value_t* @julia_f_42804() {
top:
  %0 = call %jl_value_t* @allocobj(i64 16), !dbg !642
  %1 = getelementptr inbounds %jl_value_t* %0, i64 0, i32 0, !dbg !642
  store %jl_value_t* inttoptr (i64 19729664 to %jl_value_t*), %jl_value_t** %1, align 8, !dbg !642
  %2 = getelementptr inbounds %jl_value_t* %0, i64 1, i32 0, !dbg !642
  store %jl_value_t* inttoptr (i64 140523989960712 to %jl_value_t*), %jl_value_t** %2, align 8, !dbg !642
  ret %jl_value_t* %0, !dbg !642
}

julia> f(x) = GotoNode(x)
f (generic function with 2 methods)

julia> f(2)
:(goto 2)

julia> code_llvm(f,(Int,))

define %GotoNode @julia_f_42866(i64) {
top:
  %1 = insertvalue %GotoNode undef, i64 %0, 0, !dbg !822, !julia_type !824
  ret %GotoNode %1, !dbg !822
}

@JeffBezanson
Copy link
Member

+1

vtjnash added a commit that referenced this pull request Jan 13, 2015
optimize primary constructors of Core types
@vtjnash vtjnash merged commit a9f526e into master Jan 13, 2015
@vtjnash vtjnash deleted the jn/boot_new branch January 13, 2015 03:42
@vtjnash
Copy link
Member Author

vtjnash commented Jan 13, 2015

i'll take that as a signal that this can be merged then (since CI finished now too)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants