diff options
author | Yves Orton <demerphq@gmail.com> | 2022-10-31 14:41:27 +0100 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2022-11-01 11:57:31 +0100 |
commit | 6848aea2c844896efb347e6a210098c7dd447567 (patch) | |
tree | fd5ac721106fe55e061272248af6c7982bf1966a /cop.h | |
parent | 4bd3be3563698eb6e927a62c29755b216b926a27 (diff) | |
download | perl-6848aea2c844896efb347e6a210098c7dd447567.tar.gz |
op.c - use refcounted pv pointers for cop_warnings
this allows multiple ops to share the same underlying
warning bit vector. the vectors are not deduped, however
they are efficiently copied and shared.
Diffstat (limited to 'cop.h')
-rw-r--r-- | cop.h | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -447,7 +447,17 @@ struct cop { U32 cop_hints; /* hints bits from pragmata */ U32 cop_seq; /* parse sequence number */ /* Beware. mg.c and warnings.pl assume the type of this is STRLEN *: */ - STRLEN * cop_warnings; /* lexical warnings bitmask */ + STRLEN * cop_warnings; /* Lexical warnings bitmask vector. + Munged copy of ${^WARNING_BITS}. + This is not actually an array of STRLEN, + it is a STRLEN followed by a certain + number of bytes, as determined by the + initial STRLEN. The pointer is either + to constant storage, or it is a rcpv + (refcounted string) style pointer similar + to cop_file under threads. The value + is read-only as it is shared amongst + many COP structures */ /* compile time state of %^H. See the comment in op.c for how this is used to recreate a hash to return from caller. */ COPHH * cop_hints_hash; @@ -543,6 +553,7 @@ struct rcpv { typedef struct rcpv RCPV; #define RCPVf_USE_STRLEN 1 +#define RCPVf_NO_COPY 2 #define RCPVx(pv_arg) ((RCPV *)((pv_arg) - STRUCT_OFFSET(struct rcpv, pv))) #define RCPV_REFCOUNT(pv) (RCPVx(pv)->refcount) #define RCPV_LEN(pv) (RCPVx(pv)->len) |