Created
November 26, 2016 15:06
-
-
Save titsuki/0f4e610ad501f3113bf7e16c9bfff965 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi. This is the qmail-send program at la.mx.develooper.com. | |
I'm afraid I wasn't able to deliver your message to the following addresses. | |
This is a permanent error; I've given up. Sorry it didn't work out. | |
<rakudobug@perl.org>: | |
This message is looping: it already has my Delivered-To line. (#5.4.6) | |
--- Below this line is a copy of the message. | |
Return-Path: <cookbook_000@yahoo.co.jp> | |
Received: (qmail 27271 invoked by alias); 26 Nov 2016 12:59:55 -0000 | |
X-Spam-Status: No, hits=-4.5 required=8.0 | |
tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS | |
X-Spam-Check-By: la.mx.develooper.com | |
Received: from nh502-vm7.bullet.mail.kks.yahoo.co.jp (HELO nh502-vm7.bullet.mail.kks.yahoo.co.jp) (183.79.56.152) | |
by la.mx.develooper.com (qpsmtpd/0.28) with SMTP; Sat, 26 Nov 2016 04:59:51 -0800 | |
Received: from [183.79.100.139] by nh502.bullet.mail.kks.yahoo.co.jp with NNFMP; 26 Nov 2016 12:59:46 -0000 | |
Received: from [183.79.100.135] by t502.bullet.mail.kks.yahoo.co.jp with NNFMP; 26 Nov 2016 12:59:46 -0000 | |
Received: from [127.0.0.1] by omp504.mail.kks.yahoo.co.jp with NNFMP; 26 Nov 2016 12:59:46 -0000 | |
X-Yahoo-Newman-Property: ymail-3 | |
X-Yahoo-Newman-Id: 782219.24104.bm@omp504.mail.kks.yahoo.co.jp | |
Received: (qmail 65801 invoked by uid 60001); 26 Nov 2016 12:59:46 -0000 | |
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.jp; s=yj20110701; t=1480165186; bh=nIkHWK1pSH2EyRnMDBFkTsj4Q7sztGApc0GJpSvTVHE=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:X-YMail-JAS:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=vnvIZ/BIq7L0+Mtwh66L4/oAg8QRZVgpHxS+MpPoYQoA3hdv8SHN6Y29C/e53mAgd6ShN4rKsDujhfzKsDe/PePRkKSBJgajl52A4lLavIoUjN6ORhmXErKDzebgbNC1yBKP9wG0mkuuIysoctiwSpQx/j2ngtM5/2duSc5ChYQ= | |
DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; | |
s=yj20110701; d=yahoo.co.jp; | |
h=Message-ID:X-YMail-OSG:Received:X-Mailer:X-YMail-JAS:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; | |
b=O0Cz8KjudQSV+uOF6fnMktQV+IY7/kOW/shZ3xe/F2yVmxp44+Kl0nyRO9HAB3EJ9JF2OvC6+tIHk3fJ4YU//kIav1bnJkeiHbT/zORL3/CU7IneChqA2faG3w9dywUtchAxylTDo7cYO4dS2cMCv+fJbBx+KTnpukOrUdGu/sE=; | |
Message-ID: <627393.52178.qm@web200212.mail.kks.yahoo.co.jp> | |
X-YMail-OSG: DJwBbfgVM1mSCDGzL5PxBO2wJ2OdqBkiJ4KjUrGLloM3v666gIyCPf3pqP1BKAhmhN7hQimWCratBtWrgs3xc7w9s2XAhxPG.RJExpuFuY8_wCyrWO0HlkD2jmh6t8xdKY4rvFBovY1Hi9F7mU18OWQZkrPRAXm6hCxnZbalhsYLIiCnoEgtcHQULo5zXK_ZQOEEeQ_3rk_ghMQsozvgUMfYbl9GPU8D4DYWP2tzhVia2h_MT3T5YRwlQFn5Vgj8xuN4ZdeO3nLvxvsnFPd6SGKvMIFC8PmaROMfEMf7Ct1mVelnNGHBABQrSJYKoCPOAmbRoKX_BiHhrcvlCKbttxLSY8Ritg.QyJbfbPViYd.LaXiNCkDoQ2lV1rdBtJqOp2OhNAzkyaNWWZaJ7rflt5n.HSVHgaSSYydM3t1WJGbIi1I2sq5ZHUFobukzIJywt_tzZh3kOM3On3enYvQ35jlLqwSQMwg42XPETKNGCiC_J6uw1ee9JScWtfnLIFUPE3gj2EKhtfTcLIrMi1mSlMn6WeSZHjL6udBt4Xg28w-- | |
Received: from [126.19.112.245] by web200212.mail.kks.yahoo.co.jp via HTTP; Sat, 26 Nov 2016 21:59:46 JST | |
X-Mailer: YahooMailWebService/0.8.111_70 | |
X-YMail-JAS: e6s_sE0VM1nCWHaHfxS5AMOrkHpAKyCAKWZ0i3uTohAfkZEkuaFU0zpxhFTDcM1Q3ppFk61X0bb.yqFVFu7Ei6OMVuHzT.oSUlD4VbY.DSNRM2vrbpUBymVi.BUrX7KAk_vZ | |
Date: Sat, 26 Nov 2016 21:59:46 +0900 (JST) | |
From: cookbook_000@yahoo.co.jp | |
Reply-To: cookbook_000@yahoo.co.jp | |
Subject: [BUG][NATIVECALL][RFC] CArray cannot allocate contiguous memory | |
To: "rakudobug@perl.org" <rakudobug@perl.org> | |
MIME-Version: 1.0 | |
Content-Type: text/plain; charset=iso-8859-1 | |
Content-Transfer-Encoding: quoted-printable | |
X-Virus-Checked: Checked | |
See the following codes and results.=0A=0A*** codes ***=0A=0A* t/05-pointer= | |
.c=0A----=0A#include <stdio.h>=0A#include <string.h>=0A#include <stdlib.h>= | |
=0A#include "05-pointer.h"=0A=0A#ifdef _WIN32=0A#define DLLEXPORT __declspe= | |
c(dllexport)=0A#else=0A#define DLLEXPORT extern=0A#endif=0A=0Adouble dot(st= | |
ruct Feature* lhs, struct Feature* rhs) {=0A=A0 =A0 double sum =3D 0.0;=0A= | |
=0A=A0 =A0 while(lhs->index !=3D -1 && rhs->index !=3D -1) {=0A=A0 =A0 =A0 = | |
=A0 if (lhs->index =3D=3D rhs->index) {=0A=A0 =A0 =A0 =A0 =A0 =A0 sum +=3D = | |
lhs->value * rhs->value;=0A=A0 =A0 =A0 =A0 =A0 =A0 lhs++;=0A=A0 =A0 =A0 =A0= | |
=A0 =A0 rhs++;=0A=A0 =A0 =A0 =A0 }=0A=A0 =A0 =A0 =A0 else if (lhs->index <= | |
rhs->index) {=0A=A0 =A0 =A0 =A0 =A0 =A0 lhs++;=0A=A0 =A0 =A0 =A0 }=0A=A0 = | |
=A0 =A0 =A0 else {=0A=A0 =A0 =A0 =A0 =A0 =A0 rhs++;=0A=A0 =A0 =A0 =A0 }=0A= | |
=A0 =A0 }=0A=A0 =A0 return sum;=0A}=0A----=0A=0A=0A*t/05-pointer.h=0A----= | |
=0A#if ! defined(HEADER_POINTER_H)=0A#define HEADER_POINTER_H=0A=0A#ifdef _= | |
_cplusplus=0Aextern "C" {=0A#endif=0A=0Astruct Feature {=0A=A0 int index;= | |
=0A=A0 double value;=0A} Feature;=0A=0Adouble dot(struct Feature*, struct F= | |
eature*);=0A=A0 =A0=A0=0A#ifdef __cplusplus=0A} /* closing brace for extern= | |
"C" */=0A#endif=0A=0A#endif /* HEADER_POINTER_H */=0A----=0A=0A=0A* t/Comp= | |
ileTestLib.pm=0A----=0Aunit module CompileTestLib;=0A=0Amy @cleanup; =A0# f= | |
iles to be cleaned up afterwards=0A=0Asub compile_test_lib($name) is export= | |
{=0A=A0 =A0 my ($c_line, $l_line);=0A=A0 =A0 my $VM =A0:=3D $*VM;=0A=A0 = | |
=A0 my $cfg :=3D $VM.config;=0A=A0 =A0 my $libname =3D $VM.platform-library= | |
-name($name.IO);=0A=A0 =A0 if $VM.name eq 'moar' {=0A=A0 =A0 =A0 =A0 my $o = | |
=A0=3D $cfg<obj>;=0A=0A=A0 =A0 =A0 =A0 # MoarVM exposes exposes GNU make di= | |
rectives here, but we cannot pass this to gcc directly.=0A=A0 =A0 =A0 =A0 m= | |
y $ldshared =3D $cfg<ldshared>.subst(/'--out-implib,lib$(notdir $@).a'/, "-= | |
-out-implib,$libname.a");=0A=0A=A0 =A0 =A0 =A0 $c_line =3D "$cfg<cc> -c $cf= | |
g<ccshared> $cfg<ccout>$name$o $cfg<cflags> t/$name.c";=0A=A0 =A0 =A0 =A0 $= | |
l_line =3D "$cfg<ld> $ldshared $cfg<ldflags> $cfg<ldlibs> $cfg<ldout>$libna= | |
me $name$o";=0A=A0 =A0 =A0 =A0 @cleanup =3D << "$libname" "$name$o" >>;=0A= | |
=A0 =A0 }=0A=A0 =A0 elsif $VM.name eq 'jvm' {=0A=A0 =A0 =A0 =A0 $c_line =3D= | |
"$cfg<nativecall.cc> -c $cfg<nativecall.ccdlflags> -o$name$cfg<nativecall.= | |
o> $cfg<nativecall.ccflags> t/04-nativecall/$name.c";=0A=A0 =A0 =A0 =A0 $l_= | |
line =3D "$cfg<nativecall.ld> $cfg<nativecall.perllibs> $cfg<nativecall.ldd= | |
lflags> $cfg<nativecall.ldflags> $cfg<nativecall.ldout>$libname $name$cfg<n= | |
ativecall.o>";=0A=A0 =A0 =A0 =A0 @cleanup =3D << $libname "$name$cfg<native= | |
call.o>" >>;=0A=A0 =A0 }=0A=A0 =A0 else {=0A=A0 =A0 =A0 =A0 die "Unknown VM= | |
; don't know how to compile test libraries";=0A=A0 =A0 }=0A=A0 =A0 shell($c= | |
_line);=0A=A0 =A0 shell($l_line);=0A}=0A=0Asub compile_cpp_test_lib($name) = | |
is export {=0A=A0 =A0 my @cmds;=0A=A0 =A0 my $VM =A0:=3D $*VM;=0A=A0 =A0 my= | |
$cfg :=3D $VM.config;=0A=A0 =A0 my $libname =3D $VM.platform-library-name(= | |
$name.IO);=0A=A0 =A0 @cleanup =3D $libname;=0A=A0 =A0 if $*DISTRO.is-win {= | |
=0A=A0 =A0 =A0 =A0 @cmds =A0 =A0=3D "cl /LD /EHsc /Fe$libname t/$name.cpp",= | |
=0A=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"g++ --shared -fPIC -o $libname t= | |
/$name.cpp",=0A=A0 =A0 }=0A=A0 =A0 else {=0A=A0 =A0 =A0 =A0 @cmds =A0 =A0= | |
=3D "g++ --shared -fPIC -o $libname t/$name.cpp",=0A=A0 =A0 =A0 =A0 =A0 =A0= | |
=A0 =A0 =A0 =A0"clang++ -stdlib=3Dlibc++ --shared -fPIC -o $libname t/$nam= | |
e.cpp",=0A=A0 =A0 }=0A=0A=A0 =A0 my (@fails, $succeeded);=0A=A0 =A0 for @cm= | |
ds -> $cmd {=0A=A0 =A0 =A0 =A0 my $handle =3D shell("$cmd 2>&1", :out);=0A= | |
=A0 =A0 =A0 =A0 my $output =3D $handle.out.slurp-rest;=0A=A0 =A0 =A0 =A0 if= | |
$handle.out.close.status {=0A=A0 =A0 =A0 =A0 =A0 =A0 @fails.push: "Running= | |
'$cmd':\n$output"=0A=A0 =A0 =A0 =A0 }=0A=A0 =A0 =A0 =A0 else {=0A=A0 =A0 = | |
=A0 =A0 =A0 =A0 $succeeded =3D 1;=0A=A0 =A0 =A0 =A0 =A0 =A0 last=0A=A0 =A0 = | |
=A0 =A0 }=0A=A0 =A0 }=0A=A0 =A0 fail @fails.join('=3D' x 80 ~ "\n") unless = | |
$succeeded;=0A}=0A=0A=0AEND {=0A=A0 =A0 # =A0 =A0say "cleaning up @cleanup[= | |
]";=0A=A0 =A0 unlink @cleanup;=0A}=0A=0A----=0A=0A=0A* t/05-pointer.t=0A---= | |
-=0Ause v6;=0Ause Test;=0Ause NativeCall;=0Ause lib <lib t>;=0Ause CompileT= | |
estLib;=0A=0Acompile_test_lib('05-pointer');=0A=0Aclass Feature is repr('CS= | |
truct') {=0A=A0 =A0 =A0 has int32 $.index;=0A=A0 =A0 =A0 has num64 $.value;= | |
=0A}=0A=0Amy sub dot(Feature, Feature) returns num64 is native("./05-pointe= | |
r") { * }=0A=0Amy CArray[Feature] $lhs .=3D new;=0Amy CArray[Feature] $rhs = | |
.=3D new;=0A$lhs[5] =3D Feature.new(index =3D> -1, value =3D> 0e0);=0A$rhs[= | |
5] =3D Feature.new(index =3D> -1, value =3D> 0e0);=0A=0Afor 1..5 -> $index = | |
{=0A=A0 =A0 $rhs[$index - 1] =3D Feature.new(index =3D> $index, value =3D> = | |
2.5e0);=0A=A0 =A0 $lhs[$index - 1] =3D Feature.new(index =3D> $index, value= | |
=3D> 2.5e0);=0A}=0A=0Afor ^5 {=0A=A0 =A0 is $lhs[$_].value, 2.5e0, "\$lhs[= | |
$_].value =3D 2.5e0";=0A=A0 =A0 is $rhs[$_].value, 2.5e0, "\$rhs[$_].value = | |
=3D 2.5e0";=0A=A0 =A0 is $lhs[$_].index, $_ + 1, "\$lhs[$_].index =3D {$_ += | |
1}";=0A=A0 =A0 is $rhs[$_].index, $_ + 1, "\$rhs[$_].index =3D {$_ + 1}";= | |
=0A}=0A=0Ais dot($lhs[0], $rhs[0]), [+] ((2.5 * 2.5) xx 5);=0A=0Adone-testi= | |
ng;=0A----=0A=0A*** results ***=0A----=0A$ mi6 test -v t/05-pointer.t=0A=3D= | |
=3D> Set PERL6LIB=3D/home/itoyota/Programs/p6-Foo/lib=0A=3D=3D> prove -e /h= | |
ome/itoyota/.rakudobrew/bin/../moar-nom/install/bin/perl6 -r -v t/05-pointe= | |
r.t=0At/05-pointer.t ..=A0=0Aok 1 - $lhs[0].value =3D 2.5e0=0Aok 2 - $rhs[0= | |
].value =3D 2.5e0=0Aok 3 - $lhs[0].index =3D 1=0Aok 4 - $rhs[0].index =3D 1= | |
=0Aok 5 - $lhs[1].value =3D 2.5e0=0Aok 6 - $rhs[1].value =3D 2.5e0=0Aok 7 -= | |
$lhs[1].index =3D 2=0Aok 8 - $rhs[1].index =3D 2p @cleanup[]";=0Aok 9 - $l= | |
hs[2].value =3D 2.5e0=0Aok 10 - $rhs[2].value =3D 2.5e0=0Aok 11 - $lhs[2].i= | |
ndex =3D 3=0Aok 12 - $rhs[2].index =3D 3=0Aok 13 - $lhs[3].value =3D 2.5e0= | |
=0Aok 14 - $rhs[3].value =3D 2.5e0=0Aok 15 - $lhs[3].index =3D 4=0Aok 16 - = | |
$rhs[3].index =3D 4=0Aok 17 - $lhs[4].value =3D 2.5e0=0Aok 18 - $rhs[4].val= | |
ue =3D 2.5e0=0Aok 19 - $lhs[4].index =3D 5=0Aok 20 - $rhs[4].index =3D 5=0A= | |
not ok 21 -=A0=0A=0A# Failed test at t/05-pointer.t line 33=0A# expected: '= | |
31.25'=0A# =A0 =A0 =A0got: '6.25'=0A1..21=0A# Looks like you failed 1 test = | |
of 21=0ADubious, test returned 1 (wstat 256, 0x100)=0AFailed 1/21 subtests= | |
=A0=0A=0ATest Summary Report=0A-------------------=0At/05-pointer.t (Wstat:= | |
256 Tests: 21 Failed: 1)=0A=A0 Failed test: =A021=0A=A0 Non-zero exit stat= | |
us: 1=0AFiles=3D1, Tests=3D21, =A01 wallclock secs ( 0.02 usr =A00.00 sys += | |
=A00.51 cusr =A00.06 csys =3D =A00.59 CPU)=0AResult: FAIL=0A=0A----=0A=0AI= | |
n the above example, dot method computes the dot product of given two vecto= | |
rs. (It accepts each entry address.)=0AHence, in the test case 21, dot($lhs= | |
[0],$rhs[0]) should return 31.25e0, where $lhs[0] is the entry address of t= | |
he CArray (2.5e0) xx 5 and $rhs[0] is the entry address of the other CArray= | |
(2.5e0) xx 5.=0A=0AHowever, in fact, it returns=A06.25e0.=A0=0AIt seems th= | |
at dot function in C side receive the entry address of the given vector cor= | |
rectly, but it fails in incrementing the pointer address and points a irrel= | |
evant address, because CArray cannot allocate contiguous memory.=0AI think = | |
that NativeCall needs something for allocating contiguous memory.=0A=0A(I a= | |
nnoyed by this error while creating a libsvm bindings for Perl 6:=A0https:/= | |
/github.com/cjlin1/libsvm/blob/master/svm.cpp#L294-L314 )=0A=0A=0A=0A$ perl= | |
6 --version=0AThis is Rakudo version 2016.10-309-g3dcc52b built on MoarVM v= | |
ersion 2016.10-71-g9d5c874=0Aimplementing Perl 6.c. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment