[PHP-DEV] Re: FPM preloading of PHP files

2018-04-17 Thread Dmitry Stogov
Hi Jakub, I though not only about FPM, but a technology for any SAPI. Pre-loaded classes and functions might be kept in CG() tables, in the same way as "internal" ones. EG() constants and variables may be re-created at start of request, executing pre-loaded PHP code. Few years ago, I develop

[PHP-DEV] FPM preloading of PHP files

2018-04-17 Thread Jakub Zelenka
Hi Dmitry, This is a bit different topic to FFI discussion so creating a new thread. You wrote this in the FFI extension discussion: At the same time, we will develop a technology to preload and reuse PHP > files across requests. > And allow FFI there. Have you been thinking about it in the FP

Re: [PHP-DEV] PHP FFI extenesion

2018-04-17 Thread Michał Brzuchalski
One more idea I can imagine - while creating FFI object would it be possible to: * declare all ZEND_FFI_SYM_FUNC as class methods with proper type hinting mapped to registered classes * declare all ZEND_FFI_SYM_VAR as class properties with some guards * declare all ZEND_FFI_SYM_CONST as class publi

Re: [PHP-DEV] PHP FFI extenesion

2018-04-17 Thread Dmitry Stogov
Now, I got your idea. Subclassing CData, and use that types for type hinting may make sense. I'll put this idea in my TODO, but with low priority. Thanks. Dmitry. From: Michał Brzuchalski Sent: Tuesday, April 17, 2018 10:51:32 AM To: Dmitry Stogov Cc: Stanisla

Re: [PHP-DEV] PHP FFI extenesion

2018-04-17 Thread Michał Brzuchalski
2018-04-17 9:46 GMT+02:00 Dmitry Stogov : > Hi Michal, > > > I didn't think in this way. I liked to make the simplest API. > > I don't expect wide FFI usage in frameworks :) > > > BTW: I like the idea of use C type names (probably, we may reuse original > C type names without additional registrati

Re: [PHP-DEV] PHP FFI extenesion

2018-04-17 Thread Dmitry Stogov
Hi Michal, I didn't think in this way. I liked to make the simplest API. I don't expect wide FFI usage in frameworks :) BTW: I like the idea of use C type names (probably, we may reuse original C type names without additional registration). currently we can do: $tz = $libc->new("struct time

Re: [PHP-DEV] PHP FFI extenesion

2018-04-17 Thread Dmitry Stogov
hi Michael, it's pitty, I didn't found this extension before. thanks for pointing, I'll definetly take a look. I, also, like the idea of preloading ffi definitions on startup, but I would prefer to allow preloading any php files. Especially for FFI, PHP wrappers would able to hide dangerous imp

Re: [PHP-DEV] PHP FFI extenesion

2018-04-17 Thread Michał Brzuchalski
Hi Dmitry! I am not much experienced with C but as a user, I'm just wondering if there is a possibility to extend FFI class and autoregister all or just chosen structs as classes, for eg. class Libc extends FFI { public function __construct() { parent::__construct("...code", "...lib");

Re: [PHP-DEV] PHP FFI extenesion

2018-04-17 Thread Dmitry Stogov
On Apr 17, 2018 2:49 AM, Stanislav Malyshev wrote: Hi! > I've spent some time thinking about simple FFI for PHP, and finally, borrowed > most ideas from LuaJIT. > > This is an initial PoC. It was tested on Linux only. > > > https://github.com/dstogov/php-ffi > > > I would appreciate review, co