Skip to content

Commit df2ffb1

Browse files
committed
Merge branch 'master' of github.com:memory-agape/php-java
2 parents 26eed22 + 0db7a15 commit df2ffb1

24 files changed

Lines changed: 472 additions & 25 deletions

src/Kernel/Mnemonics/_d2f.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
namespace PHPJava\Kernel\Mnemonics;
33

44
use PHPJava\Exceptions\NotImplementedException;
5+
use PHPJava\Kernel\Types\_Float;
56
use PHPJava\Utilities\BinaryTool;
7+
use PHPJava\Utilities\Extractor;
68

79
final class _d2f implements OperationInterface
810
{
@@ -11,6 +13,10 @@ final class _d2f implements OperationInterface
1113

1214
public function execute(): void
1315
{
14-
throw new NotImplementedException(__CLASS__);
16+
$value = Extractor::realValue(
17+
$this->popFromOperandStack()
18+
);
19+
20+
$this->pushToOperandStack(new _Float($value));
1521
}
1622
}

src/Kernel/Mnemonics/_d2i.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
namespace PHPJava\Kernel\Mnemonics;
33

44
use PHPJava\Exceptions\NotImplementedException;
5+
use PHPJava\Kernel\Types\_Int;
56
use PHPJava\Utilities\BinaryTool;
7+
use PHPJava\Utilities\Extractor;
68

79
final class _d2i implements OperationInterface
810
{
@@ -11,6 +13,10 @@ final class _d2i implements OperationInterface
1113

1214
public function execute(): void
1315
{
14-
throw new NotImplementedException(__CLASS__);
16+
$value = Extractor::realValue(
17+
$this->popFromOperandStack()
18+
);
19+
20+
$this->pushToOperandStack(new _Int($value));
1521
}
1622
}

src/Kernel/Mnemonics/_d2l.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
namespace PHPJava\Kernel\Mnemonics;
33

44
use PHPJava\Exceptions\NotImplementedException;
5+
use PHPJava\Kernel\Types\_Long;
56
use PHPJava\Utilities\BinaryTool;
7+
use PHPJava\Utilities\Extractor;
68

79
final class _d2l implements OperationInterface
810
{
@@ -11,6 +13,10 @@ final class _d2l implements OperationInterface
1113

1214
public function execute(): void
1315
{
14-
throw new NotImplementedException(__CLASS__);
16+
$value = Extractor::realValue(
17+
$this->popFromOperandStack()
18+
);
19+
20+
$this->pushToOperandStack(new _Long($value));
1521
}
1622
}

src/Kernel/Mnemonics/_dreturn.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@
22
namespace PHPJava\Kernel\Mnemonics;
33

44
use PHPJava\Exceptions\NotImplementedException;
5+
use PHPJava\Kernel\Types\_Double;
56
use PHPJava\Utilities\BinaryTool;
67

78
final class _dreturn implements OperationInterface
89
{
910
use \PHPJava\Kernel\Core\Accumulator;
1011
use \PHPJava\Kernel\Core\ConstantPool;
1112

12-
public function execute(): void
13+
public function execute()
1314
{
14-
return new JavaTypeDouble($this->popFromOperandStack());
15+
$value = $this->popFromOperandStack();
16+
return ($value instanceof _Double)
17+
? $value
18+
: new _Double($value);
1519
}
1620
}

src/Kernel/Mnemonics/_f2d.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
namespace PHPJava\Kernel\Mnemonics;
33

44
use PHPJava\Exceptions\NotImplementedException;
5+
use PHPJava\Kernel\Types\_Double;
56
use PHPJava\Utilities\BinaryTool;
7+
use PHPJava\Utilities\Extractor;
68

