File tree Expand file tree Collapse file tree 10 files changed +51
-35
lines changed
Expand file tree Collapse file tree 10 files changed +51
-35
lines changed Original file line number Diff line number Diff line change @@ -54,13 +54,13 @@ public function getLocals(): array
5454
5555 public function addLocal (int $ verificationType , ...$ arguments ): self
5656 {
57- $ this ->locals [] = [$ verificationType , $ arguments] ;
57+ $ this ->locals [] = array_merge ( [$ verificationType] , $ arguments) ;
5858 return $ this ;
5959 }
6060
6161 public function addStack (int $ verificationType , ...$ arguments ): self
6262 {
63- $ this ->stacks [] = [$ verificationType , $ arguments] ;
63+ $ this ->stacks [] = array_merge ( [$ verificationType] , $ arguments) ;
6464 return $ this ;
6565 }
6666
Original file line number Diff line number Diff line change 1818use PHPJava \Core \JVM \Stream \BinaryWriter ;
1919use PHPJava \Exceptions \AssembleStructureException ;
2020use PHPJava \Kernel \Maps \VerificationTypeTag ;
21- use PHPJava \Kernel \Resolvers \TypeResolver ;
2221use PHPJava \Kernel \Types \_Byte ;
2322use PHPJava \Kernel \Types \_Char ;
2423use PHPJava \Kernel \Types \_Float ;
@@ -93,21 +92,6 @@ public function getValue(): string
9392 $ emulatedAccumulator = new Accumulator ();
9493 $ currentOffset = 0 ;
9594
96- foreach ($ this ->getStore ()->getAll () as $ localStorage ) {
97- [$ localStorageIndex , $ type ] = $ localStorage ;
98- [$ verificationTypeTag , $ objectClassType ] = TypeResolver::getVerificationTypeTagByKernelType ($ type );
99- $ emulatedAccumulator ->setToLocal (
100- $ localStorageIndex ,
101- [
102- $ verificationTypeTag ,
103- $ objectClassType !== null
104- ? $ this ->getEnhancedConstantPool ()
105- ->findClass ($ objectClassType )
106- : null ,
107- ]
108- );
109- }
110-
11195 foreach ($ this ->operations as $ operation ) {
11296 $ programCounter = $ this ->calculateProgramCounterByOperationCodes (
11397 $ this ->operations ,
@@ -141,7 +125,7 @@ public function getValue(): string
141125 usort (
142126 $ entries ,
143127 static function (FullFrame $ a , FullFrame $ b ) {
144- return $ a ->getBranchTarget () - $ b ->getBranchTarget ();
128+ return $ a ->getBranchTarget () <=> $ b ->getBranchTarget ();
145129 }
146130 );
147131
Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Compiler \Emulator \Mnemonics ;
33
4+ use PHPJava \Kernel \Maps \VerificationTypeTag ;
5+
46class _aload_0 extends AbstractOperationCode implements OperationCodeInterface
57{
68 use \PHPJava \Compiler \Emulator \Traits \GeneralProcessor;
79
810 public function execute (): void
911 {
1012 $ this ->accumulator ->pushToOperandStack (
11- $ this ->accumulator
12- ->getFromLocal (0 )
13+ [
14+ VerificationTypeTag::ITEM_Object,
15+ $ this ->getEnhancedConstantPool ()
16+ ->findClass (\PHPJava \Packages \java \lang \_String::class),
17+ ]
1318 );
1419 }
1520}
Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Compiler \Emulator \Mnemonics ;
33
4+ use PHPJava \Kernel \Maps \VerificationTypeTag ;
5+
46class _aload_1 extends AbstractOperationCode implements OperationCodeInterface
57{
68 use \PHPJava \Compiler \Emulator \Traits \GeneralProcessor;
79
810 public function execute (): void
911 {
1012 $ this ->accumulator ->pushToOperandStack (
11- $ this ->accumulator
12- ->getFromLocal (0 )
13+ [
14+ VerificationTypeTag::ITEM_Object,
15+ $ this ->getEnhancedConstantPool ()
16+ ->findClass (\PHPJava \Packages \java \lang \_String::class),
17+ ]
1318 );
1419 }
1520}
Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Compiler \Emulator \Mnemonics ;
33
4+ use PHPJava \Kernel \Maps \VerificationTypeTag ;
5+
46class _aload_2 extends AbstractOperationCode implements OperationCodeInterface
57{
68 use \PHPJava \Compiler \Emulator \Traits \GeneralProcessor;
79
810 public function execute (): void
911 {
1012 $ this ->accumulator ->pushToOperandStack (
11- $ this ->accumulator
12- ->getFromLocal (0 )
13+ [
14+ VerificationTypeTag::ITEM_Object,
15+ $ this ->getEnhancedConstantPool ()
16+ ->findClass (\PHPJava \Packages \java \lang \_String::class),
17+ ]
1318 );
1419 }
1520}
Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Compiler \Emulator \Mnemonics ;
33
4+ use PHPJava \Kernel \Maps \VerificationTypeTag ;
5+
46class _aload_3 extends AbstractOperationCode implements OperationCodeInterface
57{
68 use \PHPJava \Compiler \Emulator \Traits \GeneralProcessor;
79
810 public function execute (): void
911 {
1012 $ this ->accumulator ->pushToOperandStack (
11- $ this ->accumulator
12- ->getFromLocal (0 )
13+ [
14+ VerificationTypeTag::ITEM_Object,
15+ $ this ->getEnhancedConstantPool ()
16+ ->findClass (\PHPJava \Packages \java \lang \_String::class),
17+ ]
1318 );
1419 }
1520}
Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Compiler \Emulator \Mnemonics ;
33
4+ use PHPJava \Kernel \Maps \VerificationTypeTag ;
5+
46class _iload_0 extends AbstractOperationCode implements OperationCodeInterface
57{
68 use \PHPJava \Compiler \Emulator \Traits \GeneralProcessor;
79
810 public function execute (): void
911 {
1012 $ this ->accumulator ->pushToOperandStack (
11- $ this ->accumulator
12- ->getFromLocal (0 )
13+ [
14+ VerificationTypeTag::ITEM_Integer,
15+ ]
1316 );
1417 }
1518}
Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Compiler \Emulator \Mnemonics ;
33
4+ use PHPJava \Kernel \Maps \VerificationTypeTag ;
5+
46class _iload_1 extends AbstractOperationCode implements OperationCodeInterface
57{
68 use \PHPJava \Compiler \Emulator \Traits \GeneralProcessor;
79
810 public function execute (): void
911 {
1012 $ this ->accumulator ->pushToOperandStack (
11- $ this ->accumulator
12- ->getFromLocal (1 )
13+ [
14+ VerificationTypeTag::ITEM_Integer,
15+ ]
1316 );
1417 }
1518}
Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Compiler \Emulator \Mnemonics ;
33
4+ use PHPJava \Kernel \Maps \VerificationTypeTag ;
5+
46class _iload_2 extends AbstractOperationCode implements OperationCodeInterface
57{
68 use \PHPJava \Compiler \Emulator \Traits \GeneralProcessor;
79
810 public function execute (): void
911 {
1012 $ this ->accumulator ->pushToOperandStack (
11- $ this ->accumulator
12- ->getFromLocal (2 )
13+ [
14+ VerificationTypeTag::ITEM_Integer,
15+ ]
1316 );
1417 }
1518}
Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Compiler \Emulator \Mnemonics ;
33
4+ use PHPJava \Kernel \Maps \VerificationTypeTag ;
5+
46class _iload_3 extends AbstractOperationCode implements OperationCodeInterface
57{
68 use \PHPJava \Compiler \Emulator \Traits \GeneralProcessor;
79
810 public function execute (): void
911 {
1012 $ this ->accumulator ->pushToOperandStack (
11- $ this ->accumulator
12- ->getFromLocal (3 )
13+ [
14+ VerificationTypeTag::ITEM_Integer,
15+ ]
1316 );
1417 }
1518}
You can’t perform that action at this time.
0 commit comments