The goal of this gist is to make find_library lazy, so that it is more efficient, general/generic, and runtime-intelligent. These changes will be pervasive to also making ccall and dlopen more flexible.
function find_library(...) ->
| # This stripped down example that has odd performance. | |
| # It takes about 4 seconds to compile and allocates about 550MB of memory | |
| type T1Type | |
| f1::Float64 | |
| end | |
| T1Type() = T1Type( | |
| 0.0) | |
| type Ts | |
| T1::T1Type |
| // envtest.cpp : Defines the entry point for the console application. | |
| // | |
| #include <windows.h> | |
| #include <tchar.h> | |
| #include <stdio.h> | |
| int _tmain() | |
| { | |
| --- xianyi-OpenBLAS-347dded/exports/gensymbol 2014-06-10 09:55:47.000000000 -0400 | |
| +++ openblas-v0.2.9/exports/gensymbol 2014-06-21 19:27:06.368557354 -0400 | |
| @@ -81,6 +81,8 @@ | |
| @misc_no_underscore_objs = ( | |
| goto_set_num_threads, | |
| openblas_get_config, | |
| + gotoblas_init, | |
| + gotoblas_quit, | |
| ); | |
The goal of this gist is to make find_library lazy, so that it is more efficient, general/generic, and runtime-intelligent. These changes will be pervasive to also making ccall and dlopen more flexible.
function find_library(...) ->
| # some definitions: | |
| immutable NArgsOut{N} | |
| NArgsOut() = ((isa(N,Int) && N>=-1) || error("nargsout must be ≥ -1"); new()) | |
| end | |
| nargsout(N::Integer) = NArgsOut{int(N)}() | |
| # null behavior example: | |
| f(::NArgsOut{-1}) = f() # -1 is a sentinal value and should have no effect on the output |
ref: JuliaLang/julia#7633 (comment)
type ExceptionData <: Exception
error::Exception
backtrace::Array{Any}
end
ExceptionData(err) = ExceptionData(err, {})| ~/Documents/no-backup/julia/base$ lldb -- ../usr/bin/julia-debug --build x sysimg.jl | |
| Current executable set to '../usr/bin/julia-debug' (x86_64). | |
| (lldb) break set -n jl_throw | |
| Breakpoint 1: no locations (pending). | |
| WARNING: Unable to resolve breakpoint to any actual locations. | |
| (lldb) r | |
| Process 10078 launched: '../usr/bin/julia-debug' (x86_64) | |
| 1 location added to breakpoint 1 | |
| exports.jl | |
| base.jl |
| # BEFORE: | |
| function PolynomialRing{T <: Ring}(::Type{T}, s::String) | |
| S = symbol(s) | |
| T1 = Poly{T, S} | |
| T2 = T | |
| # Conversions and promotions | |
| eval(:(Base.convert(::Type{$T1}, x::$T) = Poly($T1, [x]))) | |
| eval(:(Base.promote_rule(::Type{$T1}, ::Type{$T}) = $T1)) |
cfunction lambda can be created in the following fashion:
jl_apply_generic(%R9, args, nargs)movq $fptr %R9; movq $lambda, %RAX; jmp %RAX%jl_value_t = type { %jl_value_t* }
declare void @jl_throw_with_superfluous_argument(%jl_value_t*, i32)
@jl_domain_exception = external global %jl_value_t*
define double @julia_gv_67043(i64) {
top:
%1 = call double inttoptr (i64 339752784 to double (double, double)*)(double 1.000000e+00, double 0.000000e+00)
%2 = sitofp i64 %0 to double
%3 = call double inttoptr (i64 339772768 to double (double, double)*)(double %1, double %2)