Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode link_id in tagged linkage #48673

Merged
merged 2 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4251,7 +4251,7 @@ static jl_cgval_t emit_invoke(jl_codectx_t &ctx, const jl_cgval_t &lival, const
bool cache_valid = ctx.use_cache;
bool external = false;
if (ctx.external_linkage) {
if (jl_object_in_image((jl_value_t*)codeinst)) {
if (0 && jl_object_in_image((jl_value_t*)codeinst)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intend to commit this part?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this code is broken, and I accidentally fixed the code that disabled it

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment or something then? Looks very weird to have that standing freely.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this code we won't link from package images to the system image. Instead each package image will contain a copy of the native code, so I don't think disabling is an option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment here and in the other places doing this would indeed have been nice...

// Target is present in another pkgimage
cache_valid = true;
external = true;
Expand Down Expand Up @@ -5624,7 +5624,7 @@ static Function *emit_tojlinvoke(jl_code_instance_t *codeinst, Module *M, jl_cod

bool cache_valid = params.cache;
if (params.external_linkage) {
if (jl_object_in_image((jl_value_t*)codeinst)) {
if (0 && jl_object_in_image((jl_value_t*)codeinst)) {
// Target is present in another pkgimage
cache_valid = true;
}
Expand Down Expand Up @@ -8536,7 +8536,7 @@ void jl_compile_workqueue(
auto invoke = jl_atomic_load_relaxed(&codeinst->invoke);
bool cache_valid = params.cache;
if (params.external_linkage) {
cache_valid = jl_object_in_image((jl_value_t*)codeinst);
cache_valid = 0 && jl_object_in_image((jl_value_t*)codeinst);
}
// WARNING: isspecsig is protected by the codegen-lock. If that lock is removed, then the isspecsig load needs to be properly atomically sequenced with this.
if (cache_valid && invoke != NULL) {
Expand Down
3 changes: 2 additions & 1 deletion src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1985,6 +1985,7 @@ STATIC_INLINE void gc_mark_array8(jl_ptls_t ptls, jl_value_t *ary8_parent, jl_va
jl_gc_markqueue_t *mq = &ptls->mark_queue;
jl_value_t *new_obj;
size_t elsize = ((jl_array_t *)ary8_parent)->elsize / sizeof(jl_value_t *);
assert(elsize > 0);
// Decide whether need to chunk ary8
size_t nrefs = (ary8_end - ary8_begin) / elsize;
if (nrefs > MAX_REFS_AT_ONCE) {
Expand Down Expand Up @@ -2016,6 +2017,7 @@ STATIC_INLINE void gc_mark_array16(jl_ptls_t ptls, jl_value_t *ary16_parent, jl_
jl_gc_markqueue_t *mq = &ptls->mark_queue;
jl_value_t *new_obj;
size_t elsize = ((jl_array_t *)ary16_parent)->elsize / sizeof(jl_value_t *);
assert(elsize > 0);
// Decide whether need to chunk ary16
size_t nrefs = (ary16_end - ary16_begin) / elsize;
if (nrefs > MAX_REFS_AT_ONCE) {
Expand Down Expand Up @@ -2668,7 +2670,6 @@ static void gc_mark_roots(jl_gc_markqueue_t *mq)
}
gc_try_claim_and_push(mq, jl_all_methods, NULL);
gc_try_claim_and_push(mq, _jl_debug_method_invalidation, NULL);
gc_try_claim_and_push(mq, jl_build_ids, NULL);
// constants
gc_try_claim_and_push(mq, jl_emptytuple_type, NULL);
gc_try_claim_and_push(mq, cmpswap_names, NULL);
Expand Down
2 changes: 0 additions & 2 deletions src/jl_exported_data.inc
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@
XX(jl_voidpointer_type) \
XX(jl_void_type) \
XX(jl_weakref_type) \
XX(jl_build_ids) \
XX(jl_linkage_blobs) \

// Data symbols that are defined inside the public libjulia
#define JL_EXPORTED_DATA_SYMBOLS(XX) \
Expand Down
10 changes: 3 additions & 7 deletions src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,8 @@ extern tracer_cb jl_newmeth_tracer;
void jl_call_tracer(tracer_cb callback, jl_value_t *tracee);
void print_func_loc(JL_STREAM *s, jl_method_t *m);
extern jl_array_t *_jl_debug_method_invalidation JL_GLOBALLY_ROOTED;
extern arraylist_t jl_linkage_blobs; // external linkage: sysimg/pkgimages
extern jl_array_t *jl_build_ids JL_GLOBALLY_ROOTED; // external linkage: corresponding build_ids
extern arraylist_t jl_image_relocs; // external linkage: sysimg/pkgimages
JL_DLLEXPORT extern arraylist_t jl_linkage_blobs; // external linkage: sysimg/pkgimages
JL_DLLEXPORT extern arraylist_t jl_image_relocs; // external linkage: sysimg/pkgimages

extern JL_DLLEXPORT size_t jl_page_size;
extern jl_function_t *jl_typeinf_func JL_GLOBALLY_ROOTED;
Expand Down Expand Up @@ -951,10 +950,7 @@ static inline void jl_set_gc_and_wait(void)
// Query if a Julia object is if a permalloc region (due to part of a sys- pkg-image)
STATIC_INLINE size_t n_linkage_blobs(void) JL_NOTSAFEPOINT
{
if (!jl_build_ids)
return 0;
assert(jl_is_array(jl_build_ids));
return jl_array_len(jl_build_ids);
return jl_image_relocs.len;
}

// TODO: Makes this a binary search
Expand Down
Loading