Skip to main content

IVm

Trait IVm 

Source
pub trait IVm:
    Sized
    + Clone
    + From<Unpacked<Self>>
    + 'static {
    type InternalString: IContainer<Self, Header = (), Item = u16>;
    type InternalBigInt: IContainer<Self, Header = Sign, Item = u64>;
    type InternalObject: IContainer<Self, Header = (), Item = Property<Self>>;
    type InternalArray: IContainer<Self, Header = (), Item = Any<Self>>;
    type InternalFunction: IFunction<Self>;

    // Required methods
    fn to_unpacked(self) -> Unpacked<Self>;
    fn static_function(
        code: StaticCode<Self>,
        length: u32,
        frame: Array<Self>,
        text: Option<&'static str>,
    ) -> Function<Self>;
    fn frame(self_: &Self::InternalFunction) -> &Array<Self>;
}
Expand description

A VM’s value representation.

A VM is built from an Unpacked value alone, so a number reaches it only as a Number, which holds one NaN by construction — there is no From<f64> here on purpose — so a NaN-boxing VM, which reads a negative quiet NaN as a boxed value, can store its bits as they are.

A VM is 'static: a type with no lifetime, which a function’s text names behind a 'static reference. The runtime is not the VM’s to bind: it is a value, runtime, built once by whoever runs compiled modules and handed to each as its parameter, for any VM.

Required Associated Types§

Source

type InternalString: IContainer<Self, Header = (), Item = u16>

Source

type InternalBigInt: IContainer<Self, Header = Sign, Item = u64>

Source

type InternalObject: IContainer<Self, Header = (), Item = Property<Self>>

Source

type InternalArray: IContainer<Self, Header = (), Item = Any<Self>>

Source

type InternalFunction: IFunction<Self>

Required Methods§

Source

fn to_unpacked(self) -> Unpacked<Self>

Source

fn static_function( code: StaticCode<Self>, length: u32, frame: Array<Self>, text: Option<&'static str>, ) -> Function<Self>

A function made out of a Rust static function, StaticCode, over the frame it captures: what every closure of a compiled module is, and what the runtime’s member functions answer, a closure over the receiver, which is why the capability is every VM’s and not a capability apart (IStaticFunction names it). text is the function’s text, what String(f) answers: the compiler renders it from the function’s EDAG, one &'static str per arrow in the source, shared by every function the arrow makes. None is a function with no text — a host or hand-written one, with no EDAG, or one whose body the renderer cannot spell yet — whose conversion to a string is refused.

Source

fn frame(self_: &Self::InternalFunction) -> &Array<Self>

The frame static_function was given, read by the code through its self_.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl IVm for Naive

Source§

type InternalString = Container<(), u16>

Source§

type InternalBigInt = Container<Sign, u64>

Source§

type InternalObject = Container<(), (String<Naive>, Any<Naive>)>

Source§

type InternalArray = Container<(), Any<Naive>>

Source§

type InternalFunction = Function