Skip to content

Regression: HELPER_RUNTIME_O=0 AOT compile fails looking up __compiler_trigger_error after #33234 (lib/JIT/Builtin/Type.php) #33248

Description

@PurHur

Category

Regression · Pillar 1 (Trust) · follow-up of #33234 · HELPER_RUNTIME_O=0 thin AOT

Problem

#33234 dropped the Type always-on __compiler_trigger_error empty decl/register. Ownership is StringTriggerError / JitTriggerErrorKernel, but Type::register() still calls SessionStartOptionsRuntime::ensureLinked() before any StringTriggerError::ensureLinked.

With PHP_COMPILER_HELPER_RUNTIME_O=0 (honest thin path used by DOM AOT unit tests), NestedJIT of session helpers lowers scalar coerce warnings via JitScalarEnumCoerce::emitObjectScalarWarninglookupFunction('__compiler_trigger_error') and throws:

Unable to lookup non-existing function __compiler_trigger_error

Measured on master @ f0f17ca3a9 after ./script/aot-smoke.sh 8/8 (helper-cache path still green):

Repro helper cache HELPER_RUNTIME_O=0
<?php echo "hi\n"; links + prints hi compile fail (lookup)
DOM createElement+setAttribute ok compile fail (lookup)

Type::initialize() early-returns for STANDALONE/EMBED before the late StringTriggerError::ensureLinked at the bottom of initialize — so thin AOT never got the late link either during Context construct.

Root cause

Stack (HELPER_O=0 hello):

Type::registerSessionStartOptionsRuntime::ensureLinked → NestedJIT → JitZendScalarCastJitScalarEnumCoerce::emitObjectScalarWarningContext::lookupFunction('__compiler_trigger_error')

Previously Type's always-on empty shell satisfied lookup; after #33234 the module-local owner must be linked before any NestedJIT in register().

PHP implementation target

  • lib/JIT/Builtin/Type.phpStringTriggerError::ensureLinked($this->context) before SessionStartOptionsRuntime::ensureLinked in register() (keep initialize ensureLinked; no Type empty addFunction/registerFunction for the ABI)
  • Unit guard in TypeDeadTriggerErrorAbiRuntimeShrinkTest (or sibling) asserting register order
  • No new runtime/*.c

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && TMP=$(mktemp -d) && printf "%s\n" "<?php echo \"hi\\n\";" > "$TMP/h.php" && PHP_COMPILER_HELPER_RUNTIME_O=0 php bin/compile.php -o "$TMP/h.bin" "$TMP/h.php"'

Done when

  • PHP_COMPILER_HELPER_RUNTIME_O=0 php bin/compile.php on hello-world exits 0 and binary prints hi
  • Same for a minimal DOM createElement/setAttribute script
  • ./script/aot-smoke.sh stays 8/8
  • No Type always-on __compiler_trigger_error empty decl restored

Parent

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 / JITbugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevExrelease-blockerBlocks tagged user release

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions