Skip to content

php-in-php: JIT StringStripTagsJit — route strip_tags() through VmString PHP not superglobals_refresh LLVM (#1492) #9196

Description

@PurHur

Category

php-in-php · stdlib

Problem

strip_tags() VM path lives in PHP (ext/standard/strip_tags.php, VmString), but JIT/AOT still emit __compiler_strip_tags plus helper symbols from lib/JIT/Builtin/StringStripTagsJit.php (~900 lines, ported from superglobals_refresh.c tag parser). Enum TypeError parity (#5897) and allowed-tags edge cases must be maintained in one PHP implementation, not a parallel LLVM parser.

php-src reference

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php -r "var_export(strip_tags(\"<b>x</b>\", \"<b>\")); echo \"\n\";"
php bin/vm.php -r "var_export(strip_tags(\"<b>x</b>\", \"<b>\")); echo \"\n\";"
php bin/jit.php -r "var_export(strip_tags(\"<b>x</b>\", \"<b>\")); echo \"\n\";" 2>&1
'

VM/JIT should agree; today JIT uses LLVM StringStripTagsJit while VM uses VmString::stripTags().

Scope

Layer Files
JIT lib/JIT/Builtin/StringStripTagsJit.php — delegate to compiled VmString / strip_tags builtin
VM reference ext/standard/VmString.php — single source of truth
Delete/shrink remove __compiler_strip_tags / __phpc_st_* LLVM helpers when PHP path wired
Tests test/compliance/cases/stdlib/strip_tags*.phpt; enum operand guard #5897

PHP-in-PHP first: do not extend C tag tables in runtime/; shrink LLVM when PHP lowering is sufficient.

Done when

  • JIT/AOT output matches VM on strip_tags compliance tests (including allowed-tags list)
  • __compiler_strip_tags LLVM implementation deleted or thin trampoline
  • PR notes lines removed from lib/JIT/Builtin/StringStripTagsJit.php
  • ./script/ci-fast.sh --filter strip_tags green

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions