| Crates.io | swamp-vm-types |
| lib.rs | swamp-vm-types |
| version | 0.2.26 |
| created_at | 2025-03-18 09:59:32.584111+00 |
| updated_at | 2025-08-18 11:21:52.532262+00 |
| description | Low-level types for memory layout, addresses, and instructions used by the Swamp Virtual Machine (VM). |
| homepage | |
| repository | https://github.com/swamp/swamp |
| max_upload_size | |
| id | 1596438 |
| size | 85,613 |
Defines the fundamental low-level data types, memory representations, and layout constants required by the Swamp Virtual Machine (VM).
This crate provides the building blocks for representing memory addresses, data sizes, offsets, alignment, instruction formats, and the layout of core data structures within the VM's memory space. It is not intended for direct use by Swamp language programmers, but rather by developers working on the Swamp VM implementation itself.
These types are crucial for the correct functioning of the VM, ensuring proper memory access, data alignment, instruction decoding, and interaction between different VM components.
FrameMemoryAddress, ConstantMemoryAddress, HeapMemoryAddress, StackMemoryAddress represent pointers or locations within different VM memory regions.MemorySize, FrameMemorySize, MemoryOffset define the size of data types and relative positions in memory.MemoryAlignment enum and associated functions (align, align_frame_addr, etc.) handle memory alignment requirements for different data types.BinaryInstruction defines the packed binary layout of a single VM instruction, using opcodes defined in the opcode module.INT_SIZE, FLOAT_SIZE, PTR_SIZE, HEAP_PTR_SIZE, VEC_HEADER_SIZE, STRING_HEADER_SIZE, etc., specifying the byte size of primitive types and internal data structure headers.#[repr(C)] structs like VecHeader and StringHeader to match the expected memory layout within the VM.This crate is primarily intended as a dependency for the Swamp VM implementation itself.
[dependencies]
swamp-vm-types = "0.2.26"
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) Peter Bjorklund. All rights reserved. https://github.com/swamp/swamp