Skip to content

php-in-php: AOT CloneWithReinitRuntimeLlvm — route standalone clone-with reinit through CloneWithJitHelper PHP (#1492) #9717

Description

@PurHur

Category

php-in-php · runtime

Problem

#9498 (closed) routed JIT embed clone-with readonly reinit through ext/standard/CloneWithJitHelper.php, but AOT standalone still emits CloneWithReinitRuntimeLlvm (~320 lines in lib/JIT/Builtin/CloneWithReinitRuntimeLlvm.php) with property-name string walks in LLVM.

Per PHP-in-PHP strategy: clone reinit semantics belong in ext/standard/CloneWithJitHelper.php + lib/VM/CloneWithSupport.php; AOT should link compiled PHP helpers, not grow lib/AOT/runtime/*.c.

php-src reference

Repro (audit today)

wc -l lib/JIT/Builtin/CloneWithReinitRuntimeLlvm.php
rg 'CloneWithReinitRuntimeLlvm' lib/AOT bin/compile.php

Build AOT binary with readonly + clone and confirm LLVM object still references __phpc_clone_with_* symbols from CloneWithReinitRuntimeLlvm instead of CloneWithJitHelper trampolines only.

Minimal runtime script:

<?php
class C {
    public function __construct(public readonly string $v) {}
}
$c1 = new C('a');
$c2 = clone $c1;
echo $c2->v, "\n";
./script/docker-exec.sh php bin/vm.php repro.php          # VM baseline
# AOT: compile repro.php and run; compare behavior + symbol table

Scope

Path Work
lib/JIT/Builtin/CloneWithReinitRuntime.php AOT standalone: always prefer compiled CloneWithJitHelper
lib/JIT/Builtin/CloneWithReinitRuntimeLlvm.php Delete or thin to ABI trampolines only
ext/standard/CloneWithJitHelper.php SSOT for reinit walk
bin/compile.php / AOT link Ensure helper prelink like other php-in-php migrations

Done when

Related

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 & DevExphase-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions