php / php/php-src

JIT trace not invalidated after re-linking

未关闭
#8,642 0 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug Category: JIT Status: Verified
主要语言
C
星标
40.4k
派生
8.1k
平均合并
2 天 13 小时
30 天内合并 PR
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. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

未指定源文件或测试。从 PHP 8.1 示例开始,调查类重新链接过程中的 JIT 跟踪;完成标准是使过时的 JIT 代码失效,从而执行不能保留此前已链接类的假设,并为该场景提供回归覆盖。

由索引模型根据 Issue 内容生成。

评估

技术栈
c, php
领域
compilers
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。