Skip to content

php-in-php: AOT StringStripTagsStandaloneLlvm — route standalone strip_tags through StripTagsJitHelper PHP not ~980-line LLVM (#1492) #9746

Description

@PurHur

Category

php-in-php · compile-pipeline / AOT standalone

Problem

AOT standalone link still emits a large hand-written LLVM implementation of strip_tags() in lib/JIT/Builtin/StringStripTagsStandaloneLlvm.php (~980 lines of tag parsing, allowed-tag tables, libc bridges).

The JIT path already routes through ext/standard/StripTagsJitHelper.php + JitStripTags.php (#9196 closed for JIT). Standalone AOT keeps the LLVM duplicate because “compiled PHP static storage is not yet reliable in native link” — same rationale as LastErrorRuntimeLlvm (#9607) and CloneWithReinitRuntimeLlvm (#9717).

Goal: one PHP SSOT for strip_tags semantics; delete or stub the standalone LLVM body.

php-src reference (semantics only)

Repro (LLVM path active today)

# JIT uses PHP helper (green):
./script/docker-exec.sh php bin/jit.php -r 'echo strip_tags("<b>x</b>", "<b>");'

# AOT standalone link still pulls StringStripTagsStandaloneLlvm symbols:
rg 'StringStripTagsStandaloneLlvm|__phpc_st_|__compiler_strip_tags' lib/JIT/Builtin/
wc -l lib/JIT/Builtin/StringStripTagsStandaloneLlvm.php

After fix: standalone AOT binary calls compiled StripTagsJitHelper::stripTags() (or thin ABI trampoline), and StringStripTagsStandaloneLlvm.php shrinks to link stub or is deleted.

Scope

Path Work
lib/JIT/Builtin/StringStripTagsStandaloneLlvm.php delete LLVM bodies after PHP path links
ext/standard/StripTagsJitHelper.php ensure standalone emit-helper can link compiled helper
lib/JIT/Builtin/StripTagsJitHelper wiring mirror LastErrorRuntime → ErrorLastJitHelper pattern (#9607)
lib/AOT/ register compiled helper in standalone bundle policy
runtime/ remove any __compiler_strip_tags C symbols if present

Done when

  • StringStripTagsStandaloneLlvm.php reduced to thin stub or removed; ≥800 lines LLVM deleted
  • AOT standalone strip_tags() output matches VM/JIT on compliance fixture
  • ./script/ci-fast.sh --filter strip_tags green; AOT fixture if present
  • PR body cites lines removed from LLVM/C

Related

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 18, 2026
  2. PurHur commented on Jun 24, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — batch (issues #9746 delete StringStripTagsStandaloneLlvm)

  3. PurHur commented on Jun 24, 2026

    @PurHur
    OwnerAuthor

    Attempted standalone route via StripTagsJitHelper (delete StringStripTagsStandaloneLlvm.php) — blocked:

    StringStripTags::ensureStandaloneBodies() fails during nested parseAndCompile(StripTagsJitHelper.php):

    1. TYPE_MINUS on type pair 134/134 (string index vars)
    2. After explicit (int) casts on substr lengths: Cannot assign operands of different types (yet): 2, 135

    JIT embed path is green; standalone AOT still needs LLVM until nested JIT can compile the helper loop (same class of blocker as StringPhpinfoRuntimeLlvm).

    Next: shrink StripTagsJitHelper to a one-line VmString::stripTags delegate once VmString compiles in standalone link, or extend JIT assign/minus for nested standalone compile.

  4. PurHur commented on Jun 24, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — batch (issues #9746)

  5. PurHur commented on Jun 24, 2026

    @PurHur
    OwnerAuthor

    Merged via #11174 — deleted StringStripTagsStandaloneLlvm.php (~978 LLVM lines). Standalone + JIT now share StripTagsJitHelper → VmString::stripTags() bridge. Verified: phpunit StripTags/SuperglobalsStripTags (5 OK), JIT strip_tags repro, spine sync + inventory check.

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-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions