B-C

 view release on metacpan or  search on metacpan

.travis.yml  view on Meta::CPAN


before_install:
  - mkdir /home/travis/bin || true
  - ln -s `which true` /home/travis/bin/cpansign
  - rm t/CORE/v5.14/C-COMPILED/{testc,template}.pl
  - eval $(curl https://travis-perl.github.io/init) --auto

install:
  - export COVERAGE=0 AUTOMATED_TESTING=1
  - cpan-install --deps
  - cpan-install IPC::Run B::Flags Opcodes IO::Socket::SSL JSON::XS LWP::UserAgent
  - cpan-install Net::SSLeay Net::LibIDN Net::IDN::Encode Net::DNS EV
  - cpan-install Coro || cpan-install RURBAN/Coro-6.4801.tar.gz

script: "perl Makefile.PL && make && make testfast"

notifications:
  irc: "irc.perl.org#compiler"
  recipients:
    - perl-compiler@googlegroups.com
  email:

Changes  view on Meta::CPAN

        Save some CvXSUBANY values, esp. relocate any_ptr if possible:
          POSIX::is*, DBI, List::MoreUtils::*_iterator.
          The any_i32 values are already set in the boot section of the XS.
        Fixed initialization of foreign Encodings (#365),
          fixed initialization of old Encode versions < 2.58 also (#305)
        * CC (1.16): Strip binary BM chunk from comppad names (CC names) < 5.8.8 (#363)
        * perlcc (2.20): Strip wrong version-less -I<site_perl> (#366)
        * Makefile.PL: Install into archlib on 5.8 and 5.6 (#358)

1.49 2014-07-12 rurban
        * C: Changed IO::Socket::SSL warning to recommend >= 1.995.
          1.996 even has some perlcc specific usage documentation (#317)
        Fix PerlIO::scalar XS bootstrap forced by __DATA__ (#360)
          We sometimes missed it

1.48 2014-07-11 rurban
        Fixed C walker and 5.18-5.20 Bytecode.
        This is the major version which cPanel will use for 5.14.4. With the next
        versions we'll start working on -m and buildcc, to split packages into shared libs.
        And use B::CC and/or rperl compiled modules selectively.

Changes  view on Meta::CPAN

          not used by user code. The compiler loads and dumps now additionally only the
          heavy parts for utf8 and bytes, and utf8 for m///i, and AnyDBM for dbmopen,
          PerlIO::Scalar for __DATA__ handles, and Coro::State::_jit if required, but
          nothing else.
        Fix for missing RTLD_NOLOAD on BSD, needed for run-time remap of compile-time
          XS symbols via dlsym (#351)
        Special-case XS loading of Moose.xs from Class::MOP (#350)
        Better fix for mult. match once by checking OP_MATCH with ONCE flags in C.xs also (#274)
          but there are still some platforms without pmop->op_pmregexp in the C.xs detection runloop
        Add op_lastsib bit for 5.21.2
        Changed IO::Socket::SSL warning as our patch was rejected upstream.
          Need to maintain now a fork cPanel::IO::Socket::SSL to be able to use compiled
          IO::Socket::SSL servers. (#317)
        * Stackobj (1.12): Harmonize RV checks (fixes cc 105 -O1 and -O2)
        * Bytecode (1.16): Replace each %hash with foreach keys in walksymtable also (#307)
        Do not store main_cv->START, empty optree since 5.18
        Add op_lastsib for 5.21.2, but sort still broken with PERL_OP_PARENT
        * Assembler (1.12): error if a PUT method misses an argument
        * perlcc (2.19): -B produces again -H bytecode, runnable without -MByteLoader.
        Fix default output name from a.outexe to a.exe on a windows-based OS.
        * Makefile.PL: fix installation of cc_runtime.h for B::CC

1.47 2014-06-11 rurban

Changes  view on Meta::CPAN

	Save @ISA for all included packages, esp. DynaLoader dependencies (#308)
        Replace each %hash with foreach sort keys (#307)
	Set ${^GLOBAL_PHASE} with -O3 for END and DESTRUCT (#197, #208)
	Do not store invalid GvCV symbols, only cv or &sv_list entries (#313)
	Support GvFORM pseudo CVs (B::FM objects) on 5.10 (#149)
	Support local $/ = "somestring" (only used empty values before) (#314),
          A regression from 1.43
	Support local $\ = "somestring" (#318), also a regression from 1.43
	Fix special 5.6. associations for $, $\ as they are no SVs there (#306)
        Fix wrong caching of internal LEXWARN symbols (#322)
        Warn on bad IO::Socket::SSL versions 1.956-1.983 which would SEGV if used as server (#317)
        Support __DATA__ blocks in packages without printing wrong warnings (#310)
	Support ->(maybe|next)::(method|can) mro method calls (#324, #301)
	Support mro c3 (#316)
	Support @- @LAST_MATCH_START, the array of the last submatches (#281, #220, #295)
	Workaround a 5.18 de-optimization which disabled ++PL_sv_objcount on bless
	  by adding it if a DESTROY method exists. This will fail since 5.18 if DESTROY
	  is added at run-time. (#208, #197)
        Add new init0 section to initialize -fppaddr ops before init, not afterwards. (#330)
          Needed to call utf8::SWASHINIT at init with CALLREGCOMP and /i
        Avoid duplicate PL_utf8_tofold ToCf swash initialization with 5.18 (#330)

Makefile.PL  view on Meta::CPAN

#    }
#}
my $have_byteloader = $] < 5.022 ? 1 : check_byteloader();

# does not work with miniperl
sub b_c_deps {
    my $X = $^X =~ m/\s/ ? qq{"$^X"} : $^X;
    my $blib = "-I".File::Spec->catfile(qw(.. .. lib auto))
      ." -I".File::Spec->catfile(qw(.. .. lib));
    my $runperl = $X . ($CORE ? ' '.$blib : "");
    return "AnyDBM_File AutoLoader B B::AV B::Asmdata B::BINOP B::BM B::C B::C::Config B::C::InitSection B::C::Section B::CC B::COP B::CV B::FAKEOP B::FM B::GV B::HE B::HV B::INVLIST B::IO B::IV B::LEXWARN B::LISTOP B::LOGOP B::LOOP B::MAGIC B::METHO...
    return `$runperl -Ilib -mB::C -mO -MB -e"B::C::collect_deps()"`;
}

# does not work with miniperl
sub write_b_c_config {
    my $version = shift;
    mkdir "lib/B/C" unless -d "lib/B/C";
    my $b_c_deps = b_c_deps();
    $b_c_deps .= " Socket" if $] > 5.021;
    open PH, ">", "lib/B/C/Config.pm";

README  view on Meta::CPAN

  binary, such as BEGIN { chdir $dir }, i.e. most system and IO calls. use
  INIT {} instead.

* p5p Carp >= 1.42 is broken. 5.26++, rather use cperl.

* Certain XS module using compile-time pointers need special workarounds:

  * DBI patched by the compiler (#359)
  * Encode > 2.58 (#71, #305, RT 94221), patched by the compiler
  * Net::DNS > 0.67 (#305, RT 94069)
  * IO::Socket::SSL > 1.995 (#317, RT 95452)
  * DBD::mysql > 4.027 (RT 97625)
  * Todo: FCGI, Coro, Moose with meta->make_immutable
  * Class::XSAccessor see t/testc.sh 400 for 2 of 3 possibilities how to use it

Mailinglist:
  http://groups.google.com/group/perl-compiler perl-compiler@googlegroups.com

INSTALL

cpan B::C

STATUS  view on Meta::CPAN

  byteloader binmode for 5.18
  mro and maybe::next

fixed with 1.46:
  global destruction of our and global objects
  utf8 qr and utf8 /i initialization with -fppaddr
  @-
  lexical warnings on 5.8
  -O4 CvSTART cops
  mro: c3 and maybe|next:: method calls
  Encode dlsym patching of compile-time XS handles (Net::DNS, IO::Socket::SSL)
  $/, $@ and $\, esp. when localized
  dump all used @ISA's
  GvFORM pseudo CVs (B::FM) on 5.10
  __DATA__ blocks in packages without printing wrong warnings
  Replace each %hash with foreach sort keys (no random misses of functions)

fixed with 1.44:
  SvLEN and PV ptr for empty shared hash keys
  cop_hints to support lexical numeric hints pragmas (use bytes, use open, ...)
  -O3 with ~ and ~~ formatstrings

lib/B/C.pm  view on Meta::CPAN

  warn sprintf( "saving %s CV 0x%x as %s\n", $fullname, $$cv, $sym )
    if $debug{cv};
  if (!$$root and $] < 5.010) {
    $package_pv = $cvstashname;
    push_package($package_pv);
  }
  if ($fullname eq 'utf8::SWASHNEW') { # bypass utf8::AUTOLOAD, a new 5.13.9 mess
    load_utf8_heavy();
  }

  if ($fullname eq 'IO::Socket::SSL::SSL_Context::new') {
    if ($IO::Socket::SSL::VERSION ge '1.956' and $IO::Socket::SSL::VERSION lt '1.995') {
      # See https://code.google.com/p/perl-compiler/issues/detail?id=317
      # https://rt.cpan.org/Ticket/Display.html?id=95452
      warn "Warning: Your IO::Socket::SSL version $IO::Socket::SSL::VERSION is unsupported to create\n".
           "  a server. You need to upgrade IO::Socket::SSL to at least 1.995 [CPAN #95452]\n";
    }
  }

  if (!$$root && !$cvxsub) {
    my $reloaded;
    if ($cvstashname =~ /^(bytes|utf8)$/) { # no autoload, force compile-time
      force_heavy($cvstashname);
      $cv = svref_2object( \&{$cvstashname."::".$cvname} );
      $reloaded = 1;
    } elsif ($fullname eq 'Coro::State::_jit') { # 293

ramblings/yapceu2015.html  view on Meta::CPAN

# Development

Until 1.52, the final version Sep 2014, we fixed:

- global destruction (rewrite)
- Dynaloader/XSLoader handling
- tons of corner cases detected in the testsuite
  (added mro, utf8, re tests), and with modules
- ~5 CPAN module fixes

esp. DBI, Encode, Net::DNS, IO::Socket::SSL, DBD::mysql for
compile-time stored pointers, being restored at run-time, boom!

---
# Beware

Still the old golden rule for the compiler:

**BEGIN for compile-time, INIT for run-time initializations.**

Esp. do not compile pointers into your shared library, initialize them

t/issue95.t  view on Meta::CPAN

# http://code.google.com/p/perl-compiler/issues/detail?id=95
# IO::Socket::blocking method found in \@ISA
# methods not found. see t/testc.sh -DCsP,-v -O0 95
use strict;
BEGIN {
  unshift @INC, 't';
  require TestBC;
}
use Test::More;
use Config;
eval "use IO::Socket::SSL";
if ($@) {
  plan skip_all => "IO::Socket::SSL required for testing issue95" ;
} else {
  plan tests => 5;
}

my $issue = <<'EOF';
use IO::Socket::INET   ();
use IO::Socket::SSL    ('inet4');
use Net::SSLeay        ();
use IO                 ();
use Socket             ();

my $handle = IO::Socket::SSL->new(SSL_verify_mode =>0);
$handle->blocking(0);
print "ok";
EOF

my $typed = <<'EOF';
use IO::Socket::SSL();
my IO::Handle $handle = IO::Socket::SSL->new(SSL_verify_mode =>0);
$handle->blocking(0);
print "ok";
EOF

my $ITHREADS = $Config{useithreads};

sub diagv {
  diag @_ if $ENV{TEST_VERBOSE};
}

t/issue95.t  view on Meta::CPAN


compile_check(1,'C,-O3,-UB','ccode95i',$issue,"untyped");
compile_check(2,'C,-O3,-UB','ccode95i',$typed,'typed');

use B::C ();
# see #310: Warning: unable to close filehandle DATA properly
# also: Constant subroutine HUGE_VAL redefined (5.16.3, 5.16.3-nt) #367
my $qr = '^(ok|Warning: unable to close filehandle.*\nok|Constant subroutine HUGE_VAL redefined.*\nok)$';
my $todo = ($B::C::VERSION lt '1.42_61') ? "TODO" : "";
# bad: 1.956 - 1.984
if ($IO::Socket::SSL::VERSION ge '1.956' and $IO::Socket::SSL::VERSION lt '1.984') {
  $todo = "TODO [cpan #95452] bad IO::Socket::SSL $IO::Socket::SSL::VERSION, ";
}
$todo = "TODO 5.18 \#356" if $] >= 5.018; # double free or corruption
$todo = "TODO <5.8.8" if $] < 5.008008;
ctest(5,$qr,'C,-O3','ccode95i',$issue, $todo.' run');

t/mymodules  view on Meta::CPAN

HTML::Template
HTTP::Daemon::App
HTTP::Date
IO
IO::CaptureOutput
IO::Compress::Bzip2
IO::Compress::Gzip
IO::Scalar
IO::Socket::ByteCounter
IO::Socket::INET6
IO::Socket::SSL
IO::String
IO::Stty
IO::Tty
IO::Uncompress::Gunzip
IP::Country
IPC::Run3
Image::Size
JSON::Syck
LWP
Lchown

t/testc.sh  view on Meta::CPAN

}
# === run-time ===
print $out "o";
kill 0, $pid; 			     # BAD! warn? die?
print "k" if "test" eq read $in, my $x, 4;
unlink "pcc.tmp";
'
result[93]='o'
tests[931]='my $f;BEGIN{open($f,"<README");}read $f,my $in, 2; print "ok"'
tests[932]='my $f;BEGIN{open($f,">&STDOUT");}print $f "ok"'
tests[95]='use IO::Socket::SSL();
my IO::Handle $handle = IO::Socket::SSL->new(SSL_verify_mode =>0);
$handle->blocking(0);
print "ok";'
tests[96]='defined(&B::OP::name) || print q(ok)'
tests[97]='use v5.12; print q(ok);'

# from here on we test CC specifics only

# CC types and arith
tests[101]='my ($r_i,$i_i,$d_d)=(0,2,3.0); $r_i=$i_i*$i_i; $r_i*=$d_d; print $r_i;'
result[101]='12'

t/testc.sh  view on Meta::CPAN

tests[314]='open FOO, ">", "ccode314.tmp"; print FOO "abc"; close FOO; open FOO, "<", "ccode314.tmp"; { local $/="b"; $in=<FOO>; if ($in eq "ab") { print "ok\n" } else { print qq(separator: "$/"\n\$/ is "$/"\nFAIL: "$in"\n)}}; unlink "ccode314.tmp"'
tests[3141]='open FOO, ">", "ccode3141.tmp"; print FOO "abc"; close FOO; open FOO, "<", "ccode3141.tmp"; { $/="b"; $in=<FOO>; if ($in eq "ab") { print "ok\n" } else { print qq(separator: "$/"\n\$/ is "$/"\nFAIL: "$in"\n)}}; unlink "ccode3141.tmp"'
tests[316]='
package Diamond_A; sub foo {};
package Diamond_B; use base "Diamond_A";
package Diamond_C; use base "Diamond_A";
package Diamond_D; use base ("Diamond_B", "Diamond_C"); use mro "c3";
package main; my $order = mro::get_linear_isa("Diamond_D");
              print $order->[3] eq "Diamond_A" ? "ok" : "not ok"; print "\n"'

tests[3170]='use Net::SSLeay();use IO::Socket::SSL();Net::SSLeay::OpenSSL_add_ssl_algorithms(); my $ssl_ctx = IO::Socket::SSL::SSL_Context->new(SSL_server => 1); print q(ok)'
tests[3180]='{ local $\ = "ok" ; print "" }'

if [[ $v518 -gt 0 ]]; then
  tests[317]='my $ok;
  sub kt { $ok = 1 }
  our $nested = qr/ (.) (??{ kt $1 }) /x;
  my $re = qr/^ ( (??{ $nested }) ) $ /x;
  "foo" =~ $re;
  print "ok\n" if $ok'
fi

t/testcc.sh  view on Meta::CPAN

}
# === run-time ===
print $out "o";
kill 0, $pid; 			     # BAD! warn? die?
print "k" if "test" eq read $in, my $x, 4;
unlink "pcc.tmp";
'
result[93]='o'
tests[931]='my $f;BEGIN{open($f,"<README");}read $f,my $in, 2; print "ok"'
tests[932]='my $f;BEGIN{open($f,">&STDOUT");}print $f "ok"'
tests[95]='use IO::Socket::SSL();
my IO::Handle $handle = IO::Socket::SSL->new(SSL_verify_mode =>0);
$handle->blocking(0);
print "ok";'
tests[96]='defined(&B::OP::name) || print q(ok)'
tests[97]='use v5.12; print q(ok);'

# from here on we test CC specifics only

# CC types and arith
tests[101]='my ($r_i,$i_i,$d_d)=(0,2,3.0); $r_i=$i_i*$i_i; $r_i*=$d_d; print $r_i;'
result[101]='12'

t/testcc.sh  view on Meta::CPAN

tests[314]='open FOO, ">", "ccode314.tmp"; print FOO "abc"; close FOO; open FOO, "<", "ccode314.tmp"; { local $/="b"; $in=<FOO>; if ($in eq "ab") { print "ok\n" } else { print qq(separator: "$/"\n\$/ is "$/"\nFAIL: "$in"\n)}}; unlink "ccode314.tmp"'
tests[3141]='open FOO, ">", "ccode3141.tmp"; print FOO "abc"; close FOO; open FOO, "<", "ccode3141.tmp"; { $/="b"; $in=<FOO>; if ($in eq "ab") { print "ok\n" } else { print qq(separator: "$/"\n\$/ is "$/"\nFAIL: "$in"\n)}}; unlink "ccode3141.tmp"'
tests[316]='
package Diamond_A; sub foo {};
package Diamond_B; use base "Diamond_A";
package Diamond_C; use base "Diamond_A";
package Diamond_D; use base ("Diamond_B", "Diamond_C"); use mro "c3";
package main; my $order = mro::get_linear_isa("Diamond_D");
              print $order->[3] eq "Diamond_A" ? "ok" : "not ok"; print "\n"'

tests[3170]='use Net::SSLeay();use IO::Socket::SSL();Net::SSLeay::OpenSSL_add_ssl_algorithms(); my $ssl_ctx = IO::Socket::SSL::SSL_Context->new(SSL_server => 1); print q(ok)'
tests[3180]='{ local $\ = "ok" ; print "" }'

if [[ $v518 -gt 0 ]]; then
  tests[317]='my $ok;
  sub kt { $ok = 1 }
  our $nested = qr/ (.) (??{ kt $1 }) /x;
  my $re = qr/^ ( (??{ $nested }) ) $ /x;
  "foo" =~ $re;
  print "ok\n" if $ok'
fi

t/testplc.sh  view on Meta::CPAN

}
# === run-time ===
print $out "o";
kill 0, $pid; 			     # BAD! warn? die?
print "k" if "test" eq read $in, my $x, 4;
unlink "pcc.tmp";
'
result[93]='o'
tests[931]='my $f;BEGIN{open($f,"<README");}read $f,my $in, 2; print "ok"'
tests[932]='my $f;BEGIN{open($f,">&STDOUT");}print $f "ok"'
tests[95]='use IO::Socket::SSL();
my IO::Handle $handle = IO::Socket::SSL->new(SSL_verify_mode =>0);
$handle->blocking(0);
print "ok";'
tests[96]='defined(&B::OP::name) || print q(ok)'
tests[97]='use v5.12; print q(ok);'
result[97]='ok'
tests[971]='use v5.6; print q(ok);'
result[971]='ok'
tests[98]='BEGIN{$^H{feature_say} = 1;}
sub test { eval(""); }
print q(ok);'

t/testplc.sh  view on Meta::CPAN

tests[312]='require Scalar::Util; eval "require List::Util"; print "ok"'
tests[314]='open FOO, ">", "ccode314.tmp"; print FOO "abc"; close FOO; open FOO, "<", "ccode314.tmp"; { local $/="b"; $in=<FOO>; if ($in eq "ab") { print "ok\n" } else { print qq(separator: "$/"\n\$/ is "$/"\nFAIL: "$in"\n)}}; unlink "ccode314.tmp"'
tests[3141]='open FOO, ">", "ccode3141.tmp"; print FOO "abc"; close FOO; open FOO, "<", "ccode3141.tmp"; { $/="b"; $in=<FOO>; if ($in eq "ab") { print "ok\n" } else { print qq(separator: "$/"\n\$/ is "$/"\nFAIL: "$in"\n)}}; unlink "ccode3141.tmp"'
tests[316]='
package Diamond_A; sub foo {};
package Diamond_B; use base "Diamond_A";
package Diamond_C; use base "Diamond_A";
package Diamond_D; use base ("Diamond_B", "Diamond_C"); use mro "c3";
package main; my $order = mro::get_linear_isa("Diamond_D");
              print $order->[3] eq "Diamond_A" ? "ok" : "not ok"; print "\n"'
tests[317]='use Net::SSLeay();use IO::Socket::SSL();Net::SSLeay::OpenSSL_add_ssl_algorithms(); my $ssl_ctx = IO::Socket::SSL::SSL_Context->new(SSL_server => 1); print q(ok)'
tests[318]='{ local $\ = "ok" ; print "" }'
tests[319]='#TODO Wide character warnings missing (bytes layer ignored)
use warnings q{utf8}; my $w; local $SIG{__WARN__} = sub { $w = $_[0] }; my $c = chr(300); open F, ">", "a"; binmode(F, ":bytes:"); print F $c,"\n"; close F; print $w'
tests[320]='#TODO No warnings reading in invalid utf8 stream (utf8 layer ignored)
use warnings "utf8"; local $SIG{__WARN__} = sub { $@ = shift }; open F, ">", "a"; binmode F; my ($chrE4, $chrF6) = (chr(0xE4), chr(0xF6)); print F "foo", $chrE4, "\n"; print F "foo", $chrF6, "\n"; close F; open F, "<:utf8", "a";  undef $@; my $line =...
tests[324]='package Master;
use mro "c3";
sub me { "Master" }
package Slave;
use mro "c3";



( run in 0.412 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )