Skip to content

Commit 3d6a5af

Browse files
author
KristofferC
committed
Revert "Allow for querying of build_id from objects (#53943)"
This reverts commit fcad4b9.
1 parent 5b15ed7 commit 3d6a5af

File tree

6 files changed

+2
-53
lines changed

6 files changed

+2
-53
lines changed

base/loading.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3008,14 +3008,6 @@ function module_build_id(m::Module)
30083008
return (UInt128(hi) << 64) | lo
30093009
end
30103010

3011-
function object_build_id(obj)
3012-
mod = ccall(:jl_object_top_module, Any, (Any,), obj)
3013-
if mod === nothing
3014-
return nothing
3015-
end
3016-
return module_build_id(mod::Module)
3017-
end
3018-
30193011
function isvalid_cache_header(f::IOStream)
30203012
pkgimage = Ref{UInt8}()
30213013
checksum = ccall(:jl_read_verify_header, UInt64, (Ptr{Cvoid}, Ptr{UInt8}, Ptr{Int64}, Ptr{Int64}), f.ios, pkgimage, Ref{Int64}(), Ref{Int64}()) # returns checksum id or zero

src/init.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,6 @@ JL_DLLEXPORT void julia_init(JL_IMAGE_SEARCH rel)
826826

827827
arraylist_new(&jl_linkage_blobs, 0);
828828
arraylist_new(&jl_image_relocs, 0);
829-
arraylist_new(&jl_top_mods, 0);
830829
arraylist_new(&eytzinger_image_tree, 0);
831830
arraylist_new(&eytzinger_idxs, 0);
832831
arraylist_push(&eytzinger_idxs, (void*)0);

src/julia.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2049,7 +2049,6 @@ JL_DLLEXPORT void jl_create_system_image(void **, jl_array_t *worklist, bool_t e
20492049
JL_DLLEXPORT void jl_restore_system_image(const char *fname);
20502050
JL_DLLEXPORT void jl_restore_system_image_data(const char *buf, size_t len);
20512051
JL_DLLEXPORT jl_value_t *jl_restore_incremental(const char *fname, jl_array_t *depmods, int complete, const char *pkgimage);
2052-
JL_DLLEXPORT jl_value_t *jl_object_top_module(jl_value_t* v) JL_NOTSAFEPOINT;
20532052

20542053
JL_DLLEXPORT void jl_set_newly_inferred(jl_value_t *newly_inferred);
20552054
JL_DLLEXPORT void jl_push_newly_inferred(jl_value_t *ci);

src/julia_internal.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ void print_func_loc(JL_STREAM *s, jl_method_t *m);
349349
extern jl_array_t *_jl_debug_method_invalidation JL_GLOBALLY_ROOTED;
350350
JL_DLLEXPORT extern arraylist_t jl_linkage_blobs; // external linkage: sysimg/pkgimages
351351
JL_DLLEXPORT extern arraylist_t jl_image_relocs; // external linkage: sysimg/pkgimages
352-
JL_DLLEXPORT extern arraylist_t jl_top_mods; // external linkage: sysimg/pkgimages
353352
extern arraylist_t eytzinger_image_tree;
354353
extern arraylist_t eytzinger_idxs;
355354

@@ -1015,8 +1014,7 @@ STATIC_INLINE size_t n_linkage_blobs(void) JL_NOTSAFEPOINT
10151014

10161015
size_t external_blob_index(jl_value_t *v) JL_NOTSAFEPOINT;
10171016

1018-
// Query if this object is perm-allocated in an image.
1019-
JL_DLLEXPORT uint8_t jl_object_in_image(jl_value_t* v) JL_NOTSAFEPOINT;
1017+
uint8_t jl_object_in_image(jl_value_t* v) JL_NOTSAFEPOINT;
10201018

10211019
// the first argument to jl_idtable_rehash is used to return a value
10221020
// make sure it is rooted if it is used after the function returns

src/staticdata.c

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,6 @@ static arraylist_t object_worklist; // used to mimic recursion by jl_serialize_
336336
// jl_linkage_blobs.items[2i:2i+1] correspond to build_ids[i] (0-offset indexing)
337337
arraylist_t jl_linkage_blobs;
338338
arraylist_t jl_image_relocs;
339-
// Keep track of which image corresponds to which top module.
340-
arraylist_t jl_top_mods;
341339

342340
// Eytzinger tree of images. Used for very fast jl_object_in_image queries
343341
// See https://algorithmica.org/en/eytzinger
@@ -452,23 +450,11 @@ size_t external_blob_index(jl_value_t *v) JL_NOTSAFEPOINT
452450
return idx;
453451
}
454452

