Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions opcode.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions peep.c
Original file line number Diff line number Diff line change
Expand Up @@ -2205,14 +2205,14 @@ S_maybe_multideref(pTHX_ OP *start, OP *orig_o, UV orig_action, U8 hints)
/* if a custom array/hash access checker is in scope,
* abandon optimisation attempt */
if ( (o->op_type == OP_AELEM || o->op_type == OP_HELEM)
&& PL_check[o->op_type] != Perl_ck_null)
&& UNLIKELY(PL_check[o->op_type] != PL_check[PERL_CK_NULL]))
return;
/* similarly for customised exists and delete */
if ( (o->op_type == OP_EXISTS)
&& PL_check[o->op_type] != Perl_ck_exists)
&& UNLIKELY(PL_check[o->op_type] != PL_check[PERL_CK_EXISTS]))
return;
if ( (o->op_type == OP_DELETE)
&& PL_check[o->op_type] != Perl_ck_delete)
&& UNLIKELY(PL_check[o->op_type] != PL_check[PERL_CK_DELETE]))
return;

if ( o->op_type != OP_AELEM
Expand Down
27 changes: 27 additions & 0 deletions regen/opcode.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1114,13 +1114,40 @@ sub generate_opcode_h_pl_check {
INIT({
END


for (@ops) {
print "\t", tab(3, "Perl_$check{$_},"), "\t/* $_ */\n";
}

print <<~'END';

/* The final entries are function pointers not attached to an opcode.
* These are to be used to compare with function pointers in the earlier
* part of the array, since in some platforms (notably z/OS), it is
* undefined behavior to compare function pointers for equality, even
* though calling them will invoke the same function. IBM personnel say
* that the comparisons do work when the pointers are compiled in the same
* translation unit. Hence, ck_null in all positions in the array will
* have the same value. See GH #23399 */
END
my @perl_internal_extras = qw(ck_null ck_exists ck_delete);
for (@perl_internal_extras) {
print "\t", tab(3, "Perl_$_,"), "\n";
}

print <<~'END';
});

/* Indexes into PL_check for the comparison function pointers */
#ifdef PERL_IN_PEEP_C
END

for (my $i = 0; $i < @perl_internal_extras; $i++) {
my $index = @ops + $i;
my $define = uc $perl_internal_extras[$i];
print " #define PERL_$define $index\n";
}
print "#endif\n";
}

sub generate_opcode_h_pl_opargs {
Expand Down
Loading