@@ -940,7 +940,7 @@ static const auto jlcheckbpwritable_func = new JuliaFunction<>{
940
940
nullptr ,
941
941
};
942
942
static const auto jlgetbindingvalue_func = new JuliaFunction<>{
943
- XSTR (jl_reresolve_binding_value_seqcst ),
943
+ XSTR (jl_get_binding_value_seqcst ),
944
944
[](LLVMContext &C) {
945
945
auto T_pjlvalue = JuliaType::get_pjlvalue_ty (C);
946
946
auto T_prjlvalue = JuliaType::get_prjlvalue_ty (C);
@@ -3138,9 +3138,9 @@ static jl_value_t *static_eval(jl_codectx_t &ctx, jl_value_t *ex)
3138
3138
jl_sym_t *sym = (jl_sym_t *)ex;
3139
3139
jl_binding_t *bnd = jl_get_module_binding (ctx.module , sym, 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 );
3142
- if (jl_bkind_is_some_constant (decode_restriction_kind (pku) ))
3143
- return decode_restriction_value (pku) ;
3141
+ jl_walk_binding_inplace_all (&bnd, &bpart, ctx.min_world , ctx.max_world );
3142
+ if (bpart && jl_bkind_is_some_constant (bpart-> kind ))
3143
+ return bpart-> restriction ;
3144
3144
return NULL ;
3145
3145
}
3146
3146
if (jl_is_slotnumber (ex) || jl_is_argument (ex))
@@ -3163,10 +3163,10 @@ static jl_value_t *static_eval(jl_codectx_t &ctx, jl_value_t *ex)
3163
3163
s = jl_globalref_name (ex);
3164
3164
jl_binding_t *bnd = jl_get_module_binding (jl_globalref_mod (ex), s, 0 );
3165
3165
jl_binding_partition_t *bpart = jl_get_binding_partition_all (bnd, ctx.min_world , ctx.max_world );
3166
- jl_ptr_kind_union_t pku = jl_walk_binding_inplace_all (&bnd, &bpart, ctx.min_world , ctx.max_world );
3166
+ jl_walk_binding_inplace_all (&bnd, &bpart, ctx.min_world , ctx.max_world );
3167
3167
jl_value_t *v = NULL ;
3168
- if (jl_bkind_is_some_constant (decode_restriction_kind (pku) ))
3169
- v = decode_restriction_value (pku) ;
3168
+ if (bpart && jl_bkind_is_some_constant (bpart-> kind ))
3169
+ v = bpart-> restriction ;
3170
3170
if (v) {
3171
3171
if (bnd->deprecated )
3172
3172
cg_bdw (ctx, s, bnd);
@@ -3190,10 +3190,10 @@ static jl_value_t *static_eval(jl_codectx_t &ctx, jl_value_t *ex)
3190
3190
if (s && jl_is_symbol (s)) {
3191
3191
jl_binding_t *bnd = jl_get_module_binding (m, s, 0 );
3192
3192
jl_binding_partition_t *bpart = jl_get_binding_partition_all (bnd, ctx.min_world , ctx.max_world );
3193
- jl_ptr_kind_union_t pku = jl_walk_binding_inplace_all (&bnd, &bpart, ctx.min_world , ctx.max_world );
3193
+ jl_walk_binding_inplace_all (&bnd, &bpart, ctx.min_world , ctx.max_world );
3194
3194
jl_value_t *v = NULL ;
3195
- if (jl_bkind_is_some_constant (decode_restriction_kind (pku) ))
3196
- v = decode_restriction_value (pku) ;
3195
+ if (bpart && jl_bkind_is_some_constant (bpart-> kind ))
3196
+ v = bpart-> restriction ;
3197
3197
if (v) {
3198
3198
if (bnd->deprecated )
3199
3199
cg_bdw (ctx, s, bnd);
@@ -3442,50 +3442,44 @@ static jl_cgval_t emit_globalref(jl_codectx_t &ctx, jl_module_t *mod, jl_sym_t *
3442
3442
if (!bpart) {
3443
3443
return emit_globalref_runtime (ctx, bnd, mod, name);
3444
3444
}
3445
- jl_ptr_kind_union_t pku = jl_atomic_load_relaxed (&bpart->restriction );
3446
- if (jl_bkind_is_some_guard (decode_restriction_kind (pku))) {
3447
- // try to look this up now.
3448
- // TODO: This is bad and we'd like to delete it.
3449
- jl_get_binding (mod, name);
3450
- }
3451
3445
// bpart was updated in place - this will change with full partition
3452
- pku = jl_atomic_load_acquire (&bpart->restriction );
3453
- if (jl_bkind_is_some_guard (decode_restriction_kind (pku))) {
3446
+ if (jl_bkind_is_some_guard (bpart->kind )) {
3454
3447
// Redo the lookup at runtime
3455
3448
return emit_globalref_runtime (ctx, bnd, mod, name);
3456
3449
} else {
3457
3450
while (true ) {
3458
3451
if (!bpart)
3459
3452
break ;
3460
- if (!jl_bkind_is_some_import (decode_restriction_kind (pku) ))
3453
+ if (!jl_bkind_is_some_import (bpart-> kind ))
3461
3454
break ;
3462
3455
if (bnd->deprecated ) {
3463
3456
cg_bdw (ctx, name, bnd);
3464
3457
}
3465
- bnd = (jl_binding_t *)decode_restriction_value (pku) ;
3458
+ bnd = (jl_binding_t *)bpart-> restriction ;
3466
3459
bpart = jl_get_binding_partition_all (bnd, ctx.min_world , ctx.max_world );
3467
3460
if (!bpart)
3468
3461
break ;
3469
- pku = jl_atomic_load_acquire (&bpart->restriction );
3470
3462
}
3471
- enum jl_partition_kind kind = decode_restriction_kind (pku);
3472
- if (bpart && (jl_bkind_is_some_constant (kind) && kind != BINDING_KIND_BACKDATED_CONST)) {
3473
- jl_value_t *constval = decode_restriction_value (pku);
3474
- if (!constval) {
3475
- undef_var_error_ifnot (ctx, ConstantInt::get (getInt1Ty (ctx.builder .getContext ()), 0 ), name, (jl_value_t *)mod);
3476
- return jl_cgval_t ();
3463
+ if (bpart) {
3464
+ enum jl_partition_kind kind = bpart->kind ;
3465
+ if (jl_bkind_is_some_constant (kind) && kind != BINDING_KIND_BACKDATED_CONST) {
3466
+ jl_value_t *constval = bpart->restriction ;
3467
+ if (!constval) {
3468
+ undef_var_error_ifnot (ctx, ConstantInt::get (getInt1Ty (ctx.builder .getContext ()), 0 ), name, (jl_value_t *)mod);
3469
+ return jl_cgval_t ();
3470
+ }
3471
+ return mark_julia_const (ctx, constval);
3477
3472
}
3478
- return mark_julia_const (ctx, constval);
3479
3473
}
3480
3474
}
3481
- if (!bpart || decode_restriction_kind (pku) != BINDING_KIND_GLOBAL) {
3475
+ if (!bpart || bpart-> kind != BINDING_KIND_GLOBAL) {
3482
3476
return emit_globalref_runtime (ctx, bnd, mod, name);
3483
3477
}
3484
3478
Value *bp = julia_binding_gv (ctx, bnd);
3485
3479
if (bnd->deprecated ) {
3486
3480
cg_bdw (ctx, name, bnd);
3487
3481
}
3488
- jl_value_t *ty = decode_restriction_value (pku) ;
3482
+ jl_value_t *ty = bpart-> restriction ;
3489
3483
bp = julia_binding_pvalue (ctx, bp);
3490
3484
if (ty == nullptr )
3491
3485
ty = (jl_value_t *)jl_any_type;
@@ -3501,9 +3495,8 @@ static jl_cgval_t emit_globalop(jl_codectx_t &ctx, jl_module_t *mod, jl_sym_t *s
3501
3495
jl_binding_partition_t *bpart = jl_get_binding_partition_all (bnd, ctx.min_world , ctx.max_world );
3502
3496
Value *bp = julia_binding_gv (ctx, bnd);
3503
3497
if (bpart) {
3504
- jl_ptr_kind_union_t pku = jl_atomic_load_relaxed (&bpart->restriction );
3505
- if (decode_restriction_kind (pku) == BINDING_KIND_GLOBAL) {
3506
- jl_value_t *ty = decode_restriction_value (pku);
3498
+ if (bpart->kind == BINDING_KIND_GLOBAL) {
3499
+ jl_value_t *ty = bpart->restriction ;
3507
3500
if (ty != nullptr ) {
3508
3501
const std::string fname = issetglobal ? " setglobal!" : isreplaceglobal ? " replaceglobal!" : isswapglobal ? " swapglobal!" : ismodifyglobal ? " modifyglobal!" : " setglobalonce!" ;
3509
3502
if (!ismodifyglobal) {
@@ -4188,8 +4181,8 @@ static jl_cgval_t emit_isdefinedglobal(jl_codectx_t &ctx, jl_module_t *modu, jl_
4188
4181
Value *isnull = NULL ;
4189
4182
jl_binding_t *bnd = allow_import ? jl_get_binding (modu, name) : jl_get_module_binding (modu, name, 0 );
4190
4183
jl_binding_partition_t *bpart = jl_get_binding_partition_all (bnd, ctx.min_world , ctx.max_world );
4191
- jl_ptr_kind_union_t pku = bpart ? jl_atomic_load_relaxed (& bpart->restriction ) : encode_restriction ( NULL , BINDING_KIND_GUARD) ;
4192
- if (decode_restriction_kind (pku) == BINDING_KIND_GLOBAL || jl_bkind_is_some_constant (decode_restriction_kind (pku) )) {
4184
+ enum jl_partition_kind kind = bpart ? bpart->kind : BINDING_KIND_GUARD;
4185
+ if (kind == BINDING_KIND_GLOBAL || jl_bkind_is_some_constant (kind )) {
4193
4186
if (jl_get_binding_value_if_const (bnd))
4194
4187
return mark_julia_const (ctx, jl_true);
4195
4188
Value *bp = julia_binding_gv (ctx, bnd);
0 commit comments