79
final class _f2d implements OperationInterface
810
{
@@ -11,6 +13,10 @@ final class _f2d implements OperationInterface
1113

1214
public function execute(): void
1315
{
14-
throw new NotImplementedException(__CLASS__);
16+
$value = Extractor::realValue(
17+
$this->popFromOperandStack()
18+
);
19+
20+
$this->pushToOperandStack(new _Double($value));
1521
}
1622
}

src/Kernel/Mnemonics/_f2i.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
namespace PHPJava\Kernel\Mnemonics;
33

44
use PHPJava\Exceptions\NotImplementedException;
5+
use PHPJava\Kernel\Types\_Int;
56
use PHPJava\Utilities\BinaryTool;
7+
use PHPJava\Utilities\Extractor;
68

79
final class _f2i implements OperationInterface
810
{
@@ -11,6 +13,10 @@ final class _f2i implements OperationInterface
1113

1214
public function execute(): void
1315
{
14-
throw new NotImplementedException(__CLASS__);
16+
$value = Extractor::realValue(
17+
$this->popFromOperandStack()
18+
);
19+
20+
$this->pushToOperandStack(new _Int($value));
1521
}
1622
}

src/Kernel/Mnemonics/_f2l.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
namespace PHPJava\Kernel\Mnemonics;
33

44
use PHPJava\Exceptions\NotImplementedException;
5+
use PHPJava\Kernel\Types\_Long;
56
use PHPJava\Utilities\BinaryTool;
7+
use PHPJava\Utilities\Extractor;
68

79
final class _f2l implements OperationInterface
810
{
@@ -11,6 +13,10 @@ final class _f2l implements OperationInterface
1113

1214
public function execute(): void
1315
{
14-
throw new NotImplementedException(__CLASS__);
16+
$value = Extractor::realValue(
17+
$this->popFromOperandStack()
18+
);
19+
20+
$this->pushToOperandStack(new _Long($value));
1521
}
1622
}

src/Kernel/Mnemonics/_fload.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
namespace PHPJava\Kernel\Mnemonics;
33

44
use PHPJava\Exceptions\NotImplementedException;
5+
use PHPJava\Kernel\Types\_Float;
56
use PHPJava\Utilities\BinaryTool;
67

78
final class _fload implements OperationInterface
@@ -11,6 +12,11 @@ final class _fload implements OperationInterface
1112

1213
public function execute(): void
1314
{
14-
throw new NotImplementedException(__CLASS__);
15+
$index = $this->readUnsignedByte();
16+
$this->pushToOperandStack(
17+
new _Float(
18+
$this->getLocalStorage($index)
19+
)
20+
);
1521
}
1622
}

src/Kernel/Mnemonics/_fload_0.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
namespace PHPJava\Kernel\Mnemonics;
33

44
use PHPJava\Exceptions\NotImplementedException;
5+
use PHPJava\Kernel\Types\_Float;
56
use PHPJava\Utilities\BinaryTool;
67

78
final class _fload_0 implements OperationInterface
@@ -11,6 +12,10 @@ final class _fload_0 implements OperationInterface
1112

1213
public function execute(): void
1314
{
14-
throw new NotImplementedException(__CLASS__);
15+
$this->pushToOperandStack(
16+
new _Float(
17+
$this->getLocalStorage(0)
18+
)
19+
);
1520
}
1621
}

src/Kernel/Mnemonics/_fload_1.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
namespace PHPJava\Kernel\Mnemonics;
33

44
use PHPJava\Exceptions\NotImplementedException;
5+
use PHPJava\Kernel\Types\_Float;
56
use PHPJava\Utilities\BinaryTool;
67

78
final class _fload_1 implements OperationInterface
@@ -11,6 +12,10 @@ final class _fload_1 implements OperationInterface
1112

1213
public function execute(): void
1314
{
14-
throw new NotImplementedException(__CLASS__);
15+
$this->pushToOperandStack(
16+
new _Float(
17+
$this->getLocalStorage(1)
18+
)
19+
);
1520
}
1621
}

0 commit comments

Comments
 (0)