Skip to content

Instantly share code, notes, and snippets.

/-

Created October 30, 2015 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/7e083009a110666331ba to your computer and use it in GitHub Desktop.
Save anonymous/7e083009a110666331ba to your computer and use it in GitHub Desktop.
commit 8307c6dca1355a619ee4fb478b6cc6b79a4831f5
Merge: ede6818 eaf6115
Author: Jameson Nash <vtjnash@gmail.com>
Date: Fri Oct 30 13:59:57 2015 -0400
Merge branch 'jn/threading'
diff --cc src/builtins.c
index 23c2f69,751a9ff..00aeb92
--- a/src/builtins.c
+++ b/src/builtins.c
@@@ -975,10 -989,11 +977,11 @@@ static int jl_eval_inner_with_compiler(
return 0;
}
-void jl_trampoline_compile_function(jl_function_t *f, int always_infer, jl_tupletype_t *sig)
+void jl_trampoline_compile_linfo(jl_lambda_info_t *linfo, int always_infer)
{
+ JL_LOCK(codegen)
- assert(sig);
- assert(f->linfo != NULL);
+ assert(linfo);
+ assert(linfo->specTypes);
// to run inference on all thunks. slows down loading files.
// NOTE: if this call to inference is removed, type_annotate in inference.jl
// needs to be updated to infer inner functions.
@@@ -1000,11 -1015,16 +1003,12 @@@
}
}
}
- jl_compile(f);
- // this assertion is probably not correct; the fptr could have been assigned
- // by a recursive invocation from inference above.
- //assert(f->fptr == &jl_trampoline);
- jl_generate_fptr(f);
- if (jl_boot_file_loaded && jl_is_expr(f->linfo->ast)) {
- f->linfo->ast = jl_compress_ast(f->linfo, f->linfo->ast);
- jl_gc_wb(f->linfo, f->linfo->ast);
+ jl_compile_linfo(linfo);
+ if (jl_boot_file_loaded && jl_is_expr(linfo->ast)) {
+ linfo->ast = jl_compress_ast(linfo, linfo->ast);
+ jl_gc_wb(linfo, linfo->ast);
}
+ JL_UNLOCK(codegen)
}
JL_CALLABLE(jl_trampoline)
diff --cc src/codegen.cpp
index e0b9f70,8bc54c1..0ed0443
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@@ -1122,10 -956,12 +1128,11 @@@ extern "C" void jl_generate_fptr(jl_fun
JL_SIGATOMIC_END();
}
f->fptr = li->fptr;
+ JL_UNLOCK(codegen)
}
-extern "C" void jl_compile(jl_function_t *f)
+extern "C" void jl_compile_linfo(jl_lambda_info_t *li)
{
- jl_lambda_info_t *li = f->linfo;
if (li->functionObject == NULL) {
// objective: assign li->functionObject
li->inCompile = 1;
diff --cc src/init.c
index 4c9283a,6bdc28c..8bdc2a4
--- a/src/init.c
+++ b/src/init.c
@@@ -587,8 -616,13 +609,11 @@@ void _julia_init(JL_IMAGE_SEARCH rel
if (jl_base_module != NULL) {
jl_add_standard_imports(jl_main_module);
}
- // eval() uses Main by default, so Main.eval === Core.eval
- jl_module_import(jl_main_module, jl_core_module, jl_symbol("eval"));
jl_current_module = jl_main_module;
- jl_root_task->current_module = jl_current_module;
+ int t;
+ for(t=0; t < jl_n_threads; t++) {
+ (*jl_all_task_states[t].proot_task)->current_module = jl_current_module;
+ }
if (jl_options.handle_signals == JL_OPTIONS_HANDLE_SIGNALS_ON)
jl_install_default_signal_handlers();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment