#define DD_CONST_VIA_RV2CV PERL_VERSION_GE(5,11,2)
+#define DD_GROW_VIA_BLOCKHOOK PERL_VERSION_GE(5,13,3)
+
#define LEX_NORMAL 10
#define LEX_INTERPNORMAL 9
PERL_UNUSED_VAR(user_data);
+ if (!DD_AM_LEXING)
+ return o; /* not lexing? */
+
if (in_declare) {
call_done_declare(aTHX);
return o;
if (kid->op_type != OP_GV) /* not a GV so ignore */
return o;
- if (!DD_AM_LEXING)
- return o; /* not lexing? */
-
if (DD_DEBUG_TRACE) {
printf("Checking GV %s -> %s\n", HvNAME(GvSTASH(kGVOP_gv)), GvNAME(kGVOP_gv));
}
return o;
}
+#if DD_GROW_VIA_BLOCKHOOK
+
+static void dd_block_start(pTHX_ int full)
+{
+ PERL_UNUSED_VAR(full);
+ if (SvLEN(PL_linestr) < 8192)
+ (void) lex_grow_linestr(8192);
+}
+
+#else /* !DD_GROW_VIA_BLOCKHOOK */
+
OP* dd_pp_entereval(pTHX) {
dSP;
STRLEN len;
return o;
}
+#endif /* !DD_GROW_VIA_BLOCKHOOK */
+
static I32 dd_filter_realloc(pTHX_ int idx, SV *sv, int maxlen)
{
const I32 count = FILTER_READ(idx+1, sv, maxlen);
setup()
CODE:
if (!initialized++) {
- hook_op_check(OP_RV2CV, dd_ck_rv2cv, NULL);
+#if DD_GROW_VIA_BLOCKHOOK
+ static BHK bhk;
+#if PERL_VERSION_GE(5,13,6)
+ BhkENTRY_set(&bhk, bhk_start, dd_block_start);
+#else /* <5.13.6 */
+ BhkENTRY_set(&bhk, start, dd_block_start);
+#endif /* <5.13.6 */
+ Perl_blockhook_register(aTHX_ &bhk);
+#else /* !DD_GROW_VIA_BLOCKHOOK */
hook_op_check(OP_ENTEREVAL, dd_ck_entereval, NULL);
+#endif /* !DD_GROW_VIA_BLOCKHOOK */
+ hook_op_check(OP_RV2CV, dd_ck_rv2cv, NULL);
#if !DD_CONST_VIA_RV2CV
hook_op_check(OP_CONST, dd_ck_const, NULL);
#endif /* !DD_CONST_VIA_RV2CV */