pub struct FunctionVal {
pub package: PackageKey,
pub meta: GosMetadata,
pub consts: Vec<GosValue>,
pub up_ptrs: Vec<ValueDesc>,
pub ret_zeros: Vec<GosValue>,
pub local_zeros: Vec<GosValue>,
pub flag: FuncFlag,
/* private fields */
}
Expand description
FunctionVal is the direct container of the Opcode.
Fields§
§package: PackageKey
§meta: GosMetadata
§consts: Vec<GosValue>
§up_ptrs: Vec<ValueDesc>
§ret_zeros: Vec<GosValue>
§local_zeros: Vec<GosValue>
§flag: FuncFlag
Implementations§
Source§impl FunctionVal
impl FunctionVal
pub fn new( package: PackageKey, meta: GosMetadata, objs: &VMObjects, gcv: &GcoVec, flag: FuncFlag, ) -> FunctionVal
pub fn code(&self) -> &Vec<Instruction>
pub fn instruction_mut(&mut self, i: usize) -> &mut Instruction
pub fn pos(&self) -> &Vec<Option<usize>>
pub fn param_count(&self) -> usize
pub fn ret_count(&self) -> usize
pub fn is_ctor(&self) -> bool
pub fn local_count(&self) -> usize
pub fn entity_index(&self, entity: &EntityKey) -> Option<&EntIndex>
pub fn const_val(&self, index: OpIndex) -> &GosValue
pub fn offset(&self, loc: usize) -> OpIndex
pub fn next_code_index(&self) -> usize
pub fn push_inst_pos(&mut self, i: Instruction, pos: Option<usize>)
pub fn emit_inst( &mut self, op: Opcode, types: [Option<ValueType>; 3], imm: Option<i32>, pos: Option<usize>, )
pub fn emit_raw_inst(&mut self, u: u64, pos: Option<usize>)
pub fn emit_code_with_type( &mut self, code: Opcode, t: ValueType, pos: Option<usize>, )
pub fn emit_code_with_type2( &mut self, code: Opcode, t0: ValueType, t1: Option<ValueType>, pos: Option<usize>, )
pub fn emit_code_with_imm( &mut self, code: Opcode, imm: OpIndex, pos: Option<usize>, )
pub fn emit_code_with_type_imm( &mut self, code: Opcode, t: ValueType, imm: OpIndex, pos: Option<usize>, )
pub fn emit_code_with_flag_imm( &mut self, code: Opcode, comma_ok: bool, imm: OpIndex, pos: Option<usize>, )
pub fn emit_code(&mut self, code: Opcode, pos: Option<usize>)
Sourcepub fn get_const_index(&self, val: &GosValue) -> Option<EntIndex>
pub fn get_const_index(&self, val: &GosValue) -> Option<EntIndex>
returns the index of the const if it’s found
pub fn add_local(&mut self, entity: Option<EntityKey>) -> EntIndex
pub fn add_local_zero(&mut self, zero: GosValue)
Sourcepub fn add_const(
&mut self,
entity: Option<EntityKey>,
cst: GosValue,
) -> EntIndex
pub fn add_const( &mut self, entity: Option<EntityKey>, cst: GosValue, ) -> EntIndex
add a const or get the index of a const. when ‘entity’ is no none, it’s a const define, so it should not be called with the same ‘entity’ more than once
pub fn try_add_upvalue(&mut self, entity: &EntityKey, uv: ValueDesc) -> EntIndex
Trait Implementations§
Source§impl Clone for FunctionVal
impl Clone for FunctionVal
Source§fn clone(&self) -> FunctionVal
fn clone(&self) -> FunctionVal
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for FunctionVal
impl !RefUnwindSafe for FunctionVal
impl !Send for FunctionVal
impl !Sync for FunctionVal
impl Unpin for FunctionVal
impl !UnwindSafe for FunctionVal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more