Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125652 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id C129D1A00BD for ; Sat, 21 Sep 2024 02:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1726886429; bh=v/nWA2nRlbztEuw/oJ+FFhAocLuJKCZRGop/KwgOSuE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Zt1B4PbbOxfKJnK6By40x4Py3kRAmVKPrMVojNYgzODZ4PtVgQqxnQF3+W8qk73tu 30Gi4rERWnSTiG9uypi5I07ljXY6p+9P6vdjhWe90pEd5V0HBYlh9/wl1kAYqw8kKz 6wZTOMo4wISssySVdtYXWmFf71i2grfUih9XORGqkvds7EMevNS530qmTnhV74pMAe wgvAGXuBYeb03z4SonLVo05MQ+l3UgoB5R+6q3M1QBQoSXOLB3Op07mKucxoRcn4bA 3nMhHzWbfkzRIUS5eTIuDqcgEJC8t2alOEb18fajI/ZzKA8DOEJCADAajCZ7tEAUYe T254z+cS2rjEQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B7EE4180032 for ; Sat, 21 Sep 2024 02:40:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 21 Sep 2024 02:40:28 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-7198de684a7so2041135b3a.2 for ; Fri, 20 Sep 2024 19:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726886300; x=1727491100; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ugt26Al36dLrTF63sad9mRHuIlmqAicGrN/92LgQbNA=; b=QLOWxD/B0ALlJng6hihfoOZ7IBeI8VqyKGQQ4vrKk+e52tr17wheEkcf15+OaTOIGI DHdTFQ7jc9qYwwr/BW3r9NrCeFpQR0TBBR1p++AY9NItu7ImxPCR1t5Z3brrg3y3sL1F RUu5cRmumNHdFZqaHZkM1uKJQxZ+iWGOHPq2sZHsBBbwXb3qKIO35ySssRyLJZOyqFvj 3XeZinAWy3Tj5cZe/GIgbK1vGn77z0lgWrZbzQJMkBG1lx1BSJkMWJWxoAC01fxoKa7G 40OVb3A2xFx//F3ZYtWT6NLVsT5AwLZqmBINL9HTcXKolGpX4D+si8cZ+tcL3AuzHahB 6KQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726886300; x=1727491100; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ugt26Al36dLrTF63sad9mRHuIlmqAicGrN/92LgQbNA=; b=BgLzIZdfzWuB1+1wAniTK58xJ3hodQJqMgLSAJXiLLIXF3qWCHoCoMz6NOuaIMP1C0 mCfKPkHgxaiKGDf0jhq1k7dVbeCq7lYWb56bwsZ1TuB/hi7n0g5zy4Ze/17ANmsgms9K 3P74kE4LSCSvZXSn90zzHpXqxPAVw1XgYwn+5UwDDl97ytdWmqUwg0FVm6/fm5nDfc6Y uujOCqCdoyZIXE9iCzYZnk9zB5iBgjg0ASRG60GzqmbJRvD4HcVXm5+KoDiphg4U/ajp orrOU94vl7UvU+Ru4xGeXewfXvWGGpZqkyaLcrFRoTMuXKcfNL6IrW4e6/tkSrN2ZN1x 1F3g== X-Forwarded-Encrypted: i=1; AJvYcCVQjuNF1GbgswjUwK3KJ1294cVxEmKBgqNbNYh1OQdlHKT88twwEdkszXKY4hEWlrMEsBreMdRWJ7I=@lists.php.net X-Gm-Message-State: AOJu0Yy+Opa7om5OzMhVK1iwt2lRBEzUtV4V6BTTbRlgxOexXE97sMVr eUS6mJFuizPsgnrBRIGMujdzb2jQplhwaOwwJRWDvvBlGUdP46vRo6fGPUBfOex7NQjKCxHiEtC 2zLPhT5eRI8ny+NH/mwBRnS6DqRE= X-Google-Smtp-Source: AGHT+IEBSv47rJeJeQZ9ll7nI5K5eMQUzoM6stKUSEXnWAHp6SYqm2nG3CyKel1dq5biYDkmBeYpTMvTWUmQaOvPtiw= X-Received: by 2002:a17:90b:4a8a:b0:2d8:8eee:ccab with SMTP id 98e67ed59e1d1-2dd80c4eea6mr5099964a91.22.1726886299944; Fri, 20 Sep 2024 19:38:19 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <8D420123-4ECF-48FD-A9C3-F80C60457A37@newclarity.net> <7EA884D2-0F37-4BF1-AC97-DB6953C944E6@automattic.com> <8A970628-C287-4584-8E44-7708E38142F7@automattic.com> In-Reply-To: <8A970628-C287-4584-8E44-7708E38142F7@automattic.com> Date: Sat, 21 Sep 2024 09:38:07 +0700 Message-ID: Subject: Re: [PHP-DEV] Zephir, and other tangents To: Dennis Snell Cc: Jakub Zelenka , Arvids Godjuks , Hammed Ajao , Rob Landers , Adam Zielinski , Mike Schinkel , PHP internals Content-Type: multipart/alternative; boundary="00000000000079d28b0622980cc3" From: pierre.php@gmail.com (Pierre Joye) --00000000000079d28b0622980cc3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Sep 21, 2024, 3:41=E2=80=AFAM Dennis Snell wrote: > > On Sep 20, 2024, at 1:21 PM, Jakub Zelenka wrote: > > Hi, > > On Fri, Sep 20, 2024 at 6:32=E2=80=AFPM Dennis Snell > wrote: > >> >> My goal in sharing here is to help better represent my own perspective o= f >> WordPress=E2=80=99 needs based on what I=E2=80=99ve seen. It=E2=80=99s l= ong been on my list to >> propose a WASM RFC, but because I personally haven=E2=80=99t had the pri= ority >> available to get an implementation working I haven=E2=80=99t done so. It= =E2=80=99s my >> impression from the documentation that the purpose of these email thread= s >> w.r.t. RFCs is to gather interest and input before any RFC would be put >> together, to hold these discussions before anyone commits any major time= to >> it. >> > > Is your objective to support building PHP to wasm32-wasi target like it > was proposed here: https://github.com/php/php-src/pull/10457? If so, the > main issue with that was inability to do the zend_bailout as wasm does no= t > support currently support setjmp and longjmp. Otherwise it's mostly about > disabling some functionality. > > > It=E2=80=99s the other way around. We=E2=80=99ve been having a great time= already building > PHP as a WASM binary - we package it with SQLite and WordPress to create > =E2=80=9CThe WordPress Playground.=E2=80=9D There=E2=80=99s a wonderful n= ew world of things that > can happen when packaging PHP inside a WASM runtime. > > However, this is about calling compiled WebAssembly code from user-space > PHP. > > load_wasm( __DIR__ . =E2=80=98/interesting-computation.wasm=E2=80=99 = ); > $description =3D null; > call_wasm_func( =E2=80=98lazy_json_decode=E2=80=99, $json, =E2=80=98i= tems[0].description=E2=80=99, > $description ); > this is a very important target which is not directly discussed in this thread. I played with the (very good) IR when it was submitted by Dmitry back then. It sounded like the most effective way. However it was not designed (nothing bad with that) with such goals in mind. I was hoping it could be used like any other IR (similar to what llvm does f.e.) to then target wasm. The closest one from php is python with py2wasm, but there are pretty existing solutions that make it possible, they use the out of python core approach: https://wasmer.io/posts/py2wasm-a-python-to-wasm-compiler which looks very much like what could be done with php as I see the chances to have that in php as very low without major changes. best, Pierre It may be possible but the time required to figure it out is not something I have sadly (falling back to porting our php code to other when we need it to be used in many environments where putting a php is not an option). As of now, I feel like writing a parser-compiler may be easier, even with limited features. But ideally the way could be to allow it the same way we can see it in other languages, but the paradigms used are very different. All in all, it is not absolutely vital for php to have this but it will help to keep it on for the next 2 decades. Similarly to other discussions lately about new types. best, Pierre > --00000000000079d28b0622980cc3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Sat, Sep 21, 2024, 3:41=E2=80=AFAM Dennis = Snell <dennis.snell@autom= attic.com> wrote:

