Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80282 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70800 invoked from network); 8 Jan 2015 17:56:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jan 2015 17:56:50 -0000 Authentication-Results: pb1.pair.com header.from=fred@fredemmott.co.uk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=fred@fredemmott.co.uk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fredemmott.co.uk from 209.85.220.49 cause and error) X-PHP-List-Original-Sender: fred@fredemmott.co.uk X-Host-Fingerprint: 209.85.220.49 mail-pa0-f49.google.com Received: from [209.85.220.49] ([209.85.220.49:34172] helo=mail-pa0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/77-21915-0E4CEA45 for ; Thu, 08 Jan 2015 12:56:50 -0500 Received: by mail-pa0-f49.google.com with SMTP id eu11so13112517pac.8 for ; Thu, 08 Jan 2015 09:56:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=hgj98sXQEqQTZ5VER7Vjfwkcn0KMWy9VL3tm/0IqBP4=; b=IhSu2nrRBUYn0yuYS9h2cbHrrUBzoc0niCavFaa7GzbJD4lJIxbdF9BZAE3HqzL+6J TDzRGq8eBlDmtli2XY96Ut5Z2/sMhg8+Kz9G8cTDjPqpR9LGzcrhHWHa9DmzGDANB4xJ 25zKbOOVVSbbY1KpQIlSnKlmpiRfHOt1j3GPq2l8uqwVhbuf5hfR6f1IYcOjMdCbU1hc syTBnxf5wSPNRHEu5end0Iz6GX9i9an3jCis+razU7nvybjHLT37+RcpVBGTKM2yjygS 08A05UiJOGXycr1SwgkMwf7CWXVWCkv6hw2La0prQk0elATynqt23VN88mDbzaYt/VzI /GoA== X-Gm-Message-State: ALoCoQkUaskDfJJT3yiTQU4Apzi+GD3Hh2fmiM7flnteH+THrcUv/9oI9iTuXkYb2No6km7DtWqa X-Received: by 10.66.155.170 with SMTP id vx10mr16780742pab.137.1420739805969; Thu, 08 Jan 2015 09:56:45 -0800 (PST) Received: from ?IPv6:2620:10d:c082:100c:aa20:66ff:fe45:115c? ([2620:10d:c082:100c:aa20:66ff:fe45:115c]) by mx.google.com with ESMTPSA id i7sm5067489pdp.3.2015.01.08.09.56.44 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 Jan 2015 09:56:45 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) In-Reply-To: Date: Thu, 8 Jan 2015 09:56:43 -0800 Cc: Derick Rethans , PHP internals , Sara Golemon , Stanislav Malyshev , =?utf-8?Q?Fran=C3=A7ois_Laupretre?= , Benjamin Eberlei Content-Transfer-Encoding: quoted-printable Message-ID: <31A3F47C-0C5B-46E0-8B34-2105F467FDB3@fredemmott.co.uk> References: <54AAF98B.4020709@gmail.com> <001b01d029bb$fa687fc0$ef397f40$@tekwire.net> To: Pierre Joye X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] [RFC] Extension Prepend Files From: fred@fredemmott.co.uk (Fred Emmott) > On Jan 7, 2015, at 2:18 AM, Pierre Joye wrote: >> That's very much the case. One extension, one "install". It doesn't >> matter whether some of the extension is written in C, and other parts = in >> PHP. HHVM is *all* about this. Making use of C where you need it, and >> otherwise just write the simpler *but integral* border functionality = in >> PHP for faster maintenance and development. >=20 > It is not correct nor relevant to compare hhvm extension development = with > this case. With hhvm it ends up with an actual native extension while = here > it is proposed to bundled script that will be executed at runtime like = any > other script, except that nothing can be done with them, not even = disable > them if not required (like using its own glue codes). Both HHVM and its' extensions embed PHP source in the binaries. In our experience: + bundling them together makes it much quicker to iterate and improve = extensions. + the PHP code tends to use =E2=80=98non-public=E2=80=99 parts of the C = API - so it really needs to be kept in sync with the PHP version. I=E2=80=99= m not sure if composer currently supports =E2=80=98if I=E2=80=99m on PHP = 5.6.0 use this library, if I=E2=80=99m on 5.6.1 use this library=E2=80=A6=E2= =80=99. While this is fixable, it seems like a lot of boilerplate. + If PHP7 does develop a JIT, the PHP implementations could be faster = than calling the C code (type specializing, and the overhead of setting = up the stack for a C function call). This is often the case for HHVM. - we currently do not support extension-style parameter coercion in PHP = functions; this leads to small incompatibilities in our case, which we = usually address by writing a C++ function that proxies to a hidden PHP = implementation. For PHP7, if the current scalar types RFC lands, this = won=E2=80=99t be a problem; if it doesn=E2=80=99t, there=E2=80=99s a = chance that multiple functions from the same extension will have = confusingly different parameter coercing behavior, depending on the = author=E2=80=99s rigor. We solved some of the other problems by only allowing definitions, no = side-effects - classes, constants, namespaces etc. We do not allow code = outside of a function body here. HHVM-specific details (just FYI, agree that they=E2=80=99re probably not = particularly relevant): * We do not translate the PHP source to native code (unless it ends up = being jitted at runtime) * We=E2=80=99re planning on supporting the extension-style coercion in = Hack code with a user attribute * To dig the code out: $ objdump -h hhvm | egrep =E2=80=98 (ext|systemlib)=E2=80=99 # also = works for a dynamic extension .so =E2=80=A6 149 ext.ff104b2dfab9 00002410 0000000000000000 0000000000000000 = 02d350a5 2**0 150 systemlib 000766a2 0000000000000000 0000000000000000 02d374b5 = 2**0 $ objdump -s -j systemlib hhvm | head -n 20 hhvm: file format elf64-x86-64 Contents of section systemlib: 00000 3c3f6868 0a2f2f20 7b407d67 656e6572