Skip to content

php-in-php: delete StringUnlink libc defer bridge — route user-script AOT through JitVmHelperLink + UnlinkJitHelper PHP (#1492) #19186

Description

@PurHur

Category

php-in-php · runtime-shrink (#1492, re-#15471 / #16734)

Problem

lib/JIT/Builtin/StringUnlink.php still embeds ~35 lines of inline libc unlink(2) LLVM when UserScriptAotDeferNestedJit::shouldDefer() (#16734). Embed path already routes through UnlinkJitHelper → VmFs::unlink() (#15471). Prelinked helper-runtime provides UnlinkJitHelper::invokeArgv without nested-JIT during init — same pattern as #19157 EnvironMirror.

UnlinkRuntimeShrinkTest::testStringUnlinkBridgeUsesUnlinkJitHelper is red on master (asserts no lookupFunction('unlink')).

php-src reference

PHP implementation target

  • lib/JIT/Builtin/StringUnlink.php — drop defer→libc branch; always JitVmHelperLink::ensureCompiled + bridge
  • SSOT: ext/standard/UnlinkJitHelper.php + VmFs::unlink()

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php vendor/bin/phpunit --filter UnlinkRuntimeShrinkTest'
echo '<?php $f=tempnam(sys_get_temp_dir(),"u"); unlink($f); echo "ok\n";' > /tmp/unlink.php
PHP_COMPILER_AOT_USER_SCRIPT=1 php bin/compile.php -o /tmp/unlink_bin /tmp/unlink.php && /tmp/unlink_bin

Done when

  • implementLibcBridge deleted (~35 lines libc LLVM removed)
  • UnlinkRuntimeShrinkTest green
  • User-script AOT unlink smoke green
  • make bootstrap-selfhost-vm-driver-execute-probe green

Refs #1492, #15471, #16734, #19157

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevEx

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions