@@ -926,7 +926,7 @@ static const auto jlcheckbpwritable_func = new JuliaFunction<>{
926926 nullptr ,
927927};
928928static const auto jlgetbindingvalue_func = new JuliaFunction<>{
929- XSTR (jl_reresolve_binding_value_seqcst ),
929+ XSTR (jl_get_binding_value_seqcst ),
930930 [](LLVMContext &C) {
931931 auto T_pjlvalue = JuliaType::get_pjlvalue_ty (C);
932932 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)
31133113 jl_sym_t *sym = (jl_sym_t *)ex;
31143114 jl_binding_t *bnd = jl_get_module_binding (ctx.module , sym, 0 );
31153115 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 ;
31193119 return NULL ;
31203120 }
31213121 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)
31383138 s = jl_globalref_name (ex);
31393139 jl_binding_t *bnd = jl_get_module_binding (jl_globalref_mod (ex), s, 0 );
31403140 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 );
31423142 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 ;
31453145 if (v) {
31463146 if (bnd->deprecated )
31473147 cg_bdw (ctx, s, bnd);
@@ -3165,10 +3165,10 @@ static jl_value_t *static_eval(jl_codectx_t &ctx, jl_value_t *ex)
31653165 if (s && jl_is_symbol (s)) {
31663166 jl_binding_t *bnd = jl_get_module_binding (m, s, 0 );
31673167 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 );
31693169 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 ;
31723172 if (v) {
31733173 if (bnd->deprecated )
31743174 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 *
34183418 if (!bpart) {
34193419 return emit_globalref_runtime (ctx, bnd, mod, name);
34203420 }
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- }
34273421 // 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 )) {
34303423 // Redo the lookup at runtime
34313424 return emit_globalref_runtime (ctx, bnd, mod, name);
34323425 } else {
34333426 while (true ) {
34343427 if (!bpart)
34353428 break ;
3436- if (!jl_bkind_is_some_import (decode_restriction_kind (pku) ))
3429+ if (!jl_bkind_is_some_import (bpart-> kind ))
34373430 break ;
34383431 if (bnd->deprecated ) {
34393432 cg_bdw (ctx, name, bnd);
34403433 }
3441- bnd = (jl_binding_t *)decode_restriction_value (pku) ;
3434+ bnd = (jl_binding_t *)bpart-> restriction ;
34423435 bpart = jl_get_binding_partition_all (bnd, ctx.min_world , ctx.max_world );
34433436 if (!bpart)
34443437 break ;
3445- pku = jl_atomic_load_acquire (&bpart->restriction );
34463438 }
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);
34533448 }
3454- return mark_julia_const (ctx, constval);
34553449 }
34563450 }
3457- if (!bpart || decode_restriction_kind (pku) != BINDING_KIND_GLOBAL) {
3451+ if (!bpart || bpart-> kind != BINDING_KIND_GLOBAL) {
34583452 return emit_globalref_runtime (ctx, bnd, mod, name);
34593453 }
34603454 Value *bp = julia_binding_gv (ctx, bnd);
34613455 if (bnd->deprecated ) {
34623456 cg_bdw (ctx, name, bnd);
34633457 }
3464- jl_value_t *ty = decode_restriction_value (pku) ;
3458+ jl_value_t *ty = bpart-> restriction ;
34653459 bp = julia_binding_pvalue (ctx, bp);
34663460 if (ty == nullptr )
34673461 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
34773471 jl_binding_partition_t *bpart = jl_get_binding_partition_all (bnd, ctx.min_world , ctx.max_world );
34783472 Value *bp = julia_binding_gv (ctx, bnd);
34793473 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 ;
34833476 if (ty != nullptr ) {
34843477 const std::string fname = issetglobal ? " setglobal!" : isreplaceglobal ? " replaceglobal!" : isswapglobal ? " swapglobal!" : ismodifyglobal ? " modifyglobal!" : " setglobalonce!" ;
34853478 if (!ismodifyglobal) {
@@ -4164,8 +4157,8 @@ static jl_cgval_t emit_isdefinedglobal(jl_codectx_t &ctx, jl_module_t *modu, jl_
41644157 Value *isnull = NULL ;
41654158 jl_binding_t *bnd = allow_import ? jl_get_binding (modu, name) : jl_get_module_binding (modu, name, 0 );
41664159 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 )) {
41694162 if (jl_get_binding_value_if_const (bnd))
41704163 return mark_julia_const (ctx, jl_true);
41714164 Value *bp = julia_binding_gv (ctx, bnd);
0 commit comments