Skip to content

Provide script to TSSA build in tracing JIT #18353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,10 @@ jobs:
--no-progress \
--offline \
--show-diff \
--show-out \
--show-slow 1000 \
--set-timeout 120 \
--repeat 2
--repeat 2 ext/opcache
workflows:
push-workflow:
Expand Down
8 changes: 8 additions & 0 deletions ext/opcache/jit/zend_jit_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -4117,6 +4117,14 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par

checkpoint = zend_arena_checkpoint(CG(arena));

zend_accel_hash_entry *accel_h_entry = zend_accel_hash_find_entry(&ZCSG(hash), trace_buffer->op_array->filename);
if (accel_h_entry) {
zend_persistent_script *persistent_script = (zend_persistent_script *) accel_h_entry->data;
if (!persistent_script->corrupted) {
script = &persistent_script->script;
}
}

ssa = zend_jit_trace_build_tssa(trace_buffer, parent_trace, exit_num, script, op_arrays, &num_op_arrays);

if (!ssa) {
Expand Down
48 changes: 48 additions & 0 deletions ext/opcache/tests/jit/tssa_zend_recv_inference.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
--TEST--
TSSA ZEND_RECV inference
--EXTENSIONS--
opcache
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.jit=tracing
opcache.jit_buffer_size=16M
opcache.jit_debug=2
opcache.jit_hot_func=2
opcache.jit_hot_loop=10
--FILE--
<?php
final class Foo {
public $prop = 0;
}
function test(Foo $obj) {
$obj->prop=1;
}

$foo = new Foo;
for ($i=0; $i < 5; $i++) {
test($foo);
}
?>
--EXPECTF--
test:
; (lines=4, args=1, vars=1, tmps=%d, ssa_vars=3)
; (JIT)
; %s
; return [null] RANGE[0..0]
; #0.CV0($obj) NOVAL [undef]
BB0:
; start lines=[0-0]
; to=(BB1)
; level=0
; children=(BB1)
0000 #1.CV0($obj) [rc1, rcn, object (Foo)] = RECV 1

BB1:
; recv follow exit entry lines=[1-3]
; from=(BB0)
; idom=BB0
; level=1
0001 ASSIGN_OBJ #1.CV0($obj) [rc1, rcn, object (Foo)] -> #2.CV0($obj) NOVAL [rc1, rcn, object (Foo)] string("prop")
0002 OP_DATA int(1)
0003 RETURN null
Loading