dev-php/pecl-parallel: add 1.2.6

Bug: https://bugs.gentoo.org/957101
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
Part-of: https://github.com/gentoo/gentoo/pull/42518
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Jaco Kroon
2025-06-09 18:11:05 +02:00
committed by Sam James
parent 59372303dc
commit 8db2a25255
3 changed files with 110 additions and 0 deletions

View File

@@ -1,2 +1,3 @@
DIST pecl-parallel-1.2.1.tgz 61948 BLAKE2B 47e36b4649b4787a52babc3ce8937f37fd3c0063762f41f36f865f89aab364d0541b1c01741dd43e6bb3cea60907e10169ff52e8576ffa30ab3c129de747139d SHA512 7dd85cf34daa7b1818235c1631eba7209d85f5b5e777810075c2f61dbaacf21a1211de44402d6750bac959c86940b97be57f022b318495724ff3d26cf3294d27
DIST pecl-parallel-1.2.5.tgz 64275 BLAKE2B 18542490d9dafb00811ef42483270b7e82134e3795a3856069b2cfbf1bed6dcbd5f684286d26878d4772a3d86324725fdb3417143b62affd4ae1fa25aaeebee3 SHA512 82a9bf2a13fb33d4caac6511f4f27e3a907849a9ce767105d81ff7452d58531cd7de016c22ab50cee1e76646f11a1dc27c984b1a25c14ed9c7cc197d6cc64099
DIST pecl-parallel-1.2.6.tgz 64366 BLAKE2B 395937e64a28dd6cf80d5a4d3d0d97d87586cf2a98c1f27f22cef62a42421a0ef4cebac5dbfb3e97622a5b6374e18e90f26bc53a7a29d30edf7e38d47bb47bb7 SHA512 45fb4450efb61e1ee746827aef82ce6022c11f96cd9967f7aa326f620ca487c97af389ee28f6832ebd8b2a164b59344efde56b549d8d64d7c1e8903d9b0cbac2

View File

@@ -0,0 +1,88 @@
Derived from: https://github.com/krakjoe/parallel/pull/339
Just removed tests.
From 75d1359e671fbb05c813779a0ad885eabc636633 Mon Sep 17 00:00:00 2001
From: Florian Engelhardt <flo@dotbox.org>
Date: Wed, 9 Apr 2025 10:14:12 +0200
Subject: [PATCH] Crash less and allow more cyclomatic refs (#339)
---
src/cache.c | 17 +++++++++++-
src/scheduler.c | 9 +++++--
8 files changed, 132 insertions(+), 8 deletions(-)
create mode 100644 tests/base/072-bootstrap.php
diff --git a/src/cache.c b/src/cache.c
index 6c3dee9..afbfb6d 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -370,11 +370,12 @@ zend_function* php_parallel_cache_closure(const zend_function *source, zend_func
memcpy(closure, cache, sizeof(zend_op_array));
}
- if (closure->op_array.static_variables) {
+ if (source->op_array.static_variables) {
HashTable *statics =
ZEND_MAP_PTR_GET(
source->op_array.static_variables_ptr);
+ if (statics) {
closure->op_array.static_variables =
php_parallel_copy_hash_ctor(statics, 1);
@@ -387,8 +388,22 @@ zend_function* php_parallel_cache_closure(const zend_function *source, zend_func
closure->op_array.static_variables_ptr,
&closure->op_array.static_variables);
#endif
+ }
}
+#if PHP_VERSION_ID >= 80100
+ if (source->op_array.num_dynamic_func_defs) {
+ uint32_t it = 0;
+ closure->op_array.dynamic_func_defs = php_parallel_cache_copy_mem(
+ source->op_array.dynamic_func_defs,
+ sizeof(zend_op_array*) * source->op_array.num_dynamic_func_defs);
+ while (it < source->op_array.num_dynamic_func_defs) {
+ closure->op_array.dynamic_func_defs[it] = (zend_op_array*) php_parallel_cache_closure((zend_function*) source->op_array.dynamic_func_defs[it], NULL);
+ it++;
+ }
+ }
+#endif
+
return closure;
} /* }}} */
diff --git a/src/scheduler.c b/src/scheduler.c
index a66673b..de3ee11 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -33,6 +33,8 @@ static zend_always_inline int php_parallel_scheduler_list_delete(void *lhs, void
static void php_parallel_schedule_free_function(zend_function *function) {
if (function->op_array.static_variables) {
php_parallel_copy_hash_dtor(function->op_array.static_variables, 1);
+ ZEND_MAP_PTR_SET(function->op_array.static_variables_ptr, NULL);
+ function->op_array.static_variables = NULL;
}
#if PHP_VERSION_ID >= 80100
@@ -245,6 +247,8 @@ static void php_parallel_scheduler_clean(zend_function *function) {
if (!(GC_FLAGS(statics) & IS_ARRAY_IMMUTABLE)) {
zend_array_destroy(statics);
+ ZEND_MAP_PTR_SET(function->op_array.static_variables_ptr, NULL);
+ function->op_array.static_variables = NULL;
}
}
@@ -254,8 +258,9 @@ static void php_parallel_scheduler_clean(zend_function *function) {
while (it < function->op_array.num_dynamic_func_defs) {
php_parallel_scheduler_clean(
- (zend_function*) function->op_array.dynamic_func_defs[it]);
- it++;
+ (zend_function*) function->op_array.dynamic_func_defs[it]);
+ pefree(function->op_array.dynamic_func_defs[it],1);
+ it++;
}
}
#endif

View File

@@ -0,0 +1,21 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="8"
PHP_EXT_INI="yes"
PHP_EXT_NAME="parallel"
PHP_EXT_NEEDED_USE="threads"
PHP_EXT_ZENDEXT="no"
USE_PHP="php8-2 php8-3"
inherit php-ext-pecl-r3
DESCRIPTION="A succint parallel concurrency API for PHP"
SRC_URI="${SRC_URI} -> ${P}.tgz"
PATCHES="${FILESDIR}/pecl-parallel-1.2.6-php8.3.patch"
LICENSE="PHP-3.01"
SLOT="8"
KEYWORDS="amd64 x86"