From 293d3ffa4862e7bfbef41f6f8f5e54959b0fc5e3 Mon Sep 17 00:00:00 2001 From: Stephen McCamant Date: Tue, 23 Mar 1999 09:47:04 -0800 Subject: 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 --- ext/B/B.xs | 12 ++++++++++-- op.h | 2 +- opcode.pl | 2 +- 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 -- cgit v1.2.1