455-
JL_DLLEXPORT uint8_t jl_object_in_image(jl_value_t *obj) JL_NOTSAFEPOINT
453+
uint8_t jl_object_in_image(jl_value_t *obj) JL_NOTSAFEPOINT
456454
{
457455
return eyt_obj_in_img(obj);
458456
}
459457

460-
// Map an object to it's "owning" top module
461-
JL_DLLEXPORT jl_value_t *jl_object_top_module(jl_value_t* v) JL_NOTSAFEPOINT
462-
{
463-
size_t idx = external_blob_index(v);
464-
size_t lbids = n_linkage_blobs();
465-
if (idx < lbids) {
466-
return (jl_value_t*)jl_top_mods.items[idx];
467-
}
468-
// The object is runtime allocated
469-
return (jl_value_t*)jl_nothing;
470-
}
471-
472458
// hash of definitions for predefined function pointers
473459
static htable_t fptr_to_id;
474460
void *native_functions; // opaque jl_native_code_desc_t blob used for fetching data from LLVM
@@ -3568,15 +3554,6 @@ static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl
35683554
arraylist_push(&jl_linkage_blobs, (void*)image_base);
35693555
arraylist_push(&jl_linkage_blobs, (void*)(image_base + sizeof_sysimg));
35703556
arraylist_push(&jl_image_relocs, (void*)relocs_base);
3571-
if (restored == NULL) {
3572-
arraylist_push(&jl_top_mods, (void*)jl_top_module);
3573-
} else {
3574-
size_t len = jl_array_nrows(*restored);
3575-
assert(len > 0);
3576-
jl_module_t *topmod = (jl_module_t*)jl_array_ptr_ref(*restored, len-1);
3577-
assert(jl_is_module(topmod));
3578-
arraylist_push(&jl_top_mods, (void*)topmod);
3579-
}
35803557
jl_timing_counter_inc(JL_TIMING_COUNTER_ImageSize, sizeof_sysimg + sizeof(uintptr_t));
35813558
rebuild_image_blob_tree();
35823559

test/precompile.jl

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ function precompile_test_harness(@nospecialize(f), separate::Bool)
4747
nothing
4848
end
4949

50-
@testset "object_build_id" begin
51-
@test Base.object_build_id([1]) === nothing
52-
@test Base.object_build_id(Base) == Base.module_build_id(Base)
53-
end
54-
5550
# method root provenance
5651

5752
rootid(m::Module) = Base.module_build_id(Base.parentmodule(m)) % UInt64
@@ -387,9 +382,6 @@ precompile_test_harness(false) do dir
387382
@test objectid(Foo.a_vec_int) === Foo.oid_vec_int
388383
@test objectid(Foo.a_mat_int) === Foo.oid_mat_int
389384
@test Foo.oid_vec_int !== Foo.oid_mat_int
390-
@test Base.object_build_id(Foo.a_vec_int) == Base.object_build_id(Foo.a_mat_int)
391-
@test Base.object_build_id(Foo) == Base.module_build_id(Foo)
392-
@test Base.object_build_id(Foo.a_vec_int) == Base.module_build_id(Foo)
393385
end
394386

395387
@eval begin function ccallable_test()
@@ -1778,14 +1770,10 @@ let newinterp_path = abspath("compiler/newinterp.jl")
17781770
@test isdefined(ci, :next)
17791771
@test ci.owner === nothing
17801772
@test ci.max_world == typemax(UInt)
1781-
@test Base.module_build_id(CustomAbstractInterpreterCaching) ==
1782-
Base.object_build_id(ci)
17831773
ci = ci.next
17841774
@test !isdefined(ci, :next)
17851775
@test ci.owner === cache_owner
17861776
@test ci.max_world == typemax(UInt)
1787-
@test Base.module_build_id(CustomAbstractInterpreterCaching) ==
1788-
Base.object_build_id(ci)
17891777
end
17901778
let m = only(methods(sum, (Vector{Float64},)))
17911779
found = false
@@ -1795,14 +1783,10 @@ let newinterp_path = abspath("compiler/newinterp.jl")
17951783
@test isdefined(ci, :next)
17961784
@test ci.owner === cache_owner
17971785
@test ci.max_world == typemax(UInt)
1798-
@test Base.module_build_id(CustomAbstractInterpreterCaching) ==
1799-
Base.object_build_id(ci)
18001786
ci = ci.next
18011787
@test !isdefined(ci, :next)
18021788
@test ci.owner === nothing
18031789
@test ci.max_world == typemax(UInt)
1804-
@test Base.module_build_id(CustomAbstractInterpreterCaching) ==
1805-
Base.object_build_id(ci)
18061790
found = true
18071791
break
18081792
end

0 commit comments

Comments
 (0)