On Sep 20, 2024, at 1:21 PM, Jakub Zelenka <bukka@php.net> wrote:=

Hi,

On Fri, Sep 20, 2024 at 6:32=E2=80=AF= PM Dennis Snell <dennis.snell@automattic.com> wrote:

My goal in sharing here is to help better represent my own perspective= of WordPress=E2=80=99 needs based on what I=E2=80=99ve seen. It=E2=80=99s = long been on my list to propose a WASM RFC, but because I personally haven= =E2=80=99t had the priority available to get an implementation working I ha= ven=E2=80=99t done so. It=E2=80=99s my impression from the documentation th= at the purpose of these email threads w.r.t. RFCs is to gather interest and= input before any RFC would be put together, to hold these discussions befo= re anyone commits any major time to it.

Is your objective to support building PHP to wasm32-wasi tar= get like it was proposed here:=C2=A0https://gi= thub.com/php/php-src/pull/10457? If so, the main issue with that was in= ability to do the zend_bailout as wasm does not support currently support s= etjmp and longjmp. Otherwise it's mostly about disabling some functiona= lity.

It=E2=80=99s the other way around. We=E2=80=99ve been having a great t= ime already building PHP as a WASM binary - we package it with SQLite and W= ordPress to create =E2=80=9CThe WordPress Playground.=E2=80=9D There=E2=80= =99s a wonderful new world of things that can happen when packaging PHP ins= ide a WASM runtime.

However, this is about calling compiled WebAssembly code from user-spa= ce PHP.

=C2=A0 =C2=A0 load_wasm( __DIR__ . =E2=80=98/interesting-computation.w= asm=E2=80=99 );
=C2=A0 =C2=A0 $description =3D null;
=C2=A0 =C2=A0 call_wasm_func( =E2=80=98lazy_json_decode=E2=80=99, $jso= n, =E2=80=98items[0].description=E2=80=99, $description );

this is a very = important target which is not directly discussed in this thread.

I played with the (very good) IR w= hen it was submitted by Dmitry back then. It sounded like the most effectiv= e way.

However it was no= t designed (nothing=C2=A0 bad with that) with such goals in mind. I was hop= ing it could be used like any other IR (similar to what llvm does f.e.) to = then target wasm. The closest one from php is python with py2wasm, but ther= e are pretty existing solutions that make it possible, they use the out of = python core approach:

https:/= /wasmer.io/posts/py2wasm-a-python-to-wasm-compiler

which looks very much like what could be don= e with php as I see the chances to have that in php as very low without maj= or changes.

best,
<= div dir=3D"auto">Pierre

= It may be possible but the time required to figure it out is not something = I have sadly (falling back to porting our php code to other when we need it= to be used in many environments where putting a php is not an option).

As of now, I feel like writ= ing a parser-compiler may be easier, even with limited features. But ideall= y the way could be to allow it the same way we can see it in other language= s, but the paradigms used are very different.=C2=A0
=
All in all, it is not absolutely vital for php = to have this but it will help to keep it on for the next 2 decades. Similar= ly to other discussions lately about new types.

=
best,
Pierre
--00000000000079d28b0622980cc3--