summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-11-11 06:04:20 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-11-11 06:04:20 +0000
commit57843af05bc7863df9b9bfb6b37e3a29d08532a9 (patch)
treeafce7f3f9e5ac7d38a7578c9d040f161c686fe6b /cop.h
parent743e66e61aecff1c9998bd0ff719a1d679b03e9f (diff)
downloadperl-57843af05bc7863df9b9bfb6b37e3a29d08532a9.tar.gz
another change towards a shareable optree: avoid pointer to filegv
in COP; revert parts of change#4485 and s/xcv_filegv/xcv_file/ (CvFILE() may yet come in handy somewhere); adjust compiler doodads to suit p4raw-link: @4485 on //depot/perl: b195d4879f55e1610299cb9b1b55356940c2a577 p4raw-id: //depot/perl@4545
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h39
1 files changed, 33 insertions, 6 deletions
diff --git a/cop.h b/cop.h
index 238c677bb4..89fab9424e 100644
--- a/cop.h
+++ b/cop.h
@@ -11,7 +11,11 @@ struct cop {
BASEOP
char * cop_label; /* label for this construct */
HV * cop_stash; /* package line was compiled in */
+#ifdef USE_ITHREADS
+ char * cop_file; /* file name the following line # is from */
+#else
GV * cop_filegv; /* file the following line # is from */
+#endif
U32 cop_seq; /* parse sequence number */
I32 cop_arybase; /* array base this line was compiled with */
line_t cop_line; /* line # of this command */
@@ -20,13 +24,36 @@ struct cop {
#define Nullcop Null(COP*)
-#define CopFILEGV(c) (c)->cop_filegv
-#define CopFILEGV_set(c,gv) ((c)->cop_filegv = gv)
-#define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv)
-#define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav)
-#define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch)
+#ifdef USE_ITHREADS
+# define CopFILE(c) ((c)->cop_file)
+# define CopFILEGV(c) (CopFILE(c) \
+ ? gv_fetchfile(CopFILE(c)) : Nullgv)
+# define CopFILE_set(c,pv) ((c)->cop_file = savepv(pv)) /* XXX */
+# define CopFILESV(c) (CopFILE(c) \
+ ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv)
+# define CopFILEAV(c) (CopFILE(c) \
+ ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav)
+# define CopSTASH(c) (CopSTASHPV(c) \
+ ? gv_fetchstash(CopSTASHPV(c)) : Nullhv)
+# define CopSTASH_set(c,hv) ((c)->cop_stashpv = HvNAME(hv)) /* XXX */
+# define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = pv)
+# define CopSTASHPV(c) ((c)->cop_stashpv)
+#else
+# define CopFILEGV(c) ((c)->cop_filegv)
+# define CopFILEGV_set(c,gv) ((c)->cop_filegv = gv)
+# define CopFILE_set(c,pv) ((c)->cop_filegv = gv_fetchfile(pv))
+# define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv)
+# define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav)
+# define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch)
+# define CopSTASH(c) ((c)->cop_stash)
+# define CopSTASH_set(c,hv) ((c)->cop_stash = hv)
+# define CopSTASHPV(c) (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch)
+#endif /* USE_ITHREADS */
+
#define CopLINE(c) ((c)->cop_line)
-#define CopLINE_set(c,l) ((c)->cop_line = (l))
+#define CopLINE_inc(c) (++CopLINE(c))
+#define CopLINE_dec(c) (--CopLINE(c))
+#define CopLINE_set(c,l) (CopLINE(c) = (l))
/*
* Here we have some enormously heavy (or at least ponderous) wizardry.