php / php/php-src

JIT trace not invalidated after re-linking

Offen
#8,642 0 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bug Category: JIT Status: Verified
Vorherrschende Sprache
C
Sterne
40.4k
Forks
8.1k
Ø Merge
2 T. 13 Std.
Gemergte PRs (30 T.)
96

Beschreibung

Description

JIT traces are not invalidated after a class is re-linked. The JIT code may make assumptions that are not true anymore after re-linking.

For example, in

<?php

$a=0;

class A implement Iface {
    public function hello() {
        global $a;
        for ($i = 0; $i < 100; $i++) {
            $a++;
        }
    }
}

we may still enter in the JITed loop after A has been re-linked (A can be re-link due to Iface being recompiled for example). The JITed code may be based on assumptions that are not true anymore (at least the run_time_cache pointer changes during linking, but I suspect that other assumptions can be made based on the parent classes or interfaces, that do not hold true after re-linking).

This is due to op_array.oplines being shared between all linked versions of the same class. oplines has pointers to JITed code.

op_array.oplines is also shared between all sub-classes, but as long as the JIT's asumptions are based on the declaring class it should be ok.

PHP Version

PHP 8.1

Operating System

No response

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Keine Quelldatei oder kein Test ist angegeben. Beginne mit dem Beispiel für PHP 8.1 und untersuche JIT-Traces über das erneute Verknüpfen von Klassen hinweg; abgeschlossen ist die Aufgabe, wenn veralteter JIT-Code ungültig gemacht wird, sodass die Ausführung keine Annahmen der zuvor verknüpften Klasse beibehalten kann, und eine Regressionstest-Abdeckung für dieses Szenario vorhanden ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c, php
Bereich
compilers
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.