This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make PL_hints an alias for PL_compiling.cop_hints
authorFather Chrysostomos <sprout@cpan.org>
Sun, 11 Aug 2013 15:08:08 +0000 (08:08 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 11 Aug 2013 15:22:36 +0000 (08:22 -0700)
PL_hints stores the hints at compile time that get copied into the
cop_hints field of each COP (in newSTATEOP).

Since perl-5.8.0-8053-gd5ec298, COPs have stored all the hints.

Before that, COPs used to store only some of the hints.  The hints
were copied here and there into PL_compiling, a static COP-shaped buf-
fer used during compilation, so that things like constant folding
would see the correct hints.  a0ed51b3 back in 1998 did that.

Now that COPs can store all the hints, we can just use
PL_compiling.cop_hints to avoid having to copy them from PL_hints from
time to time.

This simplifies the code and avoids creating bugs like those that
a547fd219 and 1c75beb82 fixed.

embedvar.h
intrpvar.h
mg.c
op.c
perl.h

index ef2fa68..3643bd1 100644 (file)
 #define PL_hash_rand_bits      (vTHX->Ihash_rand_bits)
 #define PL_hash_rand_bits_enabled      (vTHX->Ihash_rand_bits_enabled)
 #define PL_hintgv              (vTHX->Ihintgv)
-#define PL_hints               (vTHX->Ihints)
 #define PL_hv_fetch_ent_mh     (vTHX->Ihv_fetch_ent_mh)
 #define PL_in_clean_all                (vTHX->Iin_clean_all)
 #define PL_in_clean_objs       (vTHX->Iin_clean_objs)
index 299ac0f..61028f2 100644 (file)
@@ -540,8 +540,6 @@ PERLVAR(I, padix,   I32)            /* max used index in current "register" pad */
 
 PERLVAR(I, padix_floor,        I32)            /* how low may inner block reset padix */
 
-PERLVAR(I, hints,      U32)            /* pragma-tic compile-time flags */
-
 #ifdef USE_LOCALE_COLLATE
 PERLVAR(I, collation_name, char *)     /* Name of current collation */
 PERLVAR(I, collxfrm_base, Size_t)      /* Basic overhead in *xfrm() */
diff --git a/mg.c b/mg.c
index b4c0692..0ce58ab 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -2590,7 +2590,6 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
        break;
     case '\010':       /* ^H */
        PL_hints = SvIV(sv);
-       CopHINTS_set(&PL_compiling, PL_hints);
        break;
     case '\011':       /* ^I */ /* NOT \t in EBCDIC */
        Safefree(PL_inplace);
diff --git a/op.c b/op.c
index f580783..1064aff 100644 (file)
--- a/op.c
+++ b/op.c
@@ -2882,7 +2882,6 @@ Perl_block_end(pTHX_ I32 floor, OP *seq)
     CALL_BLOCK_HOOKS(bhk_pre_end, &retval);
 
     LEAVE_SCOPE(floor);
-    CopHINTS_set(&PL_compiling, PL_hints);
     if (needblockscope)
        PL_hints |= HINT_BLOCK_SCOPE; /* propagate out */
     o = pad_leavemy();
@@ -3275,7 +3274,6 @@ S_fold_constants(pTHX_ OP *o)
     /* Verify that we don't need to save it:  */
     assert(PL_curcop == &PL_compiling);
     StructCopy(&PL_compiling, &not_compiling, COP);
-    CopHINTS_set(&not_compiling, PL_hints);
     PL_curcop = &not_compiling;
     /* The above ensures that we run with all the correct hints of the
        currently compiling COP, but that IN_PERL_RUNTIME is not true. */
@@ -5697,7 +5695,6 @@ Perl_newSTATEOP(pTHX_ I32 flags, char *label, OP *o)
 #ifdef NATIVE_HINTS
     cop->op_private |= NATIVE_HINTS;
 #endif
-    CopHINTS_set(&PL_compiling, CopHINTS_get(cop));
     cop->op_next = (OP*)cop;
 
     cop->cop_seq = seq;
@@ -7692,7 +7689,6 @@ S_process_special_blocks(pTHX_ I32 floor, const char *const fullname,
            GvCV_set(gv,0);             /* cv has been hijacked */
            call_list(oldscope, PL_beginav);
 
-           CopHINTS_set(&PL_compiling, PL_hints);
            LEAVE;
        }
        else
diff --git a/perl.h b/perl.h
index d3648e1..8830424 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -4668,6 +4668,8 @@ EXTCONST char *const PL_phase_names[];
 #  define PL_amagic_generation PL_na
 #endif /* !PERL_CORE */
 
+#define PL_hints PL_compiling.cop_hints
+
 END_EXTERN_C
 
 /*****************************************************************************/