![]() |
Phasor 2.2.0
Stack VM based Programming Language
|
Bytecode binary format serializer. More...
#include <BytecodeSerializer.hpp>
Public Member Functions | |
| std::vector< uint8_t > | serialize (const Bytecode &bytecode) |
| Serialize bytecode to binary buffer. | |
| bool | saveToFile (const Bytecode &bytecode, const std::filesystem::path &filename) |
| Save bytecode to .phsb file. | |
Private Member Functions | |
| void | writeUInt8 (uint8_t value) |
| Helper method to write UInt8. | |
| void | writeUInt16 (uint16_t value) |
| Helper method to write UInt16. | |
| void | writeUInt32 (uint32_t value) |
| Helper method to write UInt32. | |
| void | writeInt32 (int32_t value) |
| Helper method to write Int32. | |
| void | writeInt64 (int64_t value) |
| Helper method to write Int64. | |
| void | writeDouble (double value) |
| Helper method to write Double. | |
| void | writeString (const std::string &str) |
| Helper method to write String. | |
| void | writeHeader (uint32_t dataChecksum) |
| Section writers. | |
| void | writeConstantPool (const std::vector< Value > &constants) |
| Helper method to write Constants Table. | |
| void | writeVariableMapping (const std::map< std::string, int > &variables, int nextVarIndex) |
| Helper method to write Variable Map Table. | |
| void | writeInstructions (const std::vector< Instruction > &instructions) |
| Helper method to write Instruction Table. | |
| void | writeFunctionEntries (const std::map< std::string, int > &functionEntries) |
| Helper method to write Function Table. | |
| uint32_t | calculateCRC32 (const std::vector< uint8_t > &data) |
| Calculate CRC32 checksum. | |
Private Attributes | |
| std::vector< uint8_t > | buffer |
Bytecode binary format serializer.
Definition at line 16 of file BytecodeSerializer.hpp.
|
private |
Calculate CRC32 checksum.
Definition at line 53 of file BytecodeSerializer.cpp.
| bool Phasor::BytecodeSerializer::saveToFile | ( | const Bytecode & | bytecode, |
| const std::filesystem::path & | filename ) |
Save bytecode to .phsb file.
Definition at line 243 of file BytecodeSerializer.cpp.
| std::vector< uint8_t > Phasor::BytecodeSerializer::serialize | ( | const Bytecode & | bytecode | ) |
Serialize bytecode to binary buffer.
Definition at line 212 of file BytecodeSerializer.cpp.
|
private |
Helper method to write Constants Table.
Definition at line 127 of file BytecodeSerializer.cpp.
|
private |
Helper method to write Double.
Definition at line 100 of file BytecodeSerializer.cpp.
|
private |
Helper method to write Function Table.
Definition at line 200 of file BytecodeSerializer.cpp.
|
private |
Section writers.
Helper method to write header
Definition at line 119 of file BytecodeSerializer.cpp.
|
private |
Helper method to write Instruction Table.
Definition at line 184 of file BytecodeSerializer.cpp.
|
private |
Helper method to write Int32.
Definition at line 87 of file BytecodeSerializer.cpp.
|
private |
Helper method to write Int64.
Definition at line 92 of file BytecodeSerializer.cpp.
|
private |
Helper method to write String.
Definition at line 110 of file BytecodeSerializer.cpp.
|
private |
Helper method to write UInt16.
Definition at line 73 of file BytecodeSerializer.cpp.
|
private |
Helper method to write UInt32.
Definition at line 79 of file BytecodeSerializer.cpp.
|
private |
Helper method to write UInt8.
Definition at line 68 of file BytecodeSerializer.cpp.
|
private |
Helper method to write Variable Map Table.
Definition at line 171 of file BytecodeSerializer.cpp.
|
private |
Definition at line 26 of file BytecodeSerializer.hpp.