aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-09 08:40:21 +0900
committernsfisis <nsfisis@gmail.com>2026-08-09 08:40:21 +0900
commitbe514aeff17ab7d8debcc59acddd07f7c7b72bd7 (patch)
tree4e57cb51fe76e34de35aa176ae26e9423270b8d8
parent4d974682134f20a816dde717fdbba8e76d9b10b8 (diff)
downloadphp-shirabe-be514aeff17ab7d8debcc59acddd07f7c7b72bd7.tar.gz
php-shirabe-be514aeff17ab7d8debcc59acddd07f7c7b72bd7.tar.zst
php-shirabe-be514aeff17ab7d8debcc59acddd07f7c7b72bd7.zip
refactor(installer): drop the GC control calls
Composer turns the cycle collector off around the dependency solver, but Rust has no GC, so the gc_collect_cycles/gc_disable/gc_enable shims were no-ops. Remove the call sites and the now-callerless shim functions. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
-rw-r--r--crates/shirabe-php-shim/src/runtime.rs13
-rw-r--r--crates/shirabe/src/installer.rs17
2 files changed, 4 insertions, 26 deletions
diff --git a/crates/shirabe-php-shim/src/runtime.rs b/crates/shirabe-php-shim/src/runtime.rs
index 6ad5bc29..e24d6d69 100644
--- a/crates/shirabe-php-shim/src/runtime.rs
+++ b/crates/shirabe-php-shim/src/runtime.rs
@@ -394,19 +394,6 @@ pub fn ini_set(_varname: &str, _value: &str) -> Option<String> {
todo!()
}
-pub fn gc_collect_cycles() -> i64 {
- // Rust has no cycle collector; nothing is collected.
- 0
-}
-
-pub fn gc_disable() {
- // Rust has no cycle collector to disable.
-}
-
-pub fn gc_enable() {
- // Rust has no cycle collector to enable.
-}
-
pub fn phpinfo(_what: i64) {
// TODO(php-runtime): phpinfo() dumps the full PHP runtime configuration, which the shim does not
// model.
diff --git a/crates/shirabe/src/installer.rs b/crates/shirabe/src/installer.rs
index 702569aa..22da3fff 100644
--- a/crates/shirabe/src/installer.rs
+++ b/crates/shirabe/src/installer.rs
@@ -36,8 +36,8 @@ use indexmap::IndexMap;
use shirabe_external_packages::seld::json_lint::ParsingException;
use shirabe_php_shim::{
- PhpMixed, RuntimeException, array_map, array_unique, defined, gc_collect_cycles, gc_disable,
- gc_enable, implode, intval, is_dir, is_numeric, strcmp, strpos, strtolower, touch, usort,
+ PhpMixed, RuntimeException, array_map, array_unique, implode, intval, is_dir, is_numeric,
+ strcmp, strpos, strtolower, touch, usort,
};
use shirabe_semver;
@@ -219,12 +219,8 @@ impl Installer {
/// Run installation (or update)
#[tracing::instrument(skip_all)]
pub fn run(&mut self) -> anyhow::Result<i64> {
- // Disable GC to save CPU cycles, as the dependency solver can create hundreds of thousands
- // of PHP objects, the GC can spend quite some time walking the tree of references looking
- // for stuff to collect while there is nothing to collect. This slows things down dramatically
- // and turning it off results in much better performance. Do not try this at home however.
- gc_collect_cycles();
- gc_disable();
+ // Composer disables GC to save CPU cycles, but Shirabe does not as Rust has no GC.
+ // It is possible to disable GC in PHP via RPC, but it might not be effective.
if self.update_allow_list.is_some() && self.update_mirrors {
return Err(RuntimeException::new(
@@ -478,11 +474,6 @@ impl Installer {
);
}
- // re-enable GC except on HHVM which triggers a warning here
- if !defined("HHVM_VERSION") {
- gc_enable();
- }
-
let audit_config = self.get_audit_config()?.clone();
if audit_config.audit {