summaryrefslogtreecommitdiff
path: root/pp.h
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1999-06-12 00:49:09 -0400
committerGurusamy Sarathy <gsar@cpan.org>1999-07-06 10:17:52 +0000
commitb162f9ead0a98db35cdcfc8c889e344c040c8d8e (patch)
treea63f009c58b2d69d004f575eb9e2215205385270 /pp.h
parentc70704064b4c55c8116e7b43f88c86dc34819ee2 (diff)
downloadperl-b162f9ead0a98db35cdcfc8c889e344c040c8d8e.tar.gz
Optimize away OP_SASSIGN
Message-Id: <199906120849.EAA26986@monk.mps.ohio-state.edu> p4raw-id: //depot/perl@3612
Diffstat (limited to 'pp.h')
-rw-r--r--pp.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/pp.h b/pp.h
index 9fd3365361..0eac5a56f9 100644
--- a/pp.h
+++ b/pp.h
@@ -98,6 +98,7 @@
#define XPUSHn(n) STMT_START { sv_setnv(TARG, (NV)(n)); XPUSHTARG; } STMT_END
#define XPUSHi(i) STMT_START { sv_setiv(TARG, (IV)(i)); XPUSHTARG; } STMT_END
#define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END
+#define XPUSHundef STMT_START { SvOK_off(TARG); XPUSHs(TARG); } STMT_END
#define SETs(s) (*sp = s)
#define SETTARG STMT_START { SvSETMAGIC(TARG); SETs(TARG); } STMT_END
@@ -151,7 +152,9 @@
#define RETSETUNDEF RETURNX(SETs(&PL_sv_undef))
#define ARGTARG PL_op->op_targ
-#define MAXARG PL_op->op_private
+
+ /* See OPpTARGET_MY: */
+#define MAXARG (PL_op->op_private & 15)
#define SWITCHSTACK(f,t) \
STMT_START { \
@@ -209,8 +212,8 @@
#define FORCE_SETs(sv) STMT_START { sv_setsv(TARG, (sv)); SETTARG; } STMT_END
-#define tryAMAGICun tryAMAGICunSET
-#define tryAMAGICunSET(meth) tryAMAGICunW(meth,SETs,0,RETURN)
+#define tryAMAGICun(meth) tryAMAGICunW(meth,SETsvUN,0,RETURN)
+#define tryAMAGICunSET(meth) tryAMAGICunW(meth,SETs,0,RETURN)
#define tryAMAGICunTARGET(meth, shift) \
{ dSP; sp--; /* get TARGET from below PL_stack_sp */ \
{ dTARGETSTACKED; \
@@ -225,7 +228,13 @@
#define opASSIGN (PL_op->op_flags & OPf_STACKED)
#define SETsv(sv) STMT_START { \
- if (opASSIGN) { sv_setsv(TARG, (sv)); SETTARG; } \
+ if (opASSIGN || (SvFLAGS(TARG) & SVs_PADMY)) \
+ { sv_setsv(TARG, (sv)); SETTARG; } \
+ else SETs(sv); } STMT_END
+
+#define SETsvUN(sv) STMT_START { \
+ if (SvFLAGS(TARG) & SVs_PADMY) \
+ { sv_setsv(TARG, (sv)); SETTARG; } \
else SETs(sv); } STMT_END
/* newSVsv does not behave as advertised, so we copy missing