File tree 2 files changed +40
-0
lines changed
2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /**
4
+ * This file is part of the sj-i/php-profiler package.
5
+ *
6
+
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ declare (strict_types=1 );
13
+
14
+ namespace PhpProfiler \Lib \Dwarf \Expression \Opcodes \LiteralEncodings ;
15
+
16
+ use PhpProfiler \Lib \Dwarf \Expression \ExpressionContext ;
17
+ use PhpProfiler \Lib \Dwarf \Expression \Opcodes \Opcode ;
18
+ use PhpProfiler \Lib \Dwarf \Expression \Stack ;
19
+
20
+ final class AddrConstX implements Opcode
21
+ {
22
+ public function __construct (
23
+ private ExpressionContext $ expression_context ,
24
+ ) {
25
+ }
26
+
27
+ public function execute (Stack $ stack , ...$ operands ): int
28
+ {
29
+ $ unit_die = $ this ->expression_context ->getCompilationUnit ()->unit_die ;
30
+ $ address_table = $ this ->expression_context ->getExecutableFile ()->debug_addr ->address_table ;
31
+ $ address_base = $ unit_die ->getAddressBase ();
32
+ $ address = $ operands [0 ] * $ address_table ->address_table_header ->address_size + $ address_base ;
33
+ $ index = $ address / $ address_table ->address_table_header ->address_size ;
34
+
35
+ $ stack ->push ($ address_table ->addresses [$ index ]);
36
+ return 1 ;
37
+ }
38
+ }
Original file line number Diff line number Diff line change @@ -221,6 +221,8 @@ public function getOpcode(ExpressionContext $expression_context): Opcode
221
221
self ::DW_OP_const8s, self ::DW_OP_const8u,
222
222
self ::DW_OP_consts, self ::DW_OP_constu
223
223
=> new Constant (),
224
+ self ::DW_OP_constx, self ::DW_OP_addrx
225
+ => new AddrConstX ($ expression_context ),
224
226
};
225
227
}
226
228
You can’t perform that action at this time.
0 commit comments