From e56f9dbec6d2f3540f90ddc5ccfde3e9ededb88f Mon Sep 17 00:00:00 2001 From: Reini Urban Date: Tue, 16 Oct 2018 11:32:20 +0200 Subject: [PATCH] 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] --- cop.h | 5 +---- op.h | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cop.h b/cop.h index f2caeff2d1b..d6dacc9ea95 100644 --- a/cop.h +++ b/cop.h @@ -393,9 +393,6 @@ string/length pair. struct cop { BASEOP - /* On LP64 putting this here takes advantage of the fact that BASEOP isn't - an exact multiple of 8 bytes to save structure padding. */ - line_t cop_line; /* line # of this command */ /* label for this construct is now stored in cop_hints_hash */ #ifdef USE_ITHREADS PADOFFSET cop_stashoff; /* offset into PL_stashpad, for the @@ -547,7 +544,7 @@ be zero. #define CopLABEL_alloc(pv) ((pv)?savepv(pv):NULL) #define CopSTASH_ne(c,hv) (!CopSTASH_eq(c,hv)) -#define CopLINE(c) ((c)->cop_line) +#define CopLINE(c) ((c)->op_line) #define CopLINE_inc(c) (++CopLINE(c)) #define CopLINE_dec(c) (--CopLINE(c)) #define CopLINE_set(c,l) (CopLINE(c) = (l)) diff --git a/op.h b/op.h index 7ba092919a1..c700e214ebd 100644 --- a/op.h +++ b/op.h @@ -66,7 +66,8 @@ typedef PERL_BITFIELD16 Optype; PERL_BITFIELD16 op_typechecked:1; \ U8 op_flags; \ U8 op_private; \ - U8 op_rettype; + U8 op_rettype; \ + line_t op_line; /* line # of this command */ #endif /* Class::XSAccessor abuses this */