php / php/php-src

JIT trace not invalidated after re-linking

オープン
#8,642 コメント 0 件 リアクション 4 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Category: JIT Status: Verified
主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

ソースファイルもテストも指定されていません。PHP 8.1 の例から始め、クラスの再リンクにまたがる JIT トレースを調査してください。完了条件は、古くなった JIT コードが無効化され、実行時に以前にリンクされたクラスの前提を保持できないことと、そのシナリオを回帰テストでカバーすることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, php
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。