Skip to content

Commit f4f0247

Browse files
authored
Fix the argument type in get_lo_size (mmtk#32)
This fixes a bug that `get_lo_size` requires a struct, but is called with a pointer (object reference). This does not affect correctness for now, as we do not try to get the object size for large objects in MMTk.
1 parent 2deb281 commit f4f0247

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

.github/scripts/ci-build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ cd $MMTK_JULIA_DIR/mmtk
2626
cargo build --features $plan $build_args
2727

2828
cd $JULIA_PATH
29+
2930
# Clean first
3031
make cleanall
3132
# Build

julia/mmtk_julia.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,12 @@ void wait_for_the_world(void)
231231
}
232232
}
233233

234-
size_t get_lo_size(bigval_t obj)
234+
size_t get_lo_size(jl_value_t* obj)
235235
{
236-
return obj.sz;
236+
jl_taggedvalue_t *v = jl_astaggedvalue(obj);
237+
// bigval_header: but we cannot access the function here. So use container_of instead.
238+
bigval_t* hdr = container_of(v, bigval_t, header);
239+
return hdr->sz;
237240
}
238241

239242
void set_jl_last_err(int e)

julia/mmtk_julia.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ int get_jl_last_err(void);
1111

1212
void set_jl_last_err(int e);
1313

14-
size_t get_lo_size(bigval_t obj);
14+
size_t get_lo_size(jl_value_t* obj);
1515

1616
int8_t set_gc_initial_state(jl_ptls_t ptls);
1717

mmtk/api/mmtk.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ typedef struct {
8585
void (* run_finalizer_function) (jl_value_t* obj, jl_value_t* function, bool is_ptr);
8686
int (* get_jl_last_err) (void);
8787
void (* set_jl_last_err) (int e);
88-
// FIXME: I don't think this is correct, as we pass an object reference to get_lo_size, in the same way as get_so_size.
89-
size_t (* get_lo_size) (bigval_t obj);
88+
size_t (* get_lo_size) (jl_value_t* obj);
9089
size_t (* get_so_size) (jl_value_t* obj);
9190
void* (* get_obj_start_ref) (jl_value_t* obj);
9291
void (* wait_for_the_world) (void);

0 commit comments

Comments
 (0)