Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102083 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81080 invoked from network); 26 Apr 2018 22:29:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Apr 2018 22:29:56 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain zend.com from 104.47.33.124 cause and error) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 104.47.33.124 mail-bn3nam01on0124.outbound.protection.outlook.com Received: from [104.47.33.124] ([104.47.33.124:29824] helo=NAM01-BN3-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3B/6A-19179-2E252EA5 for ; Thu, 26 Apr 2018 18:29:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=RWSoftware.onmicrosoft.com; s=selector1-zend-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=DggYICJqYhcj8kJ3TRtTzYN547gLiKpi1fBhW9W5LPk=; b=V+6pZMNRLW6p6Elf2AID4v0qGoiIhcdUdoGUa9zbLqnlR3RHeNxK6q+7w0LzDxQQjoEaxzFWCRuJ+C8mDl0t18zGaI9qjHKNRyVibMhI6Uv98mUrgsxKA6ECQJAwCTxN1yCzHUfq9HjoKMPQv8LGf1GXFu+mKciSOsCu58sirrk= Received: from BN6PR02MB3234.namprd02.prod.outlook.com (10.161.152.32) by BN6PR02MB2865.namprd02.prod.outlook.com (10.175.96.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.696.13; Thu, 26 Apr 2018 22:29:49 +0000 Received: from BN6PR02MB3234.namprd02.prod.outlook.com ([fe80::b5e1:42c:d6ad:56c]) by BN6PR02MB3234.namprd02.prod.outlook.com ([fe80::b5e1:42c:d6ad:56c%13]) with mapi id 15.20.0715.018; Thu, 26 Apr 2018 22:29:48 +0000 To: Michael Wallner CC: Stanislav Malyshev , Zeev Suraski , Xinchen Hui , Nikita Popov , Bob Weinand , "Anatol Belski (ab@php.net)" , "PHP internals list" Thread-Topic: [PHP-DEV] PHP FFI extenesion Thread-Index: AQHT0yrBnLpXxgz1HEWdw/jxKSLJkaQEFM4AgABk3QCAABugkIAOJYwAgAAf5oOAAJf2BYAAERMAgAAwmfY= Date: Thu, 26 Apr 2018 22:29:48 +0000 Message-ID: References: <56794c33-a728-d399-2462-b62ba1b7a509@gmail.com> <739e66c6-e60b-005e-acb0-d5c4fb2da11d@php.net> <6760eb1f-4345-48d2-a5c2-727cd98e3ac2@email.android.com> , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [212.232.72.197] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BN6PR02MB2865;7:P5VeD3G6LMOVAY/xOPde4i1idM3fyoTYxSMQbi+BJVVJixkWRvE6pV1C4Nt8Re/Iw1ux55YU2+06UzDUb/phMM7sqOPc6xmama78/TKNnaXzfl8lYCGKLj0QfKxeET5fzdh5CCSZEb6vKicVfzPVyb2tTJzjHOvoOCxa06VdmmGjwdreqIMbx7+7YUc1Vy+Tf5jhaUXEaKB04Z7jxW4GevoAHZuq4ILA1aLCW2irARLbbYLN9+n2g56xn/sWulLo x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10019020)(366004)(396003)(376002)(346002)(39380400002)(39850400004)(199004)(189003)(2900100001)(5250100002)(3280700002)(229853002)(6116002)(6606003)(68736007)(2906002)(93886005)(6246003)(86362001)(6916009)(99286004)(5660300001)(606006)(106356001)(575784001)(6436002)(26005)(966005)(446003)(3660700001)(186003)(105586002)(55016002)(39060400002)(14454004)(97736004)(486006)(33656002)(476003)(236005)(19627405001)(11346002)(54906003)(9686003)(74316002)(7736002)(7696005)(54896002)(6306002)(59450400001)(6506007)(8936002)(53546011)(81156014)(102836004)(3846002)(81166006)(53936002)(76176011)(25786009)(478600001)(316002)(8676002)(4326008)(66066001)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR02MB2865;H:BN6PR02MB3234.namprd02.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:BN6PR02MB2865; x-ms-traffictypediagnostic: BN6PR02MB2865: authentication-results: spf=none (sender IP is ) smtp.mailfrom=dmitry@zend.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(166708455590820)(85827821059158)(251416522907027); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3231232)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011);SRVR:BN6PR02MB2865;BCL:0;PCL:0;RULEID:;SRVR:BN6PR02MB2865; x-forefront-prvs: 0654257CF5 received-spf: None (protection.outlook.com: zend.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 7dTurxLlgkt7Mk/S3gDLjVYi0vuNEqjswdDLabvgWd2bPwKB1Wd/y+wzgJ7A/V+d6dTqkF+0lDAswy14nvxadjRBOg4UW+xYrMNRaw/qAZqryHCZcHtmHfkNpH37bSTiRaVNzPsWPPoWcn8kZ4jspPjMWYjJZlaWVCWYCVRsZlRC75nm8DeDHasQ71dmPWx7 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/alternative; boundary="_000_BN6PR02MB3234347C74B31EDF3905F8C9BF8E0BN6PR02MB3234namp_" MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: f40791c2-796c-4589-59d2-08d5abc53881 X-OriginatorOrg: zend.com X-MS-Exchange-CrossTenant-Network-Message-Id: f40791c2-796c-4589-59d2-08d5abc53881 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Apr 2018 22:29:48.6138 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 32210298-c08b-4829-8097-6b12c025a892 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB2865 Subject: Re: [PHP-DEV] PHP FFI extenesion From: dmitry@zend.com (Dmitry Stogov) --_000_BN6PR02MB3234347C74B31EDF3905F8C9BF8E0BN6PR02MB3234namp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi Michael, I've, also, tried to implement FFI definition pre-loading (currently just H= files). I spent just two hours and implementation misses a lot of details, but it l= ooks like this may work with FFI extension almost out of the box. https://github.com/dstogov/php-ffi/commit/75cdae7a26406ae75ee27317ddb198177= 4a81006 Thanks. Dmitry. ________________________________ From: Michael Wallner on behalf of Michael Wallner= Sent: Thursday, April 26, 2018 10:30:38 PM To: Dmitry Stogov Cc: Stanislav Malyshev; Zeev Suraski; Xinchen Hui; Nikita Popov; Bob Weinan= d; Anatol Belski (ab@php.net); PHP internals list Subject: Re: [PHP-DEV] PHP FFI extenesion Hey! > On 26 04 2018, at 20:47, Dmitry Stogov wrote: > > Hi Michael, > > > I've just tried to run PSI with php-master (32-bit DEBUG build) and got S= IGSEGV on the simplest test. > > Use "psi.d/string.psi" and attemt to call psi\strerror(10) > > > #0 0xf44916ba in psi_call_frame_parse_args (frame=3D0xf426c500, execute_= data=3D0x0) at /home/dmitry/php/ext-psi/src/call.c:273 > #1 0xf4494fe7 in psi_context_call (C=3D0x92dfe90, execute_data=3D0x0, re= turn_value=3D0x8fc0144 , impl=3D0x9341658) > at /home/dmitry/php/ext-psi/src/context.c:250 > #2 0xf4499b44 in psi_ffi_handler (sig=3D0x92e0fa0, result=3D0xffff9760, = args=3D0xffff96f0, data=3D0x9341658) > at /home/dmitry/php/ext-psi/src/libffi.c:387 > #3 0xf4467a76 in ffi_closure_SYSV_inner () from /lib/libffi.so.6 > #4 0xf4467eb6 in ffi_closure_SYSV () from /lib/libffi.so.6 > #5 0x08701d21 in ZEND_DO_FCALL_BY_NAME_SPEC_RETVAL_USED_HANDLER () at /h= ome/dmitry/php/php-master/Zend/zend_vm_execute.h:890 > #6 0x0875fd12 in execute_ex (ex=3D0xf421d020) at /home/dmitry/php/php-ma= ster/Zend/zend_vm_execute.h:54819 > #7 0x087643b1 in zend_execute (op_array=3D0xf426c460, return_value=3D0x0= ) at /home/dmitry/php/php-master/Zend/zend_vm_execute.h:59987 > #8 0x086b0d2f in zend_execute_scripts (type=3D8, retval=3D0x0, file_coun= t=3D3) at /home/dmitry/php/php-master/Zend/zend.c:1566 > #9 0x0863cdde in php_execute_script (primary_file=3D0xffffcbbc) at /home= /dmitry/php/php-master/main/main.c:2467 > #10 0x0876676a in do_cli (argc=3D2, argv=3D0x90e4850) at /home/dmitry/php= /php-master/sapi/cli/php_cli.c:1011 > #11 0x087673b2 in main (argc=3D2, argv=3D0x90e4850) at /home/dmitry/php/p= hp-master/sapi/cli/php_cli.c:1404 > > execute_data is NULL > > > Did you test ext-psi with php-master? > I only test on master, but never tested 32bit :-/ https://travis-ci.org/m6w6/ext-psi/jobs/368760446#L2102 > > As I understood, you create libffi callback/closure for each function dec= lared in *.psi file(s). > > And then use it to call a general psi_ffi_handler(). > > Why not to call a general function handler in first place (without any ff= i magic)? > Let me think about that. It=92s my first with libffi/libjit, so maybe I was= thinking too complicated and took more corners than I had to=85 Thanks, Mike --_000_BN6PR02MB3234347C74B31EDF3905F8C9BF8E0BN6PR02MB3234namp_--