From: Nicholas Clark <nick@ccl4.org>
Date: Sat, 20 Feb 2010 18:54:58 +0000 (+0000)
Subject: For SAVEt_I16, save the value with the type.
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c9441fce959a578649990e314e4e5d491aa4b319;p=p5sagit%2Fp5-mst-13.2.git

For SAVEt_I16, save the value with the type.
---

diff --git a/scope.c b/scope.c
index 9f9da42..57c00b6 100644
--- a/scope.c
+++ b/scope.c
@@ -417,7 +417,9 @@ Perl_save_I16(pTHX_ I16 *intp)
 
     PERL_ARGS_ASSERT_SAVE_I16;
 
-    save_pushi32ptr(*intp, intp, SAVEt_I16);
+    SSCHECK(2);
+    SSPUSHPTR(intp);
+    SSPUSHUV(SAVEt_I16 | ((UV)*intp << 8));
 }
 
 void
@@ -1086,7 +1088,7 @@ Perl_leave_scope(pTHX_ I32 base)
 
 	case SAVEt_I16:				/* I16 reference */
 	    ptr = SSPOPPTR;
-	    *(I16*)ptr = (I16)SSPOPINT;
+	    *(I16*)ptr = (I16)(uv >> 8);
 	    break;
 	case SAVEt_I8:				/* I8 reference */
 	    ptr = SSPOPPTR;
diff --git a/sv.c b/sv.c
index c0f7ee3..3e0367b 100644
--- a/sv.c
+++ b/sv.c
@@ -11559,7 +11559,6 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
 	    TOPLONG(nss,ix) = longval;
 	    break;
 	case SAVEt_I32:				/* I32 reference */
-	case SAVEt_I16:				/* I16 reference */
 	case SAVEt_COP_ARYBASE:			/* call CopARYBASE_set */
 	    ptr = POPPTR(ss,ix);
 	    TOPPTR(nss,ix) = any_dup(ptr, proto_perl);
@@ -11584,6 +11583,7 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
 	    ptr = POPPTR(ss,ix);
 	    TOPPTR(nss,ix) = any_dup(ptr, proto_perl);
 	    /* Fall through */
+	case SAVEt_I16:				/* I16 reference */
 	case SAVEt_I8:				/* I8 reference */
 	case SAVEt_BOOL:
 	    ptr = POPPTR(ss,ix);