RainterpreterReferenceExternNPE2
Inherits: BaseRainterpreterSubParserNPE2, BaseRainterpreterExternNPE2
Functions
subParserParseMeta
Overrides the base parse meta for sub parsing. Simply returns the known constant value, which should allow the compiler to optimise the entire function call away.
function subParserParseMeta() internal pure virtual override returns (bytes memory);
subParserFunctionPointers
Overrides the base function pointers for sub parsing. Simply returns the known constant value, which should allow the compiler to optimise the entire function call away.
function subParserFunctionPointers() internal pure override returns (bytes memory);
subParserOperandHandlers
Overrides the base operand handlers for sub parsing. Simply returns the known constant value, which should allow the compiler to optimise the entire function call away.
function subParserOperandHandlers() internal pure override returns (bytes memory);
subParserLiteralParsers
Overrides the base literal parsers for sub parsing. Simply returns the known constant value, which should allow the compiler to optimise the entire function call away.
function subParserLiteralParsers() internal pure override returns (bytes memory);
subParserCompatibility
Overrides the compatibility version for sub parsing. Simply returns the known constant value, which should allow the compiler to optimise the entire function call away.
function subParserCompatibility() internal pure override returns (bytes32);
opcodeFunctionPointers
Overrides the base function pointers for opcodes. Simply returns the known constant value, which should allow the compiler to optimise the entire function call away.
function opcodeFunctionPointers() internal pure override returns (bytes memory);
integrityFunctionPointers
Overrides the base function pointers for integrity checks. Simply returns the known constant value, which should allow the compiler to optimise the entire function call away.
function integrityFunctionPointers() internal pure override returns (bytes memory);
buildSubParserLiteralParsers
The literal parsers are the same as the main parser. In the future this is likely to be changed so that sub parsers only have to define additional literal parsers that they provide, as it is redundant and fragile to have to define the same literal parsers in multiple places.
function buildSubParserLiteralParsers() external pure returns (bytes memory);
buildSubParserOperandHandlers
There's only one operand parser for this implementation, the disallowed parser. We haven't implemented any words with meaningful operands yet.
function buildSubParserOperandHandlers() external pure returns (bytes memory);
buildSubParserFunctionPointers
This mimics how LibAllStandardOpsNP
builds bytes out of function
pointers, but for sub parser functions. This is NOT intended to be
called at runtime, instead tooling (e.g. the test suite) can call this
function and compare it to subParserFunctionPointers
to ensure they
are in sync. This makes the runtime function pointer lookup much more
gas efficient by allowing it to be constant. The reason this can't be
done within the test itself is that the pointers need to be calculated
relative to the bytecode of the current contract, not the test contract.
function buildSubParserFunctionPointers() external pure returns (bytes memory);
buildOpcodeFunctionPointers
This mimics how LibAllStandardOpsNP builds function pointers for the
Rainterpreter. The same pattern applies to externs but for a different
function signature for each opcode. Call this function somehow, e.g. from
within a test, and then copy the output into the
OPCODE_FUNCTION_POINTERS
if there is a mismatch. This makes the
function pointer lookup much more gas efficient. The reason this can't be
done within the test itself is that the pointers need to be calculated
relative to the bytecode of the current contract, not the test contract.
function buildOpcodeFunctionPointers() external pure returns (bytes memory);
buildIntegrityFunctionPointers
This applies the same pattern to integrity function pointers as the
opcode and parser function pointers on this same contract. Call this
function somehow, e.g. from within a test, and then check there is no
mismatch with the INTEGRITY_FUNCTION_POINTERS
constant. This makes the
function pointer lookup at runtime much more gas efficient by allowing
it to be constant. The reason this can't be done within the test itself
is that the pointers need to be calculated relative to the bytecode of
the current contract, not the test contract.
function buildIntegrityFunctionPointers() external pure returns (bytes memory);
supportsInterface
This is only needed because the parser and extern base contracts both implement IERC165, and the compiler needs to be told how to resolve the ambiguity.
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(BaseRainterpreterSubParserNPE2, BaseRainterpreterExternNPE2)
returns (bool);