From e678e673527046b77dd5a88e768a3f5fc9448d31 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Tue, 28 Mar 2017 10:33:51 +0200 Subject: [PATCH 1/2] ensure ShellExecuteW only gets compiled on windows rather than depending on DCE to delete this code after inference --- base/interactiveutil.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/base/interactiveutil.jl b/base/interactiveutil.jl index 1d569265a3773..12663bb92363a 100644 --- a/base/interactiveutil.jl +++ b/base/interactiveutil.jl @@ -61,9 +61,10 @@ function edit(path::AbstractString, line::Integer=0) end if is_windows() && name == "open" - systemerror(:edit, ccall((:ShellExecuteW,"shell32"), stdcall, Int, - (Ptr{Void}, Cwstring, Cwstring, Ptr{Void}, Ptr{Void}, Cint), - C_NULL, "open", path, C_NULL, C_NULL, 10) ≤ 32) + @static is_windows() && # don't emit this ccall on other platforms + systemerror(:edit, ccall((:ShellExecuteW, "shell32"), stdcall, Int, + (Ptr{Void}, Cwstring, Cwstring, Ptr{Void}, Ptr{Void}, Cint), + C_NULL, "open", path, C_NULL, C_NULL, 10) ≤ 32) elseif background spawn(pipeline(cmd, stderr=STDERR)) else From a159ac568473b65575aea4b5f57a2ba97626ca92 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Tue, 28 Mar 2017 10:34:47 +0200 Subject: [PATCH 2/2] dump: ensure jlcall_api is cleared if we don't load the fptr from the sysimg --- src/dump.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/dump.c b/src/dump.c index 64d21ee2e04a0..6e87b833a68f9 100644 --- a/src/dump.c +++ b/src/dump.c @@ -422,7 +422,15 @@ static void jl_update_all_fptrs(void) { //jl_printf(JL_STDOUT, "delayed_fptrs_n: %d\n", delayed_fptrs_n); void **fvars = sysimg_fvars; - if (fvars == 0) return; + if (fvars == NULL) { + size_t i; + for (i = 0; i < delayed_fptrs_n; i++) { + jl_method_instance_t *li = delayed_fptrs[i].li; + assert(li->jlcall_api && li->jlcall_api != 2); + li->jlcall_api = 0; + } + return; + } // jl_fptr_to_llvm needs to decompress some ASTs, therefore this needs to be NULL // to skip trying to restore GlobalVariable pointers in jl_deserialize_gv sysimg_gvars = NULL; @@ -431,7 +439,7 @@ static void jl_update_all_fptrs(void) jl_method_instance_t **linfos = (jl_method_instance_t**)malloc(sizeof(jl_method_instance_t*) * sysimg_fvars_max); for (i = 0; i < delayed_fptrs_n; i++) { jl_method_instance_t *li = delayed_fptrs[i].li; - assert(li->def); + assert(li->def && li->jlcall_api && li->jlcall_api != 2); int32_t cfunc = delayed_fptrs[i].cfunc - 1; if (cfunc >= 0) { jl_fptr_to_llvm((jl_fptr_t)fvars[cfunc], li, 1);