Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Aug 27, 2021
1 parent 8477a04 commit 5a6a960
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}

Expand Down Expand Up @@ -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();
Expand Down
15 changes: 0 additions & 15 deletions src/jitlayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,6 @@ void jl_jit_globals(std::map<void *, GlobalVariable*> &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),
Expand Down
3 changes: 2 additions & 1 deletion src/jl_exported_data.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
9 changes: 1 addition & 8 deletions src/jl_exported_funcs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -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) \
Expand Down
15 changes: 15 additions & 0 deletions src/jlapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion src/support/win32_ucontext.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5a6a960

Please sign in to comment.