File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Types \_Double ;
6+ use PHPJava \Utilities \Extractor ;
57
68final class _drem implements OperationInterface
79{
@@ -10,6 +12,13 @@ final class _drem 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+ $ this ->pushToOperandStack (
19+ _Double::get (
20+ $ leftOperand % $ rightOperand
21+ )
22+ );
1423 }
1524}
Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Types \_Float ;
6+ use PHPJava \Utilities \Extractor ;
57
68final class _frem implements OperationInterface
79{
@@ -10,6 +12,13 @@ final class _frem 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+ $ this ->pushToOperandStack (
19+ _Float::get (
20+ $ leftOperand % $ rightOperand
21+ )
22+ );
1423 }
1524}
Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Utilities \Extractor ;
56
67final class _if_icmpeq implements OperationInterface
78{
@@ -10,6 +11,13 @@ final class _if_icmpeq implements OperationInterface
1011
1112 public function execute (): void
1213 {
13- throw new NotImplementedException (__CLASS__ );
14+ $ offset = $ this ->readShort ();
15+
16+ $ rightOperand = Extractor::getRealValue ($ this ->popFromOperandStack ());
17+ $ leftOperand = Extractor::getRealValue ($ this ->popFromOperandStack ());
18+
19+ if ($ leftOperand == $ rightOperand ) {
20+ $ this ->setOffset ($ this ->getProgramCounter () + $ offset );
21+ }
1422 }
1523}
Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Utilities \Extractor ;
56
67final class _ifnull implements OperationInterface
78{
@@ -10,6 +11,12 @@ final class _ifnull implements OperationInterface
1011
1112 public function execute (): void
1213 {
13- throw new NotImplementedException (__CLASS__ );
14+ $ offset = $ this ->readShort ();
15+
16+ $ branch = Extractor::getRealValue ($ this ->popFromOperandStack ());
17+
18+ if ($ branch === null ) {
19+ $ this ->setOffset ($ this ->getProgramCounter () + $ offset );
20+ }
1421 }
1522}
Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Mnemonics ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Types \_Long ;
6+ use PHPJava \Utilities \Extractor ;
57
68final class _lrem implements OperationInterface
79{
@@ -10,6 +12,13 @@ final class _lrem 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+ $ this ->pushToOperandStack (
19+ _Long::get (
20+ $ leftOperand % $ rightOperand
21+ )
22+ );
1423 }
1524}
You can’t perform that action at this time.
0 commit comments