- 在 Clang、Gcc 和 Msvc 编译后端中添加 PROF_OUTPUT_FILE 宏定义支持 - 实现编译器性能分析模式,通过 --profile 参数启用并自动链接 -lprofiler 库 - 添加 .prof 文件分析功能,支持 php bin/compiler.php app.prof 格式调用 pprof 工具 - 实现 objval() 函数的 AOT 编译支持,用于对象类型转换 - 更新编译器缓存逻辑,启用性能分析时强制重新编译 - 添加 Linux 平台限制检查,非 Linux 系统使用 --profile 参数时显示错误提示 - 创建 objval 函数的单元测试用例pull/1/head
parent
33ee85c122
commit
1ea7ec0764
8 changed files with 115 additions and 12 deletions
@ -1,8 +0,0 @@ |
||||
#!/usr/bin/env php |
||||
<?php |
||||
if (count($argv) < 2) { |
||||
echo "Usage: $argv[0] elf\n"; |
||||
exit(1); |
||||
} |
||||
$elf = $argv[1]; |
||||
shell_exec("pprof --pdf $elf profile.out > profile.pdf"); |
||||
@ -0,0 +1,42 @@ |
||||
--TEST-- |
||||
objval |
||||
--FILE-- |
||||
<?php |
||||
|
||||
class TestEvent |
||||
{ |
||||
public int $x = 0; |
||||
public int $y = 0; |
||||
public string $action = ''; |
||||
|
||||
public function __construct(int $x, int $y, string $action) |
||||
{ |
||||
$this->x = $x; |
||||
$this->y = $y; |
||||
$this->action = $action; |
||||
} |
||||
|
||||
public function getX(): int { |
||||
return $this->x; |
||||
} |
||||
} |
||||
|
||||
function wrapObjval($ev): TestEvent |
||||
{ |
||||
return objval($ev, TestEvent::class); |
||||
} |
||||
|
||||
function main() { |
||||
$ev = new TestEvent(42, 0, 'base'); |
||||
$ev2 = wrapObjval($ev); |
||||
var_dump($ev2->x); |
||||
var_dump($ev2->getX()); |
||||
|
||||
echo "done\n"; |
||||
} |
||||
|
||||
?> |
||||
--EXPECT-- |
||||
int(42) |
||||
int(42) |
||||
done |
||||
Loading…
Reference in new issue