Skip to content

Commit f8388ba

Browse files
committed
Add JL_GC_DECODE_NROOTS
1 parent 35b0980 commit f8388ba

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/julia.h

+2
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,7 @@ struct _jl_gcframe_t {
10571057

10581058
#define JL_GC_ENCODE_PUSHARGS(n) (((size_t)(n))<<2)
10591059
#define JL_GC_ENCODE_PUSH(n) ((((size_t)(n))<<2)|1)
1060+
#define JL_GC_DECODE_NROOTS(n) (n >> 2)
10601061
#define JL_GC_ENCODE_PUSHARGS_NO_TPIN(n) JL_GC_ENCODE_PUSHARGS(n)
10611062
#define JL_GC_ENCODE_PUSH_NO_TPIN(n) JL_GC_ENCODE_PUSH(n)
10621063

@@ -1082,6 +1083,7 @@ struct _jl_gcframe_t {
10821083
// these are transitively pinning
10831084
#define JL_GC_ENCODE_PUSHARGS(n) (((size_t)(n))<<3)
10841085
#define JL_GC_ENCODE_PUSH(n) ((((size_t)(n))<<3)|1)
1086+
#define JL_GC_DECODE_NROOTS(n) (n >> 3)
10851087
// these only pin the root object itself
10861088
#define JL_GC_ENCODE_PUSHARGS_NO_TPIN(n) (((size_t)(n))<<3|4)
10871089
#define JL_GC_ENCODE_PUSH_NO_TPIN(n) ((((size_t)(n))<<3)|5)

src/subtype.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ static void re_save_env(jl_stenv_t *e, jl_savedenv_t *se, int root)
274274
}
275275
else {
276276
roots = se->roots;
277-
nroots = se->gcframe.nroots >> 2;
277+
nroots = JL_GC_DECODE_NROOTS(se->gcframe.nroots);
278278
}
279279
}
280280
jl_varbinding_t *v = e->vars;
@@ -367,7 +367,7 @@ static void restore_env(jl_stenv_t *e, jl_savedenv_t *se, int root) JL_NOTSAFEPO
367367
}
368368
else {
369369
roots = se->roots;
370-
nroots = se->gcframe.nroots >> 2;
370+
nroots = JL_GC_DECODE_NROOTS(se->gcframe.nroots);
371371
}
372372
}
373373
jl_varbinding_t *v = e->vars;
@@ -4146,7 +4146,7 @@ static int merge_env(jl_stenv_t *e, jl_savedenv_t *me, jl_savedenv_t *se, int co
41464146
else {
41474147
saved = se->roots;
41484148
merged = me->roots;
4149-
nroots = se->gcframe.nroots >> 2;
4149+
nroots = JL_GC_DECODE_NROOTS(se->gcframe.nroots);
41504150
}
41514151
assert(nroots == current_env_length(e) * 3);
41524152
assert(nroots % 3 == 0);

0 commit comments

Comments
 (0)