From 5ada1e0a16bdce2e2552727bc567979c1bc9b617 Mon Sep 17 00:00:00 2001 From: Reini Urban Date: Wed, 31 Oct 2012 13:52:56 -0500 Subject: [PATCH] BC: add ix to -Dv debug output --- STATUS | 17 ++++++++++++----- bytecode.pl | 11 ++++++++--- lib/B/Bytecode.pm | 1 + 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/STATUS b/STATUS index ac76b22d9..77f964602 100644 --- a/STATUS +++ b/STATUS @@ -1,10 +1,11 @@ 5.8, 5.6 and earlier had a good core perl compiler, but we are much better. -Our Bytecode compiler disabled for 5.6, we keep the old. The old core compiler -fails 50% but in mine is a 5.6 blocker. +Our Bytecode compiler disabled for 5.6, we keep the old. The old core +compiler fails 50% but in mine is a 5.6 blocker. Bytecode is only stable for >=5.8, non-debugging, threaded. -C is used in production, but a bit unstable, not all methods packages are detected. +C is used in production, but a bit unstable, not all methods packages +are detected. CC is very unstable and slow, work in progress. @@ -95,7 +96,7 @@ t/bytecode 27,46 t/c - t/cc 14,21,30,46,50,103,105 -5.15.7: +5.16.1: t/bytecode 27,46 t/c - t/cc 14,21,30,46,50,103,105 @@ -114,10 +115,16 @@ generally: pass 100% 5.10.1 pass 100% 5.12.4 pass 100% 5.14.2 pass 100% -5.15.7 fail 4% (unshare_hek) Moose MooseX::Types DateTime DateTime::TimeZone +5.16.1 fail 4% (unshare_hek) Moose MooseX::Types DateTime DateTime::TimeZone +5.17.6 ?? Run-time tests not yet fully done +5.17.x status +----------- +PADLIST support not yet stable. +op_static fixed since 5.17.6, 5.17.2-5.17.5 are unusable without -fno-destruct + 5.16 status ----------- new XSLoader:load_file diff --git a/bytecode.pl b/bytecode.pl index e37cb0420..b865e6eed 100644 --- a/bytecode.pl +++ b/bytecode.pl @@ -42,7 +42,7 @@ BEGIN /* -*- buffer-read-only: t -*- * * Copyright (c) 1996-1999 Malcolm Beattie - * Copyright (c) 2008,2009,2010,2011 Reini Urban + * Copyright (c) 2008,2009,2010,2011,2012 Reini Urban * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -465,7 +465,7 @@ package B::Asmdata; printf BYTERUN_C "\t\tDEBUG_v(Perl_deb(aTHX_ \"(insn %%3d) $insn $argtype:%s\\n\", insn, $printarg%s));\n", $argfmt, ($argtype =~ /index$/ ? ', (int)ix' : ''); if ($insn eq 'newopx' or $insn eq 'newop') { - print BYTERUN_C "\t\tDEBUG_v(Perl_deb(aTHX_ \"\t [%s]\\n\", PL_op_name[arg>>7]));\n"; + print BYTERUN_C "\t\tDEBUG_v(Perl_deb(aTHX_ \"\t [%s %d]\\n\", PL_op_name[arg>>7], bstate->bs_ix));\n"; } if ($fundtype eq 'PV') { print BYTERUN_C "\t\tDEBUG_v(Perl_deb(aTHX_ \"\t BGET_PV(arg) => \\\"%s\\\"\\n\", bstate->bs_pv.xpv_pv));\n"; @@ -482,9 +482,14 @@ package B::Asmdata; print BYTERUN_C "\t\tif (force)\n\t" if $unsupp; print BYTERUN_C "\t\tBSET_$insn($lvalue$optarg);\n"; my $optargcast = $optarg eq ", arg" ? ", $printarg" : ''; + $optargcast .= ($insn =~ /x$/ and $optarg eq ", arg" ? ", bstate->bs_ix-1" : ''); printf BYTERUN_C "\t\tDEBUG_v(Perl_deb(aTHX_ \"\t BSET_$insn($lvalue%s)\\n\"$optargcast));\n", $optarg eq ", arg" - ? ($fundtype =~ /(strconst|pvcontents)/ ? ', \"%s\"' : ", ".($argtype =~ /index$/ ? '0x%'.$UVxf : $argfmt)) + ? ($fundtype =~ /(strconst|pvcontents)/ + ? ($insn =~ /x$/ ? ', \"%s\" ix:%d' : ', \"%s\"') + : (", " .($argtype =~ /index$/ ? '0x%'.$UVxf : $argfmt) + .($insn =~ /x$/ ? ' ix:%d' : '')) + ) : ''; } elsif ($flags =~ /s/) { # Store instructions to bytecode_obj_list[arg]. "lvalue" field is rvalue. diff --git a/lib/B/Bytecode.pm b/lib/B/Bytecode.pm index 3ca45a89e..ba12455d7 100644 --- a/lib/B/Bytecode.pm +++ b/lib/B/Bytecode.pm @@ -652,6 +652,7 @@ sub B::PAD::bsave { my @array = $av->ARRAY; $_ = $_->ix for @array; # save the elements $av->B::NULL::bsave($ix); + # av_extend always allocs 3 asm "av_extend", scalar @array if @array; asm "av_pushx", $_ for @array; }