Skip to content

Commit

Permalink
Disable gcext test that uses jl_gc_internal_obj_base_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Nov 25, 2022
1 parent 51212d7 commit c3d0c07
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/julia_gcext.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ JL_DLLEXPORT int jl_gc_conservative_gc_support_enabled(void);
// external allocations may not all be valid objects and that for those,
// the user *must* validate that they have a proper type, i.e. that
// jl_typeof(obj) is an actual type object.
//
// NOTE: Only valid to call from within a GC context.
JL_DLLEXPORT jl_value_t *jl_gc_internal_obj_base_ptr(void *p);

// Return a non-null pointer to the start of the stack area if the task
Expand Down
20 changes: 10 additions & 10 deletions test/gcext/LocalTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ function set_aux_root(n :: Int, x :: String)
return ccall(:set_aux_root, Nothing, (UInt, String), n, x)
end

function internal_obj_scan(p :: Any)
if ccall(:internal_obj_scan, Cint, (Any,), p) == 0
global internal_obj_scan_failures += 1
end
end
# function internal_obj_scan(p :: Any)
# if ccall(:internal_obj_scan, Cint, (Any,), p) == 0
# global internal_obj_scan_failures += 1
# end
# end

global internal_obj_scan_failures = 0
# global internal_obj_scan_failures = 0

for i in 0:1000
set_aux_root(i, string(i))
Expand All @@ -70,12 +70,12 @@ function test()
local stack = make()
for i in 1:100000
push(stack, string(i, base=2))
internal_obj_scan(top(stack))
# internal_obj_scan(top(stack))
end
for i in 1:1000
local stack2 = make()
internal_obj_scan(stack2)
internal_obj_scan(blob(stack2))
# internal_obj_scan(stack2)
# internal_obj_scan(blob(stack2))
while !empty(stack)
push(stack2, pop(stack))
end
Expand All @@ -98,5 +98,5 @@ end
print(gc_counter_full(), " full collections.\n")
print(gc_counter_inc(), " partial collections.\n")
print(num_obj_sweeps(), " object sweeps.\n")
print(internal_obj_scan_failures, " internal object scan failures.\n")
# print(internal_obj_scan_failures, " internal object scan failures.\n")
print(corrupted_roots, " corrupted auxiliary roots.\n")
4 changes: 2 additions & 2 deletions test/gcext/gcext-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ end
@test checknum(lines[2], r"([0-9]+) full collections", n -> n >= 10)
@test checknum(lines[3], r"([0-9]+) partial collections", n -> n > 0)
@test checknum(lines[4], r"([0-9]+) object sweeps", n -> n > 0)
@test checknum(lines[5], r"([0-9]+) internal object scan failures",
n -> n == 0)
# @test checknum(lines[5], r"([0-9]+) internal object scan failures",
# n -> n == 0)
@test checknum(lines[6], r"([0-9]+) corrupted auxiliary roots",
n -> n == 0)
end
1 change: 1 addition & 0 deletions test/gcext/gcext.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ static size_t gc_alloc_size(jl_value_t *val)

int internal_obj_scan(jl_value_t *val)
{
// FIXME: `jl_gc_internal_obj_base_ptr` is not allowed to be called from outside GC
if (jl_gc_internal_obj_base_ptr(val) == val) {
size_t size = gc_alloc_size(val);
char *addr = (char *)val;
Expand Down

0 comments on commit c3d0c07

Please sign in to comment.