Skip to content

JIT trace not invalidated after re-linking #8642

Open
@arnaud-lb

Description

@arnaud-lb

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions