This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Compiler needs to know about utf8 SVOP tr///s
authorStephen McCamant <smcc@mit.edu>
Tue, 23 Mar 1999 17:47:04 +0000 (09:47 -0800)
committerGurusamy Sarathy <gsar@cpan.org>
Thu, 25 Mar 1999 06:17:27 +0000 (06:17 +0000)
Message-ID: <14072.16859.154428.241373@fre-76-120.reshall.berkeley.edu>

p4raw-id: //depot/perl@3164

ext/B/B.xs
op.h
opcode.pl

index d525e4e..a2ee814 100644 (file)
@@ -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 2c5abab..67e636f 100644 (file)
--- 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)
index ee4fbb0..7b6e796 100755 (executable)
--- 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