summaryrefslogtreecommitdiff
path: root/op.h
diff options
context:
space:
mode:
authorBrian Fraser <fraserbn@gmail.com>2011-07-05 00:13:02 -0300
committerFather Chrysostomos <sprout@cpan.org>2011-10-06 13:00:56 -0700
commit0eaf81c53c0965e619d33cdd6a5f53c2f4bed7cf (patch)
tree2f114a86631b478057451b86a1ec60324ec91527 /op.h
parentf246260499cb1d0203cb449bbdf048074a0126a9 (diff)
downloadperl-0eaf81c53c0965e619d33cdd6a5f53c2f4bed7cf.tar.gz
Groundwork to allow cops and pmops to store the UTF8 flag
With threaded builds, cop.h and op.h get an extra member in their structs, to save the UTF-8ness of the stash's name. *STASH_set() checks for the flag, stores it through *STASH_flags(), and *STASH() uses the latter to fetch the correct scalar.
Diffstat (limited to 'op.h')
-rw-r--r--op.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/op.h b/op.h
index 6ae8dd94d0..02b6652709 100644
--- a/op.h
+++ b/op.h
@@ -351,7 +351,10 @@ struct pmop {
union {
OP * op_pmreplstart; /* Only used in OP_SUBST */
#ifdef USE_ITHREADS
- char * op_pmstashpv; /* Only used in OP_MATCH, with PMf_ONCE set */
+ struct {
+ char * op_pmstashpv; /* Only used in OP_MATCH, with PMf_ONCE set */
+ U32 op_pmstashflags; /* currently only SVf_UTF8 or 0 */
+ } op_pmstashthr;
#else
HV * op_pmstash;
#endif
@@ -421,19 +424,27 @@ struct pmop {
#ifdef USE_ITHREADS
# define PmopSTASHPV(o) \
- (((o)->op_pmflags & PMf_ONCE) ? (o)->op_pmstashstartu.op_pmstashpv : NULL)
+ (((o)->op_pmflags & PMf_ONCE) ? (o)->op_pmstashstartu.op_pmstashthr.op_pmstashpv : NULL)
# if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
# define PmopSTASHPV_set(o,pv) ({ \
assert((o)->op_pmflags & PMf_ONCE); \
- ((o)->op_pmstashstartu.op_pmstashpv = savesharedpv(pv)); \
+ ((o)->op_pmstashstartu.op_pmstashthr.op_pmstashpv = savesharedpv(pv)); \
})
# else
# define PmopSTASHPV_set(o,pv) \
- ((o)->op_pmstashstartu.op_pmstashpv = savesharedpv(pv))
+ ((o)->op_pmstashstartu.op_pmstashthr.op_pmstashpv = savesharedpv(pv))
# endif
-# define PmopSTASH(o) (PmopSTASHPV(o) \
- ? gv_stashpv((o)->op_pmstashstartu.op_pmstashpv,GV_ADD) : NULL)
-# define PmopSTASH_set(o,hv) PmopSTASHPV_set(o, ((hv) ? HvNAME_get(hv) : NULL))
+# define PmopSTASH_flags(o) ((o)->op_pmstashstartu.op_pmstashthr.op_pmstashflags)
+# define PmopSTASH_flags_set(o,flags) ((o)->op_pmstashstartu.op_pmstashthr.op_pmstashflags = flags)
+# define PmopSTASH(o) (PmopSTASHPV(o) \
+ ? gv_stashpv((o)->op_pmstashstartu.op_pmstashthr.op_pmstashpv, \
+ GV_ADD | PmopSTASH_flags(o)) : NULL)
+# define PmopSTASH_set(o,hv) (PmopSTASHPV_set(o, (hv) ? HvNAME_get(hv) : NULL), \
+ PmopSTASH_flags_set(o, \
+ ((hv) && HvNAME_HEK(hv) && \
+ HvNAMEUTF8(hv)) \
+ ? SVf_UTF8 \
+ : 0))
# define PmopSTASH_free(o) PerlMemShared_free(PmopSTASHPV(o))
#else