From 5a6a96044102bac94efdd818146f4a238008169b Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Thu, 26 Aug 2021 18:53:29 -0400 Subject: [PATCH] wip --- src/Makefile | 2 +- src/codegen.cpp | 5 ++--- src/jitlayers.cpp | 15 --------------- src/jl_exported_data.inc | 3 ++- src/jl_exported_funcs.inc | 9 +-------- src/jlapi.c | 15 +++++++++++++++ src/julia.h | 2 +- src/support/win32_ucontext.c | 2 +- 8 files changed, 23 insertions(+), 30 deletions(-) diff --git a/src/Makefile b/src/Makefile index 6abdff085f54ce..e2f403a058d04f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -139,7 +139,7 @@ endif COMMON_LIBPATHS := -L$(build_libdir) -L$(build_shlibdir) RT_LIBS := $(LIBUV) $(LIBUTF8PROC) $(NO_WHOLE_ARCHIVE) $(RT_LLVMLINK) $(LIBUNWIND) $(OSLIBS) -CG_LIBS := $(NO_WHOLE_ARCHIVE) $(LIBUNWIND) $(CG_LLVMLINK) $(OSLIBS) +CG_LIBS := $(NO_WHOLE_ARCHIVE) $(LIBUV) $(LIBUNWIND) $(CG_LLVMLINK) $(OSLIBS) RT_DEBUG_LIBS := $(COMMON_LIBPATHS) $(WHOLE_ARCHIVE) $(BUILDDIR)/flisp/libflisp-debug.a $(WHOLE_ARCHIVE) $(BUILDDIR)/support/libsupport-debug.a -ljulia-debug $(RT_LIBS) CG_DEBUG_LIBS := $(COMMON_LIBPATHS) $(WHOLE_ARCHIVE) $(WHOLE_ARCHIVE) $(BUILDDIR)/support/libsupport-debug.a -ljulia-debug $(CG_LIBS) RT_RELEASE_LIBS := $(COMMON_LIBPATHS) $(WHOLE_ARCHIVE) $(BUILDDIR)/flisp/libflisp.a $(WHOLE_ARCHIVE) $(BUILDDIR)/support/libsupport.a -ljulia $(RT_LIBS) diff --git a/src/codegen.cpp b/src/codegen.cpp index de8a0732067b51..32b23c8bebce63 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -858,14 +858,13 @@ static int globalUnique = 0; // --- code generation --- extern "C" { - int jl_default_debug_info_kind = (int) DICompileUnit::DebugEmissionKind::FullDebug; jl_cgparams_t jl_default_cgparams = {1, 1, 0, #ifdef _OS_WINDOWS_ 0, #else 1, #endif - jl_default_debug_info_kind, + (int) DICompileUnit::DebugEmissionKind::FullDebug, jl_rettype_inferred, NULL }; } @@ -8070,7 +8069,7 @@ void jl_init_debuginfo(void); extern "C" void jl_init_llvm(void) { - jl_page_size = jl_getpagesize(); + jl_default_debug_info_kind = (int) DICompileUnit::DebugEmissionKind::FullDebug; imaging_mode = jl_options.image_codegen || (jl_generating_output() && !jl_options.incremental); jl_default_cgparams.generic_context = jl_nothing; jl_init_debuginfo(); diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp index 2943c8872438d2..e7cd032ca6e21c 100644 --- a/src/jitlayers.cpp +++ b/src/jitlayers.cpp @@ -73,21 +73,6 @@ void jl_jit_globals(std::map &globals) } } -extern "C" JL_DLLEXPORT -uint64_t jl_cumulative_compile_time_ns_before() -{ - // Increment the flag to allow reentrant callers to `@time`. - jl_atomic_fetch_add(&jl_measure_compile_time_enabled, 1); - return jl_atomic_load_relaxed(&jl_cumulative_compile_time); -} -extern "C" JL_DLLEXPORT -uint64_t jl_cumulative_compile_time_ns_after() -{ - // Decrement the flag when done measuring, allowing other callers to continue measuring. - jl_atomic_fetch_add(&jl_measure_compile_time_enabled, -1); - return jl_atomic_load_relaxed(&jl_cumulative_compile_time); -} - // this generates llvm code for the lambda info // and adds the result to the jitlayers // (and the shadow module), diff --git a/src/jl_exported_data.inc b/src/jl_exported_data.inc index 59cbe03e7c4ff0..c24cfb2a50e48d 100644 --- a/src/jl_exported_data.inc +++ b/src/jl_exported_data.inc @@ -264,7 +264,8 @@ XX(jl_processor_print_help, int8_t) \ XX(jl_measure_compile_time_enabled, uint8_t) \ XX(jl_cumulative_compile_time, uint64_t) \ - XX(jl_page_size, size_t) + XX(jl_page_size, size_t) \ + XX(jl_default_debug_info_kind, int) #define JL_EXPORTED_DATA_SYMBOLS_WIN(XX) \ XX(jl_in_stackwalk, jl_mutex_t) diff --git a/src/jl_exported_funcs.inc b/src/jl_exported_funcs.inc index f95ee84923051b..3305ddf85eb2a5 100644 --- a/src/jl_exported_funcs.inc +++ b/src/jl_exported_funcs.inc @@ -543,8 +543,6 @@ XX(jl_binding_deprecation_warning) \ XX(jl_special_vector_alignment) \ XX(jl_struct_try_layout) \ - XX(uv_os_get_passwd) \ - XX(uv_os_free_passwd) \ XX(jl_isabspath) \ XX(jl_nth_union_component) \ XX(jl_get_llvm_target) \ @@ -572,12 +570,7 @@ XX(jl_gc_classify_pools) \ XX(jl_get_llvm_clone_targets) \ XX(jl_format_filename) \ - XX(utf8proc_charwidth) \ - XX(uv_rwlock_wrlock) \ - XX(uv_rwlock_wrunlock) \ - XX(uv_rwlock_rdlock) \ - XX(uv_rwlock_rdunlock) \ - XX(uv_rwlock_init) + XX(utf8proc_charwidth) #define JL_RUNTIME_EXPORTED_FUNCS_WIN(XX) \ XX(jl_dlfind_win32) \ diff --git a/src/jlapi.c b/src/jlapi.c index 4851cebfe15d9a..54aa51c22c13c6 100644 --- a/src/jlapi.c +++ b/src/jlapi.c @@ -475,6 +475,21 @@ JL_DLLEXPORT void (jl_cpu_wake)(void) jl_cpu_wake(); } +extern "C" JL_DLLEXPORT +uint64_t jl_cumulative_compile_time_ns_before() +{ + // Increment the flag to allow reentrant callers to `@time`. + jl_atomic_fetch_add(&jl_measure_compile_time_enabled, 1); + return jl_atomic_load_relaxed(&jl_cumulative_compile_time); +} +extern "C" JL_DLLEXPORT +uint64_t jl_cumulative_compile_time_ns_after() +{ + // Decrement the flag when done measuring, allowing other callers to continue measuring. + jl_atomic_fetch_add(&jl_measure_compile_time_enabled, -1); + return jl_atomic_load_relaxed(&jl_cumulative_compile_time); +} + JL_DLLEXPORT void jl_get_fenv_consts(int *ret) { ret[0] = FE_INEXACT; diff --git a/src/julia.h b/src/julia.h index 44ee1e6f3402c7..4601f984567791 100644 --- a/src/julia.h +++ b/src/julia.h @@ -2119,7 +2119,7 @@ typedef struct { // generic_context(f, args...) instead of f(args...). jl_value_t *generic_context; } jl_cgparams_t; -extern JL_DLLEXPORT int jl_default_debug_info_kind; +extern JL_DLLIMPORT int jl_default_debug_info_kind; #ifdef __cplusplus } diff --git a/src/support/win32_ucontext.c b/src/support/win32_ucontext.c index df50eb209341ee..4ca20a9852937f 100644 --- a/src/support/win32_ucontext.c +++ b/src/support/win32_ucontext.c @@ -9,7 +9,7 @@ extern "C" { #endif -extern LONG WINAPI jl_exception_handler(struct _EXCEPTION_POINTERS *ExceptionInfo); +extern JL_DLLEXPORT LONG WINAPI jl_exception_handler(struct _EXCEPTION_POINTERS *ExceptionInfo); // Instead of using ntdll!_except_handler4, we call directly to our UnhandledExceptionFilter. // This seems to work better, since it's unclear if we have made a valid frame