Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/JIT.php
Original file line number Diff line number Diff line change
Expand Up @@ -2187,6 +2187,11 @@ private function shouldUseM3EmitTuRuntimeMethodStub(string $methodLc): bool
'standalone',
];
if (in_array($methodLc, $inventoryEmitSpine, true)) {
// Real argv parse spine needs ctor/init; standalone stays stubbed (#15597).
if ($this->shouldRealLowerInventoryArgvParseSpine() && 'standalone' !== $methodLc) {
return false;
}

return true;
}
}
Expand Down Expand Up @@ -5255,14 +5260,15 @@ private function registerM3EmitTuSidecarFromPath(
if ($compilerLibStampOk || ($compilerLibSidecar && $this->m3EmitTuReuseStaleCompilerLibSidecar())) {
$aotBytes = file_get_contents($repoSidecar);
if (is_string($aotBytes) && '' !== $aotBytes) {
$pathKeyedSidecar = $compilerLibSidecar && !$compilerLibStampOk;
\PHPCompiler\JIT\M3EmitTuTrivialEchoAot::registerLinktime(
$this->context,
$repoRoot,
$code,
$aotBytes,
$sidecarRel,
$sentinelLogical,
false,
$pathKeyedSidecar,
$this->m3EmitTuSidecarSourcePathNorm($path)
);

Expand Down
3 changes: 3 additions & 0 deletions lib/JIT/BootstrapCompileSmokeM3Emit.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ private static function emitEnsureRepoRootEnvIfUnset(Context $context): void
*/
private static function emitPutenvM3CompileDriverMainForBootstrapSelfhost(Context $context, Value $sourceFile): void
{
BasicBlockHelper::ensureOpenInsertBlock($context, 'csm3_putenv_m3main_entry');
$charPtr = $context->getTypeFromString('char*');
$i32 = $context->getTypeFromString('int32');
$notFound = $i32->constInt(JitStringSearch::NOT_FOUND, true);
Expand All @@ -371,6 +372,8 @@ private static function emitPutenvM3CompileDriverMainForBootstrapSelfhost(Contex
$hasSelfhost = $context->builder->icmp(Builder::INT_NE, $foundSelfhost, $notFound);
$isSpine = $context->builder->icmp(Builder::INT_NE, $foundSpine, $notFound);
$shouldSet = $context->builder->and($hasSelfhost, $context->builder->not($isSpine));
// JitVmHelperLink::ensureBridge (via findOffsetI32) may clear the LLVM insert block (#15597).
BasicBlockHelper::ensureOpenInsertBlock($context, 'csm3_putenv_m3main_before_branch');
$setBb = BasicBlockHelper::append($context, 'csm3_putenv_m3main_set');
$skipBb = BasicBlockHelper::append($context, 'csm3_putenv_m3main_skip');
$doneBb = BasicBlockHelper::append($context, 'csm3_putenv_m3main_done');
Expand Down
2 changes: 1 addition & 1 deletion lib/JIT/M3EmitTuTrivialEchoAot.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public static function registerLinktime(
'sentinelLc' => $sentinelLc,
'objectOnly' => $objectOnlySidecar,
'sourcePathGlobal' => $sourcePathGlobal,
'contentMatchOnly' => self::isCompilerLibSidecarRel($sidecarRel),
'contentMatchOnly' => self::isCompilerLibSidecarRel($sidecarRel) && !$objectOnlySidecar,
];

if (null === $context->m3EmitTuTrivialEchoSourceGlobal) {
Expand Down
1 change: 1 addition & 0 deletions test/unit/M3EmitTuCompileDriverGateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function testEmitTuCompileDriverGateAndRuntimeInitPresentInJit(): void
$this->assertStringContainsString('exitWithStatus', $emit);
$this->assertStringContainsString('return true;', $emit);
$this->assertStringContainsString('contentMatchOnly', $aot);
$this->assertStringContainsString('!$objectOnlySidecar', $aot);
$this->assertStringContainsString('COMPILER_LIB_SOURCE_PATH_NORM', $aot);
$this->assertStringContainsString('COMPILER_LIB_SIDECAR_REL === $sidecarRel', $jit);
$this->assertStringContainsString("memLimit = '8192M'", $jit);
Expand Down