For SAVEt_BOOL, save the value with the type.
Nicholas Clark [Sat, 20 Feb 2010 17:40:04 +0000 (17:40 +0000)]
scope.c
sv.c

diff --git a/scope.c b/scope.c
index 5b7b614..8a769a3 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -373,10 +373,9 @@ Perl_save_bool(pTHX_ bool *boolp)
 
     PERL_ARGS_ASSERT_SAVE_BOOL;
 
-    SSCHECK(3);
-    SSPUSHBOOL(*boolp);
+    SSCHECK(2);
     SSPUSHPTR(boolp);
-    SSPUSHUV(SAVEt_BOOL);
+    SSPUSHUV(SAVEt_BOOL | (*boolp << 8));
 }
 
 void
@@ -799,7 +798,7 @@ Perl_leave_scope(pTHX_ I32 base)
            break;
        case SAVEt_BOOL:                        /* bool reference */
            ptr = SSPOPPTR;
-           *(bool*)ptr = cBOOL(SSPOPBOOL);
+           *(bool*)ptr = cBOOL(uv >> 8);
            break;
        case SAVEt_I32:                         /* I32 reference */
            ptr = SSPOPPTR;
diff --git a/sv.c b/sv.c
index cdeb362..3abeb54 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -11584,6 +11584,8 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
        case SAVEt_VPTR:                        /* random* reference */
            ptr = POPPTR(ss,ix);
            TOPPTR(nss,ix) = any_dup(ptr, proto_perl);
+           /* Fall through */
+       case SAVEt_BOOL:
            ptr = POPPTR(ss,ix);
            TOPPTR(nss,ix) = any_dup(ptr, proto_perl);
            break;
@@ -11698,12 +11700,6 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
            sv = (const SV *)POPPTR(ss,ix);
            TOPPTR(nss,ix) = sv_dup_inc(sv, param);
            break;
-       case SAVEt_BOOL:
-           ptr = POPPTR(ss,ix);
-           TOPPTR(nss,ix) = any_dup(ptr, proto_perl);
-           longval = (long)POPBOOL(ss,ix);
-           TOPBOOL(nss,ix) = cBOOL(longval);
-           break;
        case SAVEt_SET_SVFLAGS:
            i = POPINT(ss,ix);
            TOPINT(nss,ix) = i;