Skip to content

Commit

Permalink
fixup! pass rejection reason to caller
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Jun 23, 2023
1 parent b4f1f45 commit 060bf7b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,11 +630,12 @@ static inline jl_image_t parse_sysimg(void *hdl, F &&callback)
jl_dlsym(hdl, "jl_image_pointers", (void**)&pointers, 1);

const void *ids = pointers->target_data;
jl_value_t* rejection_reason = C_NULL;
jl_value_t* rejection_reason = nullptr;
JL_GC_PUSH1(&rejection_reason);
uint32_t target_idx = callback(ids, &rejection_reason);
if target_idx == -1;
jl_error(rejection_reason);
if (target_idx == (uint32_t)-1) {
jl_throw(jl_new_struct(jl_errorexception_type, rejection_reason));
}
JL_GC_POP();

if (pointers->header->version != 1) {
Expand Down Expand Up @@ -984,7 +985,7 @@ extern "C" JL_DLLEXPORT jl_value_t* jl_reflect_clone_targets() {
data.insert(data.end(), specdata.begin(), specdata.end());
}

arr = (jl_value_t*)jl_alloc_array_1d(jl_array_uint8_type, data.size());
jl_value_t *arr = (jl_value_t*)jl_alloc_array_1d(jl_array_uint8_type, data.size());
uint8_t *out = (uint8_t*)jl_array_data(arr);
memcpy(out, data.data(), data.size());
return arr;
Expand Down
2 changes: 1 addition & 1 deletion src/processor_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1825,7 +1825,7 @@ JL_DLLEXPORT jl_value_t* jl_check_pkgimage_clones(char *data)
JL_GC_PUSH1(&rejection_reason);
uint32_t match_idx = pkgimg_init_cb(data, &rejection_reason);
JL_GC_POP();
if (match_idx == -1)
if (match_idx == (uint32_t)-1)
return rejection_reason;
return jl_nothing;
}
Expand Down
2 changes: 1 addition & 1 deletion src/processor_fallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ JL_DLLEXPORT jl_value_t* jl_check_pkgimage_clones(char *data)
JL_GC_PUSH1(&rejection_reason);
uint32_t match_idx = pkgimg_init_cb(data, &rejection_reason);
JL_GC_POP();
if (match_idx == -1)
if (match_idx == (uint32_t)-1)
return rejection_reason;
return jl_nothing;
}
Expand Down
4 changes: 2 additions & 2 deletions src/processor_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ static uint32_t sysimg_init_cb(const void *id, jl_value_t** rejection_reason)
"https://docs.julialang.org/en/v1/devdocs/sysimg/ for more.");
}
auto match = match_sysimg_targets(sysimg, target, max_vector_size, rejection_reason);
if match.best_idx == -1
if (match.best_idx == (uint32_t)-1)
return match.best_idx;
// Now we've decided on which sysimg version to use.
// Make sure the JIT target is compatible with it and save the JIT target.
Expand Down Expand Up @@ -1040,7 +1040,7 @@ JL_DLLEXPORT jl_value_t* jl_check_pkgimage_clones(char *data)
JL_GC_PUSH1(&rejection_reason);
uint32_t match_idx = pkgimg_init_cb(data, &rejection_reason);
JL_GC_POP();
if (match_idx == -1)
if (match_idx == (uint32_t)-1)
return rejection_reason;
return jl_nothing;
}
Expand Down

0 comments on commit 060bf7b

Please sign in to comment.