Hi, internals,
I propose to introduce a new zend vm pause api, and here is the RPF
https://wiki.php.net/rfc/zend-vm-pause-api
Please gave your comment.
Thank you.
Hi,
It should be possible do similar things using EG(vm_interrupt) and zend_interrupt_function() callback (introduced in php-7.1)
ext/pcntl implements asynchronous signal handling using this.
Thanks. Dmitry.
It seems that set EG(vm_interrupt) to 1 could not stop the vm execution but only execute the interrupt_function and continue the current execution.
However, my RFC propose to stop the current execution.
Hi,
It should be possible do similar things using EG(vm_interrupt) and zend_interrupt_function() callback (introduced in php-7.1)
ext/pcntl implements asynchronous signal handling using this.Thanks. Dmitry.
From: Haitao Lv i@lvht.net
Sent: Wednesday, November 1, 2017 4:19:07 AM
To: PHP Internals
Subject: [PHP-DEV] RFC - Zend VM Pause APIHi, internals,
I propose to introduce a new zend vm pause api, and here is the RPF
https://wiki.php.net/rfc/zend-vm-pause-api https://wiki.php.net/rfc/zend-vm-pause-api
Please gave your comment.
Thank you.
--
Would it proper to introduce the following path?
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 9bed9f86bb..cf0935df74 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -8920,13 +8920,19 @@ ZEND_VM_DEFINE_OP(137, ZEND_OP_DATA);
ZEND_VM_HELPER(zend_interrupt_helper, ANY, ANY)
{
-
int8_t interrupt_type = EG(vm_interrupt);
-
EG(vm_interrupt) = 0; if (EG(timed_out)) { zend_timeout(0); } else if (zend_interrupt_function) { SAVE_OPLINE(); zend_interrupt_function(execute_data);
-
ZEND_VM_ENTER();
-
if (interrupt_type == 2) {
-
ZEND_VM_RETURN();
-
} else {
-
ZEND_VM_ENTER();
-
} } ZEND_VM_CONTINUE();
}
It seems that set EG(vm_interrupt) to 1 could not stop the vm execution but only execute the interrupt_function and continue the current execution.
However, my RFC propose to stop the current execution.
Hi,
It should be possible do similar things using EG(vm_interrupt) and zend_interrupt_function() callback (introduced in php-7.1)
ext/pcntl implements asynchronous signal handling using this.Thanks. Dmitry.
From: Haitao Lv i@lvht.net
Sent: Wednesday, November 1, 2017 4:19:07 AM
To: PHP Internals
Subject: [PHP-DEV] RFC - Zend VM Pause APIHi, internals,
I propose to introduce a new zend vm pause api, and here is the RPF
https://wiki.php.net/rfc/zend-vm-pause-api https://wiki.php.net/rfc/zend-vm-pause-api
Please gave your comment.
Thank you.
--
After discussion with Dmitry, I update my RFC. The RFC url is here
https://wiki.php.net/rfc/zend-vm-pause-api
And I propose to introduce a new interrupt type to make vm pause-and-return, not pause-and-continue.
As mentioned by Dmitry, features like Fiber could be implemented by current vm_interrupt implementation, theoretically. By using it, even init a function call will need to make our own op array.
So I propose this patch.
Thank you.
Would it proper to introduce the following path?
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 9bed9f86bb..cf0935df74 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -8920,13 +8920,19 @@ ZEND_VM_DEFINE_OP(137, ZEND_OP_DATA);ZEND_VM_HELPER(zend_interrupt_helper, ANY, ANY)
{
int8_t interrupt_type = EG(vm_interrupt);
EG(vm_interrupt) = 0; if (EG(timed_out)) { zend_timeout(0); } else if (zend_interrupt_function) { SAVE_OPLINE(); zend_interrupt_function(execute_data);
ZEND_VM_ENTER();
if (interrupt_type == 2) {
ZEND_VM_RETURN();
} else {
ZEND_VM_ENTER();
} } ZEND_VM_CONTINUE();
}
It seems that set EG(vm_interrupt) to 1 could not stop the vm execution but only execute the interrupt_function and continue the current execution.
However, my RFC propose to stop the current execution.
Hi,
It should be possible do similar things using EG(vm_interrupt) and zend_interrupt_function() callback (introduced in php-7.1)
ext/pcntl implements asynchronous signal handling using this.Thanks. Dmitry.
From: Haitao Lv i@lvht.net
Sent: Wednesday, November 1, 2017 4:19:07 AM
To: PHP Internals
Subject: [PHP-DEV] RFC - Zend VM Pause APIHi, internals,
I propose to introduce a new zend vm pause api, and here is the RPF
https://wiki.php.net/rfc/zend-vm-pause-api https://wiki.php.net/rfc/zend-vm-pause-api
Please gave your comment.
Thank you.
--