Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add mnemonics
  • Loading branch information
m3m0r7 committed May 12, 2019
commit a676a0e39498e2130498dcff2f015bcaadf7ec9f
8 changes: 7 additions & 1 deletion src/Kernel/Mnemonics/_baload.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace PHPJava\Kernel\Mnemonics;

use PHPJava\Exceptions\NotImplementedException;
use PHPJava\Utilities\Extractor;

final class _baload implements OperationInterface
{
Expand All @@ -10,6 +11,11 @@ final class _baload implements OperationInterface

public function execute(): void
{
throw new NotImplementedException(__CLASS__);
$index = Extractor::getRealValue($this->popFromOperandStack());
$arrayref = $this->popFromOperandStack();

$this->pushToOperandStack(
$arrayref[$index]
);
}
}
17 changes: 16 additions & 1 deletion src/Kernel/Mnemonics/_bastore.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
namespace PHPJava\Kernel\Mnemonics;

use PHPJava\Exceptions\NotImplementedException;
use PHPJava\Kernel\Types\Type;
use PHPJava\Utilities\Extractor;

final class _bastore implements OperationInterface
{
Expand All @@ -10,6 +12,19 @@ final class _bastore implements OperationInterface

public function execute(): void
{
throw new NotImplementedException(__CLASS__);
$value = $this->popFromOperandStack();
$index = Extractor::getRealValue($this->popFromOperandStack());

/**
* @var Type $arrayref
*/
$arrayref = $this->popFromOperandStack();

// The value is a ref.
$arrayref[$index] = $value;

$this->pushToOperandStack(
$arrayref
);
}
}
8 changes: 7 additions & 1 deletion src/Kernel/Mnemonics/_caload.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace PHPJava\Kernel\Mnemonics;

use PHPJava\Exceptions\NotImplementedException;
use PHPJava\Utilities\Extractor;

final class _caload implements OperationInterface
{
Expand All @@ -10,6 +11,11 @@ final class _caload implements OperationInterface

public function execute(): void
{
throw new NotImplementedException(__CLASS__);
$index = Extractor::getRealValue($this->popFromOperandStack());
$arrayref = $this->popFromOperandStack();

$this->pushToOperandStack(
$arrayref[$index]
);
}
}
4 changes: 3 additions & 1 deletion src/Kernel/Mnemonics/_daload.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public function execute(): void
$index = Extractor::getRealValue($this->popFromOperandStack());
$arrayref = $this->popFromOperandStack();

$this->pushToOperandStack($arrayref[$index]);
$this->pushToOperandStack(
$arrayref[$index]
);
}
}
10 changes: 10 additions & 0 deletions src/Kernel/Mnemonics/_dastore.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace PHPJava\Kernel\Mnemonics;

use PHPJava\Kernel\Types\Type;
use PHPJava\Utilities\Extractor;

final class _dastore implements OperationInterface
Expand All @@ -15,8 +16,17 @@ public function execute(): void
{
$value = $this->popFromOperandStack();
$index = Extractor::getRealValue($this->popFromOperandStack());

/**
* @var Type $arrayref
*/
$arrayref = $this->popFromOperandStack();

// The value is a ref.
$arrayref[$index] = $value;

$this->pushToOperandStack(
$arrayref
);
}
}
9 changes: 7 additions & 2 deletions src/Kernel/Mnemonics/_dstore.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php
namespace PHPJava\Kernel\Mnemonics;

use PHPJava\Kernel\Types\_Double;
use PHPJava\Utilities\BinaryTool;
use PHPJava\Utilities\Extractor;

final class _dstore implements OperationInterface
{
Expand All @@ -14,8 +16,11 @@ final class _dstore implements OperationInterface
public function execute(): void
{
$index = $this->readUnsignedByte();
$value = $this->popFromOperandStack();
$value = Extractor::getRealValue($this->popFromOperandStack());

$this->setLocalStorage($index, BinaryTool::convertDoubleToIEEE754($value));
$this->setLocalStorage(
$index,
$value
);
}
}
9 changes: 8 additions & 1 deletion src/Kernel/Mnemonics/_faload.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
namespace PHPJava\Kernel\Mnemonics;

use PHPJava\Exceptions\NotImplementedException;
use PHPJava\Kernel\Types\Type;
use PHPJava\Utilities\Extractor;

final class _faload implements OperationInterface
{
Expand All @@ -10,6 +12,11 @@ final class _faload implements OperationInterface

public function execute(): void
{
throw new NotImplementedException(__CLASS__);
$index = Extractor::getRealValue($this->popFromOperandStack());
$arrayref = $this->popFromOperandStack();

$this->pushToOperandStack(
$arrayref[$index]
);
}
}
17 changes: 16 additions & 1 deletion src/Kernel/Mnemonics/_fastore.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
namespace PHPJava\Kernel\Mnemonics;

use PHPJava\Exceptions\NotImplementedException;
use PHPJava\Kernel\Types\Type;
use PHPJava\Utilities\Extractor;

final class _fastore implements OperationInterface
{
Expand All @@ -10,6 +12,19 @@ final class _fastore implements OperationInterface

public function execute(): void
{
throw new NotImplementedException(__CLASS__);
$value = $this->popFromOperandStack();
$index = Extractor::getRealValue($this->popFromOperandStack());

/**
* @var Type $arrayref
*/
$arrayref = $this->popFromOperandStack();

// The value is a ref.
$arrayref[$index] = $value;

$this->pushToOperandStack(
$arrayref
);
}
}
8 changes: 7 additions & 1 deletion src/Kernel/Mnemonics/_saload.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace PHPJava\Kernel\Mnemonics;

use PHPJava\Exceptions\NotImplementedException;
use PHPJava\Utilities\Extractor;

final class _saload implements OperationInterface
{
Expand All @@ -10,6 +11,11 @@ final class _saload implements OperationInterface

public function execute(): void
{
throw new NotImplementedException(__CLASS__);
$index = Extractor::getRealValue($this->popFromOperandStack());
$arrayref = $this->popFromOperandStack();

$this->pushToOperandStack(
$arrayref[$index]
);
}
}
17 changes: 16 additions & 1 deletion src/Kernel/Mnemonics/_sastore.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
namespace PHPJava\Kernel\Mnemonics;

use PHPJava\Exceptions\NotImplementedException;
use PHPJava\Kernel\Types\Type;
use PHPJava\Utilities\Extractor;

final class _sastore implements OperationInterface
{
Expand All @@ -10,6 +12,19 @@ final class _sastore implements OperationInterface

public function execute(): void
{
throw new NotImplementedException(__CLASS__);
$value = $this->popFromOperandStack();
$index = Extractor::getRealValue($this->popFromOperandStack());

/**
* @var Type $arrayref
*/
$arrayref = $this->popFromOperandStack();

// The value is a ref.
$arrayref[$index] = $value;

$this->pushToOperandStack(
$arrayref
);
}
}