Documentation ¶
Overview ¶
Package asm contains high-level instructions to control the replay virtual machine.
Index ¶
- type Add
- type Call
- type Clone
- type Copy
- type InlineResource
- type InlineResourcePointerPatchUp
- type InlineResourceValuePatchUp
- type Instruction
- type JumpLabel
- type JumpNZ
- type JumpZ
- type Label
- type Load
- type Nop
- type Notification
- type Pop
- type Post
- type Push
- type Resource
- type Store
- type Strcpy
- type SwitchThread
- type Wait
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Add ¶
type Add struct {
Count uint32
}
Add is an Instruction that pops and sums the top N stack values, pushing the result to the top of the stack. Each summed value must have the same type.
type Call ¶
type Call struct { PushReturn bool // If true, the return value is pushed to the VM stack. ApiIndex uint8 // The index of the API this call belongs to FunctionID uint16 // The function id registered with the VM to invoke. }
Call is an Instruction to call a VM registered function. This instruction will pop the parameters from the VM stack starting with the first parameter. If PushReturn is true, then the return value of the function call will be pushed to the top of the VM stack.
type Clone ¶
type Clone struct {
Index int
}
Clone is an Instruction that makes a copy of the the n-th element from the top of the VM stack and pushes the copy to the top of the VM stack.
type Copy ¶
type Copy struct {
Count uint64 // Number of bytes to copy.
}
Copy is an Instruction that pops the target address and then the source address from the top of the VM stack, and then copies Count bytes from source to target.
type InlineResource ¶
type InlineResource struct { Data []byte Destination value.Pointer ValuePatchUps []InlineResourceValuePatchUp PointerPatchUps []InlineResourcePointerPatchUp Ctx context.Context }
func (InlineResource) Encode ¶
func (a InlineResource) Encode(r value.PointerResolver, w binary.Writer) error
type Instruction ¶
type Instruction interface {
Encode(r value.PointerResolver, w binary.Writer) error
}
Instruction is the interface of all instruction types.
Encode writes the instruction's opcodes to the binary writer w, translating all pointers to their final, resolved addresses using the PointerResolver r. An instruction can produce zero, one or many opcodes.
type Label ¶
type Label struct {
Value uint32
}
Label is an Instruction that holds a marker value, used for debugging.
type Load ¶
Load is an Instruction that loads the value of type DataType from pointer Source and pushes the loaded value to the top of the VM stack.
type Nop ¶
type Nop struct{}
Nop is a no-operation Instruction. Instructions of this type do nothing.
type Notification ¶
Notification is an Instruction that sends Size bytes from Source to the server, with the ID returned as well.
func (Notification) Encode ¶
func (a Notification) Encode(r value.PointerResolver, w binary.Writer) error
type Pop ¶
type Pop struct {
Count uint32 // Number of values to discard from the top of the VM stack.
}
Pop is an Instruction that discards Count values from the top of the VM stack.
type Resource ¶
Resource is an Instruction that loads the resource with index Index of Size bytes and writes the resource to Destination.
type Store ¶
Store is an Instruction that pops the value from the top of the VM stack and writes the value to Destination.
type Strcpy ¶
type Strcpy struct {
MaxCount uint64
}
Strcpy is an Instruction that pops the target address then the source address from the top of the VM stack, and then copies at most MaxCount-1 bytes from source to target. If the MaxCount is greater than the source string length, then the target will be padded with 0s. The destination buffer will always be 0-terminated.
type SwitchThread ¶
type SwitchThread struct {
Index uint32
}
SwitchThread is an Instruction that changes execution to a different thread.
func (SwitchThread) Encode ¶
func (a SwitchThread) Encode(r value.PointerResolver, w binary.Writer) error