Phasor 3.3.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< u8 > &data)
 Deserialize bytecode from binary buffer.
Bytecode loadFromFile (const std::filesystem::path &filename)
 Load bytecode from .phsb file.

Private Member Functions

u8 readUInt8 ()
 Helper method to read UInt8.
u16 readUInt16 ()
 Helper method to read UInt16.
u32 readUInt32 ()
 Helper method to read UInt32.
i32 readInt32 ()
 Helper method to read Int32.
i64 readInt64 ()
 Helper method to read Int64.
f64 readDouble ()
 Helper method to read Double.
std::string readString ()
 Helper method to read String.
Value readValue ()
 Read a single Value (recursive — handles nested structs/arrays).
void readHeader (u32 &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 Instructions Table.
void readFunctionEntries (Bytecode &bytecode)
 Helper method to read Function Entries.
void readStructSection (Bytecode &bytecode)
 Helper method to read Struct Section.

Static Private Member Functions

static u32 calculateCRC32 (const u8 *data, size_t size)
 Calculate CRC32 checksum.

Private Attributes

const u8_data
size_t position
size_t dataSize

Detailed Description

Bytecode binary format deserializer.

Definition at line 18 of file BytecodeDeserializer.hpp.

Member Function Documentation

◆ calculateCRC32()

u32 Phasor::BytecodeDeserializer::calculateCRC32 ( const u8 * data,
size_t size )
staticprivate

Calculate CRC32 checksum.

Definition at line 38 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< u8 > & data)

Deserialize bytecode from binary buffer.

Definition at line 282 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 308 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 186 of file BytecodeDeserializer.cpp.

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

◆ readDouble()

f64 Phasor::BytecodeDeserializer::readDouble ( )
private

Helper method to read Double.

Definition at line 91 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 232 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 ( u32 & checksum)
private

Helper method to read Header.

Definition at line 170 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 Instructions Table.

Definition at line 214 of file BytecodeDeserializer.cpp.

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

◆ readInt32()

i32 Phasor::BytecodeDeserializer::readInt32 ( )
private

Helper method to read Int32.

Definition at line 78 of file BytecodeDeserializer.cpp.

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

◆ readInt64()

i64 Phasor::BytecodeDeserializer::readInt64 ( )
private

Helper method to read Int64.

Definition at line 83 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

Helper method to read String.

Definition at line 101 of file BytecodeDeserializer.cpp.

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

◆ readStructSection()

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

Helper method to read Struct Section.

Read struct type definitions section (0x05).

Reconstructs bytecode.structs and bytecode.structEntries.

Definition at line 252 of file BytecodeDeserializer.cpp.

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

◆ readUInt16()

u16 Phasor::BytecodeDeserializer::readUInt16 ( )
private

Helper method to read UInt16.

Definition at line 60 of file BytecodeDeserializer.cpp.

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

◆ readUInt32()

u32 Phasor::BytecodeDeserializer::readUInt32 ( )
private

Helper method to read UInt32.

Definition at line 68 of file BytecodeDeserializer.cpp.

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

◆ readUInt8()

u8 Phasor::BytecodeDeserializer::readUInt8 ( )
private

Helper method to read UInt8.

Definition at line 53 of file BytecodeDeserializer.cpp.

Here is the caller graph for this function:

◆ readValue()

Value Phasor::BytecodeDeserializer::readValue ( )
private

Read a single Value (recursive — handles nested structs/arrays).

Definition at line 114 of file BytecodeDeserializer.cpp.

Here is the call graph for this function:
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 198 of file BytecodeDeserializer.cpp.

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

Member Data Documentation

◆ _data

const u8* Phasor::BytecodeDeserializer::_data
private

Definition at line 28 of file BytecodeDeserializer.hpp.

◆ dataSize

size_t Phasor::BytecodeDeserializer::dataSize
private

Definition at line 30 of file BytecodeDeserializer.hpp.

◆ position

size_t Phasor::BytecodeDeserializer::position
private

Definition at line 29 of file BytecodeDeserializer.hpp.


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