From: Stephen McCamant Date: Tue, 23 Mar 1999 17:47:04 +0000 (-0800) Subject: Compiler needs to know about utf8 SVOP tr///s X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=293d3ffa4862e7bfbef41f6f8f5e54959b0fc5e3;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/ext/B/B.xs b/ext/B/B.xs index d525e4e..a2ee814 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 2c5abab..67e636f 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 ee4fbb0..7b6e796 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