Skip to content

Commit

Permalink
Fix problems
Browse files Browse the repository at this point in the history
  • Loading branch information
m3m0r7 committed Dec 26, 2023
1 parent df0b181 commit bfe275e
Show file tree
Hide file tree
Showing 154 changed files with 189 additions and 165 deletions.
2 changes: 1 addition & 1 deletion src/VM/Core/Runtime/Executor/Debugger/DebugFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private static function getEntriesAsString(array $entries): string
if ($item instanceof RubyClassInterface) {
$string .= "({$item})";
} elseif ($item instanceof Operation) {
$string .= "({$item->insn->name})";
$string .= "({$item->insn->name()})";
} elseif ($item instanceof Operand && $item->operand instanceof RubyClassInterface) {
$string = ClassHelper::nameBy($item->operand);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public function showExecutedOperations(): void
implode(' -> ', $context->traces()),
sprintf(
'[0x%02x] %s %s',
$insn->value,
strtolower((string) $insn->name),
$insn->value(),

Check failure on line 99 in src/VM/Core/Runtime/Executor/Debugger/DefaultExecutorDebugger.php

View workflow job for this annotation

GitHub Actions / lint (3.2)

Call to method value() on an unknown class RubyVM\VM\Core\Runtime\Executor\Debugger\Insn.

Check failure on line 99 in src/VM/Core/Runtime/Executor/Debugger/DefaultExecutorDebugger.php

View workflow job for this annotation

GitHub Actions / lint (3.3.0)

Call to method value() on an unknown class RubyVM\VM\Core\Runtime\Executor\Debugger\Insn.
strtolower((string) $insn->name()),

Check failure on line 100 in src/VM/Core/Runtime/Executor/Debugger/DefaultExecutorDebugger.php

View workflow job for this annotation

GitHub Actions / lint (3.2)

Call to method name() on an unknown class RubyVM\VM\Core\Runtime\Executor\Debugger\Insn.

Check failure on line 100 in src/VM/Core/Runtime/Executor/Debugger/DefaultExecutorDebugger.php

View workflow job for this annotation

GitHub Actions / lint (3.3.0)

Call to method name() on an unknown class RubyVM\VM\Core\Runtime\Executor\Debugger\Insn.
$insnDetails ? "({$insnDetails})" : '',
),
(string) $context->vmStack(),
Expand Down
4 changes: 2 additions & 2 deletions src/VM/Core/Runtime/Executor/Debugger/StepByStepDebugger.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ private function processBreakPoint(InsnInterface $insn, ContextInterface $prevCo

printf(
"Current INSN: %s(0x%02x)\n",
strtolower((string) $insn->name),
$insn->value,
strtolower($insn->name()),
$insn->value(),
);
printf(
"Previous Stacks: %s#%d\n",
Expand Down
22 changes: 11 additions & 11 deletions src/VM/Core/Runtime/Executor/Executor.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ private function _execute(ContextInterface|RubyClassInterface ...$arguments): Ex
$this->option->logger()->info(
sprintf(
'Start to process an INSN `%s` (0x%02x) (ProgramCounter: %d)',
strtolower((string) $operator->insn->name),
$operator->insn->value,
strtolower($operator->insn->name()),
$operator->insn->value(),
$this->context->programCounter()->pos(),
),
);
Expand All @@ -205,8 +205,8 @@ private function _execute(ContextInterface|RubyClassInterface ...$arguments): Ex
$this->option->logger()->info(
sprintf(
'Start to prepare an INSN `%s` (0x%02x) (ProgramCounter: %d)',
strtolower((string) $operator->insn->name),
$operator->insn->value,
strtolower($operator->insn->name()),
$operator->insn->value(),
$this->context->programCounter()->pos(),
),
);
Expand All @@ -222,8 +222,8 @@ private function _execute(ContextInterface|RubyClassInterface ...$arguments): Ex
$this->option->logger()->info(
sprintf(
'Start to process a before method an INSN `%s` (0x%02x) (ProgramCounter: %d)',
strtolower((string) $operator->insn->name),
$operator->insn->value,
strtolower($operator->insn->name()),
$operator->insn->value(),
$this->context->programCounter()->pos(),
),
);
Expand All @@ -233,8 +233,8 @@ private function _execute(ContextInterface|RubyClassInterface ...$arguments): Ex
$this->option->logger()->info(
sprintf(
'Start to process a main routine method an INSN `%s` (0x%02x) (ProgramCounter: %d)',
strtolower((string) $operator->insn->name),
$operator->insn->value,
strtolower($operator->insn->name()),
$operator->insn->value(),
$this->context->programCounter()->pos(),
),
);
Expand All @@ -252,8 +252,8 @@ private function _execute(ContextInterface|RubyClassInterface ...$arguments): Ex
$this->option->logger()->info(
sprintf(
'Start to process a post method an INSN `%s` (0x%02x) (ProgramCounter: %d)',
strtolower((string) $operator->insn->name),
$operator->insn->value,
strtolower($operator->insn->name()),
$operator->insn->value(),
$this->context->programCounter()->pos(),
),
);
Expand Down Expand Up @@ -282,7 +282,7 @@ private function _execute(ContextInterface|RubyClassInterface ...$arguments): Ex
? ExecutorFailedException::class
: ExecutorUnknownException::class;

throw new $throwClass(sprintf('The `%s` (opcode: 0x%02x) processor returns %s (%d) status code', $operator->insn->name, $operator->insn->value, $status->name, $status->value));
throw new $throwClass(sprintf('The `%s` (opcode: 0x%02x) processor returns %s (%d) status code', $operator->insn->name(), $operator->insn->value(), $status->name, $status->value));
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/VM/Core/Runtime/Executor/Insn/InsnInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
interface InsnInterface
{
public static function of(int $value): self;

public function name(): string;

public function value(): int;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function process(): ProcessedStatus

// TODO: We will implement other types
if ($type->valueOf() !== CheckMatchType::RESCUE->value) {
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor with %d type is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value, $type->valueOf()));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor with %d type is not implemented yet', strtolower($this->insn->name()), $this->insn->value(), $type->valueOf()));
}

$compareBy = $this->stackAsRubyClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function after(): void {}

public function process(): ProcessedStatus
{
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower((string) $this->insn->name), $this->insn->value));
throw new OperationProcessorException(sprintf('The `%s` (opcode: 0x%02x) processor is not implemented yet', strtolower($this->insn->name()), $this->insn->value()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ public function process(): ProcessedStatus
return ProcessedStatus::SUCCESS;
}

throw new OperationProcessorException(sprintf('The %s is not compatible type %s', strtolower((string) $this->insn->name), ClassHelper::nameBy($recv)));
throw new OperationProcessorException(sprintf('The %s is not compatible type %s', strtolower($this->insn->name()), ClassHelper::nameBy($recv)));
}
}
Loading

0 comments on commit bfe275e

Please sign in to comment.