@@ -926,7 +926,7 @@ static const auto jlcheckbpwritable_func = new JuliaFunction<>{
926
926
nullptr,
927
927
};
928
928
static const auto jlgetbindingvalue_func = new JuliaFunction<>{
929
- XSTR(jl_reresolve_binding_value_seqcst ),
929
+ XSTR(jl_get_binding_value_seqcst ),
930
930
[](LLVMContext &C) {
931
931
auto T_pjlvalue = JuliaType::get_pjlvalue_ty(C);
932
932
auto T_prjlvalue = JuliaType::get_prjlvalue_ty(C);
@@ -3113,9 +3113,9 @@ static jl_value_t *static_eval(jl_codectx_t &ctx, jl_value_t *ex)
3113
3113
jl_sym_t *sym = (jl_sym_t*)ex;
3114
3114
jl_binding_t *bnd = jl_get_module_binding(ctx.module, sym, 0);
3115
3115
jl_binding_partition_t *bpart = jl_get_binding_partition_all(bnd, ctx.min_world, ctx.max_world);
3116
- jl_ptr_kind_union_t pku = jl_walk_binding_inplace_all(&bnd, &bpart, ctx.min_world, ctx.max_world);
3117
- if (jl_bkind_is_some_constant(decode_restriction_kind(pku) ))
3118
- return decode_restriction_value(pku) ;
3116
+ jl_walk_binding_inplace_all(&bnd, &bpart, ctx.min_world, ctx.max_world);
3117
+ if (bpart && jl_bkind_is_some_constant(bpart->kind ))
3118
+ return bpart->restriction ;
3119
3119
return NULL;
3120
3120
}
3121
3121
if (jl_is_slotnumber(ex) || jl_is_argument(ex))
@@ -3138,10 +3138,10 @@ static jl_value_t *static_eval(jl_codectx_t &ctx, jl_value_t *ex)
3138
3138
s = jl_globalref_name(ex);
3139
3139
jl_binding_t *bnd = jl_get_module_binding(jl_globalref_mod(ex), s, 0);
3140
3140
jl_binding_partition_t *bpart = jl_get_binding_partition_all(bnd, ctx.min_world, ctx.max_world);
3141
- jl_ptr_kind_union_t pku = jl_walk_binding_inplace_all(&bnd, &bpart, ctx.min_world, ctx.max_world);
3141
+ jl_walk_binding_inplace_all(&bnd, &bpart, ctx.min_world, ctx.max_world);
3142
3142
jl_value_t *v = NULL;
3143
- if (jl_bkind_is_some_constant(decode_restriction_kind(pku) ))
3144
- v = decode_restriction_value(pku) ;
3143
+ if (bpart && jl_bkind_is_some_constant(bpart->kind ))
3144
+ v = bpart->restriction ;
3145
3145
if (v) {
3146
3146
if (bnd->deprecated)
3147
3147
cg_bdw(ctx, s, bnd);
@@ -3165,10 +3165,10 @@ static jl_value_t *static_eval(jl_codectx_t &ctx, jl_value_t *ex)
3165
3165
if (s && jl_is_symbol(s)) {
3166
3166
jl_binding_t *bnd = jl_get_module_binding(m, s, 0);
3167
3167
jl_binding_partition_t *bpart = jl_get_binding_partition_all(bnd, ctx.min_world, ctx.max_world);
3168
- jl_ptr_kind_union_t pku = jl_walk_binding_inplace_all(&bnd, &bpart, ctx.min_world, ctx.max_world);
3168
+ jl_walk_binding_inplace_all(&bnd, &bpart, ctx.min_world, ctx.max_world);
3169
3169
jl_value_t *v = NULL;
3170
- if (jl_bkind_is_some_constant(decode_restriction_kind(pku) ))
3171
- v = decode_restriction_value(pku) ;
3170
+ if (bpart && jl_bkind_is_some_constant(bpart->kind ))
3171
+ v = bpart->restriction ;
3172
3172
if (v) {
3173
3173
if (bnd->deprecated)
3174
3174
cg_bdw(ctx, s, bnd);
@@ -3418,50 +3418,44 @@ static jl_cgval_t emit_globalref(jl_codectx_t &ctx, jl_module_t *mod, jl_sym_t *
3418
3418
if (!bpart) {
3419
3419
return emit_globalref_runtime(ctx, bnd, mod, name);
3420
3420
}
3421
- jl_ptr_kind_union_t pku = jl_atomic_load_relaxed(&bpart->restriction);
3422
- if (jl_bkind_is_some_guard(decode_restriction_kind(pku))) {
3423
- // try to look this up now.
3424
- // TODO: This is bad and we'd like to delete it.
3425
- jl_get_binding(mod, name);
3426
- }
3427
3421
// bpart was updated in place - this will change with full partition
3428
- pku = jl_atomic_load_acquire(&bpart->restriction);
3429
- if (jl_bkind_is_some_guard(decode_restriction_kind(pku))) {
3422
+ if (jl_bkind_is_some_guard(bpart->kind)) {
3430
3423
// Redo the lookup at runtime
3431
3424
return emit_globalref_runtime(ctx, bnd, mod, name);
3432
3425
} else {
3433
3426
while (true) {
3434
3427
if (!bpart)
3435
3428
break;
3436
- if (!jl_bkind_is_some_import(decode_restriction_kind(pku) ))
3429
+ if (!jl_bkind_is_some_import(bpart->kind ))
3437
3430
break;
3438
3431
if (bnd->deprecated) {
3439
3432
cg_bdw(ctx, name, bnd);
3440
3433
}
3441
- bnd = (jl_binding_t*)decode_restriction_value(pku) ;
3434
+ bnd = (jl_binding_t*)bpart->restriction ;
3442
3435
bpart = jl_get_binding_partition_all(bnd, ctx.min_world, ctx.max_world);
3443
3436
if (!bpart)
3444
3437
break;
3445
- pku = jl_atomic_load_acquire(&bpart->restriction);
3446
3438
}
3447
- enum jl_partition_kind kind = decode_restriction_kind(pku);
3448
- if (bpart && (jl_bkind_is_some_constant(kind) && kind != BINDING_KIND_BACKDATED_CONST)) {
3449
- jl_value_t *constval = decode_restriction_value(pku);
3450
- if (!constval) {
3451
- undef_var_error_ifnot(ctx, ConstantInt::get(getInt1Ty(ctx.builder.getContext()), 0), name, (jl_value_t*)mod);
3452
- return jl_cgval_t();
3439
+ if (bpart) {
3440
+ enum jl_partition_kind kind = bpart->kind;
3441
+ if (jl_bkind_is_some_constant(kind) && kind != BINDING_KIND_BACKDATED_CONST) {
3442
+ jl_value_t *constval = bpart->restriction;
3443
+ if (!constval) {
3444
+ undef_var_error_ifnot(ctx, ConstantInt::get(getInt1Ty(ctx.builder.getContext()), 0), name, (jl_value_t*)mod);
3445
+ return jl_cgval_t();
3446
+ }
3447
+ return mark_julia_const(ctx, constval);
3453
3448
}
3454
- return mark_julia_const(ctx, constval);
3455
3449
}
3456
3450
}
3457
- if (!bpart || decode_restriction_kind(pku) != BINDING_KIND_GLOBAL) {
3451
+ if (!bpart || bpart->kind != BINDING_KIND_GLOBAL) {
3458
3452
return emit_globalref_runtime(ctx, bnd, mod, name);
3459
3453
}
3460
3454
Value *bp = julia_binding_gv(ctx, bnd);
3461
3455
if (bnd->deprecated) {
3462
3456
cg_bdw(ctx, name, bnd);
3463
3457
}
3464
- jl_value_t *ty = decode_restriction_value(pku) ;
3458
+ jl_value_t *ty = bpart->restriction ;
3465
3459
bp = julia_binding_pvalue(ctx, bp);
3466
3460
if (ty == nullptr)
3467
3461
ty = (jl_value_t*)jl_any_type;
@@ -3477,9 +3471,8 @@ static jl_cgval_t emit_globalop(jl_codectx_t &ctx, jl_module_t *mod, jl_sym_t *s
3477
3471
jl_binding_partition_t *bpart = jl_get_binding_partition_all(bnd, ctx.min_world, ctx.max_world);
3478
3472
Value *bp = julia_binding_gv(ctx, bnd);
3479
3473
if (bpart) {
3480
- jl_ptr_kind_union_t pku = jl_atomic_load_relaxed(&bpart->restriction);
3481
- if (decode_restriction_kind(pku) == BINDING_KIND_GLOBAL) {
3482
- jl_value_t *ty = decode_restriction_value(pku);
3474
+ if (bpart->kind == BINDING_KIND_GLOBAL) {
3475
+ jl_value_t *ty = bpart->restriction;
3483
3476
if (ty != nullptr) {
3484
3477
const std::string fname = issetglobal ? "setglobal!" : isreplaceglobal ? "replaceglobal!" : isswapglobal ? "swapglobal!" : ismodifyglobal ? "modifyglobal!" : "setglobalonce!";
3485
3478
if (!ismodifyglobal) {
@@ -4164,8 +4157,8 @@ static jl_cgval_t emit_isdefinedglobal(jl_codectx_t &ctx, jl_module_t *modu, jl_
4164
4157
Value *isnull = NULL;
4165
4158
jl_binding_t *bnd = allow_import ? jl_get_binding(modu, name) : jl_get_module_binding(modu, name, 0);
4166
4159
jl_binding_partition_t *bpart = jl_get_binding_partition_all(bnd, ctx.min_world, ctx.max_world);
4167
- jl_ptr_kind_union_t pku = bpart ? jl_atomic_load_relaxed(& bpart->restriction) : encode_restriction(NULL, BINDING_KIND_GUARD) ;
4168
- if (decode_restriction_kind(pku) == BINDING_KIND_GLOBAL || jl_bkind_is_some_constant(decode_restriction_kind(pku) )) {
4160
+ enum jl_partition_kind kind = bpart ? bpart->kind : BINDING_KIND_GUARD;
4161
+ if (kind == BINDING_KIND_GLOBAL || jl_bkind_is_some_constant(kind )) {
4169
4162
if (jl_get_binding_value_if_const(bnd))
4170
4163
return mark_julia_const(ctx, jl_true);
4171
4164
Value *bp = julia_binding_gv(ctx, bnd);
0 commit comments