File tree Expand file tree Collapse file tree 22 files changed +389
-57
lines changed
Expand file tree Collapse file tree 22 files changed +389
-57
lines changed Original file line number Diff line number Diff line change @@ -266,7 +266,12 @@ function () use ($fullName) {
266266 );
267267 }
268268
269- if ($ returnValue !== null ) {
269+ if ($ opcode === OpCode::_return ||
270+ $ opcode === OpCode::_areturn ||
271+ $ opcode === OpCode::_freturn ||
272+ $ opcode === OpCode::_dreturn ||
273+ $ opcode === OpCode::_ireturn
274+ ) {
270275 if ($ isEnabledTrace ) {
271276 $ this ->javaClassInvoker ->getJavaClass ()->appendDebug ($ debugTraces );
272277 }
Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Types \_Int ;
6+ use PHPJava \Utilities \Extractor ;
57
68final class _dcmpg implements OperationInterface
79{
@@ -10,6 +12,25 @@ final class _dcmpg implements OperationInterface
1012
1113 public function execute (): void
1214 {
13- throw new NotImplementedException (__CLASS__ );
15+ $ rightOperand = Extractor::getRealValue ($ this ->popFromOperandStack ());
16+ $ leftOperand = Extractor::getRealValue ($ this ->popFromOperandStack ());
17+
18+ if ($ leftOperand > $ rightOperand ) {
19+ $ this ->pushToOperandStack (
20+ new _Int (1 )
21+ );
22+ return ;
23+ }
24+
25+ if ($ leftOperand < $ rightOperand ) {
26+ $ this ->pushToOperandStack (
27+ new _Int (-1 )
28+ );
29+ return ;
30+ }
31+
32+ $ this ->pushToOperandStack (
33+ new _Int (0 )
34+ );
1435 }
1536}
Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Kernel \Mnemonics ;
33
4- use PHPJava \Exceptions \NotImplementedException ;
4+ use PHPJava \Kernel \Types \_Int ;
5+ use PHPJava \Utilities \Extractor ;
56
67final class _dcmpl implements OperationInterface
78{
@@ -10,6 +11,25 @@ final class _dcmpl implements OperationInterface
1011
1112 public function execute (): void
1213 {
13- throw new NotImplementedException (__CLASS__ );
14+ $ rightOperand = Extractor::getRealValue ($ this ->popFromOperandStack ());
15+ $ leftOperand = Extractor::getRealValue ($ this ->popFromOperandStack ());
16+
17+ if ($ leftOperand > $ rightOperand ) {
18+ $ this ->pushToOperandStack (
19+ new _Int (1 )
20+ );
21+ return ;
22+ }
23+
24+ if ($ leftOperand < $ rightOperand ) {
25+ $ this ->pushToOperandStack (
26+ new _Int (-1 )
27+ );
28+ return ;
29+ }
30+
31+ $ this ->pushToOperandStack (
32+ new _Int (0 )
33+ );
1434 }
1535}
Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Kernel \Mnemonics ;
33
4+ use PHPJava \Kernel \Types \_Double ;
5+
46final class _dconst_0 implements OperationInterface
57{
68 use \PHPJava \Kernel \Core \Accumulator;
79 use \PHPJava \Kernel \Core \ConstantPool;
810
911 public function execute (): void
1012 {
11- $ this ->pushToOperandStack (0 );
13+ $ this ->pushToOperandStack (
14+ new _Double (0 )
15+ );
1216 }
1317}
Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Kernel \Mnemonics ;
33
4+ use PHPJava \Kernel \Types \_Double ;
5+
46final class _dconst_1 implements OperationInterface
57{
68 use \PHPJava \Kernel \Core \Accumulator;
79 use \PHPJava \Kernel \Core \ConstantPool;
810
911 public function execute (): void
1012 {
11- $ this ->pushToOperandStack (1 );
13+ $ this ->pushToOperandStack (
14+ new _Double (1 )
15+ );
1216 }
1317}
Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Kernel \Mnemonics ;
33
4- use PHPJava \Exceptions \NotImplementedException ;
4+ use PHPJava \Kernel \Types \_Double ;
5+ use PHPJava \Utilities \BinaryTool ;
6+ use PHPJava \Utilities \Extractor ;
57
68final class _ddiv implements OperationInterface
79{
@@ -10,6 +12,16 @@ final class _ddiv implements OperationInterface
1012
1113 public function execute (): void
1214 {
13- throw new NotImplementedException (__CLASS__ );
15+ $ value2 = $ this ->popFromOperandStack ();
16+ $ value1 = $ this ->popFromOperandStack ();
17+
18+ $ this ->pushToOperandStack (
19+ new _Double (
20+ BinaryTool::div (
21+ Extractor::getRealValue ($ value1 ),
22+ Extractor::getRealValue ($ value2 )
23+ )
24+ )
25+ );
1426 }
1527}
Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Types \_Int ;
6+ use PHPJava \Utilities \Extractor ;
57
68final class _fcmpg implements OperationInterface
79{
@@ -10,6 +12,25 @@ final class _fcmpg implements OperationInterface
1012
1113 public function execute (): void
1214 {
13- throw new NotImplementedException (__CLASS__ );
15+ $ rightOperand = Extractor::getRealValue ($ this ->popFromOperandStack ());
16+ $ leftOperand = Extractor::getRealValue ($ this ->popFromOperandStack ());
17+
18+ if ($ leftOperand > $ rightOperand ) {
19+ $ this ->pushToOperandStack (
20+ new _Int (1 )
21+ );
22+ return ;
23+ }
24+
25+ if ($ leftOperand < $ rightOperand ) {
26+ $ this ->pushToOperandStack (
27+ new _Int (-1 )
28+ );
29+ return ;
30+ }
31+
32+ $ this ->pushToOperandStack (
33+ new _Int (0 )
34+ );
1435 }
1536}
Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Types \_Int ;
6+ use PHPJava \Utilities \Extractor ;
57
68final class _fcmpl implements OperationInterface
79{
@@ -10,6 +12,25 @@ final class _fcmpl implements OperationInterface
1012
1113 public function execute (): void
1214 {
13- throw new NotImplementedException (__CLASS__ );
15+ $ rightOperand = Extractor::getRealValue ($ this ->popFromOperandStack ());
16+ $ leftOperand = Extractor::getRealValue ($ this ->popFromOperandStack ());
17+
18+ if ($ leftOperand > $ rightOperand ) {
19+ $ this ->pushToOperandStack (
20+ new _Int (1 )
21+ );
22+ return ;
23+ }
24+
25+ if ($ leftOperand < $ rightOperand ) {
26+ $ this ->pushToOperandStack (
27+ new _Int (-1 )
28+ );
29+ return ;
30+ }
31+
32+ $ this ->pushToOperandStack (
33+ new _Int (0 )
34+ );
1435 }
1536}
Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Kernel \Mnemonics ;
33
4- use PHPJava \Exceptions \ NotImplementedException ;
4+ use PHPJava \Kernel \ Types \ _Float ;
55
66final class _fconst_0 implements OperationInterface
77{
@@ -10,6 +10,6 @@ final class _fconst_0 implements OperationInterface
1010
1111 public function execute (): void
1212 {
13- throw new NotImplementedException ( __CLASS__ );
13+ $ this -> pushToOperandStack ( new _Float ( 0 ) );
1414 }
1515}
Original file line number Diff line number Diff line change 11<?php
22namespace PHPJava \Kernel \Mnemonics ;
33
4- use PHPJava \Exceptions \ NotImplementedException ;
4+ use PHPJava \Kernel \ Types \ _Float ;
55
66final class _fconst_1 implements OperationInterface
77{
@@ -10,6 +10,6 @@ final class _fconst_1 implements OperationInterface
1010
1111 public function execute (): void
1212 {
13- throw new NotImplementedException ( __CLASS__ );
13+ $ this -> pushToOperandStack ( new _Float ( 1 ) );
1414 }
1515}
You can’t perform that action at this time.
0 commit comments