Skip to content

Commit dfd0a0e

Browse files
udesouqinsoon
andauthored
Pin pointer literals in literal_pointer_val and Julia pointers in julia_to_scm (#80)
Backporting #63 to `dev`. Co-authored-by: Yi Lin <[email protected]>
1 parent 32d38fb commit dfd0a0e

File tree

4 files changed

+5
-0
lines changed

4 files changed

+5
-0
lines changed

src/ast.c

+1
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,7 @@ static value_t julia_to_list2_noalloc(fl_context_t *fl_ctx, jl_value_t *a, jl_va
815815

816816
static value_t julia_to_scm_(fl_context_t *fl_ctx, jl_value_t *v, int check_valid)
817817
{
818+
PTR_PIN(v);
818819
value_t retval;
819820
if (julia_to_scm_noalloc1(fl_ctx, v, &retval))
820821
return retval;

src/cgutils.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ static Value *literal_pointer_val(jl_codectx_t &ctx, jl_value_t *p)
578578
{
579579
if (p == NULL)
580580
return Constant::getNullValue(ctx.types().T_pjlvalue);
581+
PTR_PIN(p);
581582
Value *pgv = literal_pointer_val_slot(ctx, p);
582583
jl_aliasinfo_t ai = jl_aliasinfo_t::fromTBAA(ctx, ctx.tbaa().tbaa_const);
583584
auto load = ai.decorateInst(maybe_mark_load_dereferenceable(

src/jitlayers.h

+1
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ void add_named_global(StringRef name, void *addr) JL_NOTSAFEPOINT;
308308

309309
static inline Constant *literal_static_pointer_val(const void *p, Type *T) JL_NOTSAFEPOINT
310310
{
311+
PTR_PIN((void*)p);
311312
// this function will emit a static pointer into the generated code
312313
// the generated code will only be valid during the current session,
313314
// and thus, this should typically be avoided in new API's

src/julia.h

+2
Original file line numberDiff line numberDiff line change
@@ -2755,6 +2755,8 @@ extern void mmtk_object_reference_write_slow(void* mutator, const void* parent,
27552755
#define MMTK_IMMORTAL_BUMP_ALLOCATOR (0)
27562756

27572757
// VO bit is required to support conservative stack scanning and moving.
2758+
// NB: We have to set VO bit even if this is a non_moving build. Otherwise, assertions in mmtk-core
2759+
// will complain about seeing objects without VO bit.
27582760
#define MMTK_NEEDS_VO_BIT (1)
27592761

27602762
void mmtk_immortal_post_alloc_fast(MMTkMutatorContext* mutator, void* obj, size_t size);

0 commit comments

Comments
 (0)