Phasor 2.2.0
Stack VM based Programming Language
Loading...
Searching...
No Matches
Phasor::BytecodeDeserializer Class Reference

Bytecode binary format deserializer. More...

#include <BytecodeDeserializer.hpp>

Public Member Functions

Bytecode deserialize (const std::vector< uint8_t > &data)
 Deserialize bytecode from binary buffer.
Bytecode loadFromFile (const std::filesystem::path &filename)
 Load bytecode from .phsb file.

Private Member Functions

uint8_t readUInt8 ()
 Helper method to read UInt8.
uint16_t readUInt16 ()
 Helper method to read UInt16.
uint32_t readUInt32 ()
 Helper method to read UInt32.
int32_t readInt32 ()
 Helper method to read Int32.
int64_t readInt64 ()
double readDouble ()
std::string readString ()
void readHeader (uint32_t &checksum)
 Helper method to read Header.
void readConstantPool (Bytecode &bytecode)
 Helper method to read Constants Table.
void readVariableMapping (Bytecode &bytecode)
 Helper method to read Variable Table.
void readInstructions (Bytecode &bytecode)
 Helper method to read Instuctions Table.
void readFunctionEntries (Bytecode &bytecode)
 Helper method to read Function Entries.
void validateHeader (uint32_t expectedChecksum)
 Validate header.
uint32_t calculateCRC32 (const uint8_t *data, size_t size)
 Calculate CRC32 checksum.

Private Attributes

const uint8_t * _data
size_t position
size_t dataSize

Detailed Description

Bytecode binary format deserializer.

Definition at line 16 of file BytecodeDeserializer.hpp.

Member Function Documentation

◆ calculateCRC32()

uint32_t Phasor::BytecodeDeserializer::calculateCRC32 ( const uint8_t * data,
size_t size )
private

Calculate CRC32 checksum.

Definition at line 41 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deserialize()

Bytecode Phasor::BytecodeDeserializer::deserialize ( const std::vector< uint8_t > & data)

Deserialize bytecode from binary buffer.

Definition at line 252 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadFromFile()

Bytecode Phasor::BytecodeDeserializer::loadFromFile ( const std::filesystem::path & filename)

Load bytecode from .phsb file.

Definition at line 282 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readConstantPool()

void Phasor::BytecodeDeserializer::readConstantPool ( Bytecode & bytecode)
private

Helper method to read Constants Table.

Definition at line 142 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readDouble()

double Phasor::BytecodeDeserializer::readDouble ( )
private

Definition at line 98 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readFunctionEntries()

void Phasor::BytecodeDeserializer::readFunctionEntries ( Bytecode & bytecode)
private

Helper method to read Function Entries.

Definition at line 234 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readHeader()

void Phasor::BytecodeDeserializer::readHeader ( uint32_t & checksum)
private

Helper method to read Header.

Definition at line 122 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readInstructions()

void Phasor::BytecodeDeserializer::readInstructions ( Bytecode & bytecode)
private

Helper method to read Instuctions Table.

Definition at line 211 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readInt32()

int32_t Phasor::BytecodeDeserializer::readInt32 ( )
private

Helper method to read Int32.

Definition at line 83 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readInt64()

int64_t Phasor::BytecodeDeserializer::readInt64 ( )
private

Definition at line 88 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readString()

std::string Phasor::BytecodeDeserializer::readString ( )
private

Definition at line 110 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readUInt16()

uint16_t Phasor::BytecodeDeserializer::readUInt16 ( )
private

Helper method to read UInt16.

Definition at line 65 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readUInt32()

uint32_t Phasor::BytecodeDeserializer::readUInt32 ( )
private

Helper method to read UInt32.

Definition at line 73 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readUInt8()

uint8_t Phasor::BytecodeDeserializer::readUInt8 ( )
private

Helper method to read UInt8.

Definition at line 56 of file BytecodeDeserializer.cpp.

Here is the caller graph for this function:

◆ readVariableMapping()

void Phasor::BytecodeDeserializer::readVariableMapping ( Bytecode & bytecode)
private

Helper method to read Variable Table.

Definition at line 192 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ validateHeader()

void Phasor::BytecodeDeserializer::validateHeader ( uint32_t expectedChecksum)
private

Validate header.

Member Data Documentation

◆ _data

const uint8_t* Phasor::BytecodeDeserializer::_data
private

Definition at line 26 of file BytecodeDeserializer.hpp.

◆ dataSize

size_t Phasor::BytecodeDeserializer::dataSize
private

Definition at line 28 of file BytecodeDeserializer.hpp.

◆ position

size_t Phasor::BytecodeDeserializer::position
private

Definition at line 27 of file BytecodeDeserializer.hpp.


The documentation for this class was generated from the following files: