summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen McCamant <smcc@mit.edu>1999-03-23 09:47:04 -0800
committerGurusamy Sarathy <gsar@cpan.org>1999-03-25 06:17:27 +0000
commit293d3ffa4862e7bfbef41f6f8f5e54959b0fc5e3 (patch)
treea3bcff7990ff4df00f842888a7fa8b1ab4bb3df5
parentbd0865ece2a76bf5829c6928d282480f2e4e0d90 (diff)
downloadperl-293d3ffa4862e7bfbef41f6f8f5e54959b0fc5e3.tar.gz
Compiler needs to know about utf8 SVOP tr///s
Message-ID: <14072.16859.154428.241373@fre-76-120.reshall.berkeley.edu> p4raw-id: //depot/perl@3164
-rw-r--r--ext/B/B.xs12
-rw-r--r--op.h2
-rwxr-xr-xopcode.pl2
3 files changed, 12 insertions, 4 deletions
diff --git a/ext/B/B.xs b/ext/B/B.xs
index d525e4e798..a2ee8141c3 100644
--- a/ext/B/B.xs
+++ b/ext/B/B.xs
@@ -123,8 +123,16 @@ cc_opclass(OP *o)
case OA_GVOP:
return OPc_GVOP;
- case OA_PVOP:
- return OPc_PVOP;
+ case OA_PVOP_OR_SVOP:
+ /*
+ * Character translations (tr///) are usually a PVOP, keeping a
+ * pointer to a table of shorts used to look up translations.
+ * Under utf8, however, a simple table isn't practical; instead,
+ * the OP is an SVOP, and the SV is a reference to a swash
+ * (i.e., an RV pointing to an HV).
+ */
+ return (o->op_private & (OPpTRANS_TO_UTF|OPpTRANS_FROM_UTF))
+ ? OPc_SVOP : OPc_PVOP;
case OA_LOOP:
return OPc_LOOP;
diff --git a/op.h b/op.h
index 2c5abab37c..67e636f79e 100644
--- a/op.h
+++ b/op.h
@@ -311,7 +311,7 @@ struct loop {
#define OA_PMOP (6 << 8)
#define OA_SVOP (7 << 8)
#define OA_GVOP (8 << 8)
-#define OA_PVOP (9 << 8)
+#define OA_PVOP_OR_SVOP (9 << 8)
#define OA_LOOP (10 << 8)
#define OA_COP (11 << 8)
#define OA_BASEOP_OR_UNOP (12 << 8)
diff --git a/opcode.pl b/opcode.pl
index ee4fbb0e7f..7b6e79655b 100755
--- a/opcode.pl
+++ b/opcode.pl
@@ -172,7 +172,7 @@ END
'/', 6, # pmop
'$', 7, # svop
'*', 8, # gvop
- '"', 9, # pvop
+ '"', 9, # pvop_or_svop
'{', 10, # loop
';', 11, # cop
'%', 12, # baseop_or_unop