Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 4a0483a

Browse files
committed
opline: move cop_line to BASEOP
Looking up COP's to find the error lines is inexact, slow and esp. 8% heavier than using less COP's and moving the opline to each op. On an average of 4 ops per line, and the reduced need for runtime nextstates of 90% - only lexstate changes and file beginning and the overhead of 5 ptrs per COP, we will win 4ptrs per reduced COP. On typical 10k src with 40k ops it will be a 4 ptrs(5-1)*10k memory win: 40kb (4 ops per line on average), plus the runtime win of ~about 4k ops, 8%. See [cperl #333]
1 parent dd6966a commit 4a0483a

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

cop.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,6 @@ string/length pair.
393393

394394
struct cop {
395395
BASEOP
396-
/* On LP64 putting this here takes advantage of the fact that BASEOP isn't
397-
an exact multiple of 8 bytes to save structure padding. */
398-
line_t cop_line; /* line # of this command */
399396
/* label for this construct is now stored in cop_hints_hash */
400397
#ifdef USE_ITHREADS
401398
PADOFFSET cop_stashoff; /* offset into PL_stashpad, for the
@@ -547,7 +544,7 @@ be zero.
547544
#define CopLABEL_alloc(pv) ((pv)?savepv(pv):NULL)
548545

549546
#define CopSTASH_ne(c,hv) (!CopSTASH_eq(c,hv))
550-
#define CopLINE(c) ((c)->cop_line)
547+
#define CopLINE(c) ((c)->op_line)
551548
#define CopLINE_inc(c) (++CopLINE(c))
552549
#define CopLINE_dec(c) (--CopLINE(c))
553550
#define CopLINE_set(c,l) (CopLINE(c) = (l))

op.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ typedef PERL_BITFIELD16 Optype;
5757
PERL_BITFIELD16 op_typechecked:1; \
5858
U8 op_flags; \
5959
U8 op_private; \
60-
U8 op_rettype;
60+
U8 op_rettype; \
61+
line_t op_line; /* line # of this command */
6162
#endif
6263

6364
/* Class::XSAccessor abuses this */

0 commit comments

Comments
 (0)