[Info-vax] New PHP kits available (and a programming question)
John Reagan
xyzzy1959 at gmail.com
Mon Jul 10 16:20:42 EDT 2023
On Monday, July 10, 2023 at 1:47:58 PM UTC-4, Mark Berryman wrote:
> I have made some new ports of PHP available as follows:
>
> PHP 8.0.29
> https://theberrymans.com/php_kits/php_axp_8_0_29.zip
> https://theberrymans.com/php_kits/php_i64_8_0_29.zip
> https://theberrymans.com/php_kits/php_x86_8_0_29.zip
>
> PHP 8.1.20
> https://theberrymans.com/php_kits/php_x86_8_1_20.zip
>
> PHP 8.1 and later implement a new feature named fibers. It is
> advertised as allowing a program running in a single thread to run
> multiple threads. In reality, it simply allows one to create co-routines.
>
> In order to implement this feature, PHP needs to be able to save and
> restore execution context, as well as the ability to jump to a saved PC
> location. PHP uses the boost library to implement this and the boost
> library provides code in x86 assembly for the save/restore functions. I
> had planned to implement similar functionality for Alpha and Integrity
> using Macro32, only to discover that Macro32 doesn't provide access to
> the floating point registers.
>
> So, I'd to like to request an informal poll. How many folks would like
> to have a version of PHP later than 8.0 for their Alpha or Integrity
> systems?
>
> While I'm waiting for the answers, if anyone knows how I can
> save/restore execution context and jump to a saved PC location, I would
> appreciate any hints. I had hoped to use the various *INVO* functions
> for this but, while I have found routines that will save the current
> context, I haven't found any that will load the contents of an INVO
> block back into the registers.
>
> Also, what languages have access to all of the registers?
>
> Mark Berryman
Look at SYS$GOTO_UNWIND_64. It should be able to put all the registers back and jump to a PC.
The trick is "which PC". Pascal uses it for non-local GOTOs and C uses it for setjmp()/longjmp().
It takes an invo-handle and a target-PC. The target-PC needs to be a routine or a label that the
optimizer treats special (not to optimize things across it).
For C, setjmp() saves a bunch of stuff from the ICB, longjmp() actually uses a special
routine inside the CRTL as the target for the SYS$GOTO_UNWIND_64 call. It gets passed
the jmp-buf which has the actual destination back in setjmp(). It restores some registers
and does an indirect jmp back to the saved pc inside the jmp-buf.
More information about the Info-vax
mailing list