Module: WAG::Instructable

Included in:
Function, WAG::Instruction::Block, WAG::Instruction::Br, WAG::Instruction::BrIf, WAG::Instruction::BrTable, WAG::Instruction::Call, WAG::Instruction::CallIndirect, WAG::Instruction::Else, WAG::Instruction::F32::Abs, WAG::Instruction::F32::Add, WAG::Instruction::F32::Ceil, WAG::Instruction::F32::Const, WAG::Instruction::F32::ConvertI32S, WAG::Instruction::F32::ConvertI32U, WAG::Instruction::F32::ConvertI64S, WAG::Instruction::F32::ConvertI64U, WAG::Instruction::F32::Copysign, WAG::Instruction::F32::DemoteF64, WAG::Instruction::F32::Div, WAG::Instruction::F32::Eq, WAG::Instruction::F32::Floor, WAG::Instruction::F32::Ge, WAG::Instruction::F32::Gt, WAG::Instruction::F32::Le, WAG::Instruction::F32::Load, WAG::Instruction::F32::Lt, WAG::Instruction::F32::Max, WAG::Instruction::F32::Min, WAG::Instruction::F32::Mul, WAG::Instruction::F32::Ne, WAG::Instruction::F32::Nearest, WAG::Instruction::F32::Neg, WAG::Instruction::F32::ReinterpretI32, WAG::Instruction::F32::Sqrt, WAG::Instruction::F32::Store, WAG::Instruction::F32::Sub, WAG::Instruction::F32::Trunc, WAG::Instruction::F64::Abs, WAG::Instruction::F64::Add, WAG::Instruction::F64::Ceil, WAG::Instruction::F64::Const, WAG::Instruction::F64::ConvertI32S, WAG::Instruction::F64::ConvertI32U, WAG::Instruction::F64::ConvertI64S, WAG::Instruction::F64::ConvertI64U, WAG::Instruction::F64::Copysign, WAG::Instruction::F64::Div, WAG::Instruction::F64::Eq, WAG::Instruction::F64::Floor, WAG::Instruction::F64::Ge, WAG::Instruction::F64::Gt, WAG::Instruction::F64::Le, WAG::Instruction::F64::Load, WAG::Instruction::F64::Lt, WAG::Instruction::F64::Max, WAG::Instruction::F64::Min, WAG::Instruction::F64::Mul, WAG::Instruction::F64::Ne, WAG::Instruction::F64::Nearest, WAG::Instruction::F64::Neg, WAG::Instruction::F64::PromoteF32, WAG::Instruction::F64::ReinterpretI64, WAG::Instruction::F64::Sqrt, WAG::Instruction::F64::Store, WAG::Instruction::F64::Sub, WAG::Instruction::F64::Trunc, WAG::Instruction::Global::Get, WAG::Instruction::Global::Set, WAG::Instruction::I32::Add, WAG::Instruction::I32::And, WAG::Instruction::I32::Clz, WAG::Instruction::I32::Const, WAG::Instruction::I32::Ctz, WAG::Instruction::I32::DivS, WAG::Instruction::I32::DivU, WAG::Instruction::I32::Eq, WAG::Instruction::I32::Eqz, WAG::Instruction::I32::GeS, WAG::Instruction::I32::GeU, WAG::Instruction::I32::GtS, WAG::Instruction::I32::GtU, WAG::Instruction::I32::LeS, WAG::Instruction::I32::LeU, WAG::Instruction::I32::Load, WAG::Instruction::I32::Load16S, WAG::Instruction::I32::Load16U, WAG::Instruction::I32::Load8S, WAG::Instruction::I32::Load8U, WAG::Instruction::I32::LtS, WAG::Instruction::I32::LtU, WAG::Instruction::I32::Mul, WAG::Instruction::I32::Ne, WAG::Instruction::I32::Or, WAG::Instruction::I32::Popcnt, WAG::Instruction::I32::ReinterpretF32, WAG::Instruction::I32::RemS, WAG::Instruction::I32::RemU, WAG::Instruction::I32::Rotl, WAG::Instruction::I32::Rotr, WAG::Instruction::I32::Shl, WAG::Instruction::I32::ShrS, WAG::Instruction::I32::ShrU, WAG::Instruction::I32::Store, WAG::Instruction::I32::Store16, WAG::Instruction::I32::Store8, WAG::Instruction::I32::Sub, WAG::Instruction::I32::TruncF32S, WAG::Instruction::I32::TruncF32U, WAG::Instruction::I32::TruncF64S, WAG::Instruction::I32::TruncF64U, WAG::Instruction::I32::WrapI64, WAG::Instruction::I32::Xor, WAG::Instruction::I64::Add, WAG::Instruction::I64::And, WAG::Instruction::I64::Clz, WAG::Instruction::I64::Const, WAG::Instruction::I64::Ctz, WAG::Instruction::I64::DivS, WAG::Instruction::I64::DivU, WAG::Instruction::I64::Eq, WAG::Instruction::I64::Eqz, WAG::Instruction::I64::ExtendI32S, WAG::Instruction::I64::ExtendI32U, WAG::Instruction::I64::GeS, WAG::Instruction::I64::GeU, WAG::Instruction::I64::GtS, WAG::Instruction::I64::GtU, WAG::Instruction::I64::LeS, WAG::Instruction::I64::LeU, WAG::Instruction::I64::Load, WAG::Instruction::I64::Load16S, WAG::Instruction::I64::Load16U, WAG::Instruction::I64::Load32S, WAG::Instruction::I64::Load32U, WAG::Instruction::I64::Load8S, WAG::Instruction::I64::Load8U, WAG::Instruction::I64::LtS, WAG::Instruction::I64::LtU, WAG::Instruction::I64::Mul, WAG::Instruction::I64::Ne, WAG::Instruction::I64::Or, WAG::Instruction::I64::Popcnt, WAG::Instruction::I64::ReinterpretF64, WAG::Instruction::I64::RemS, WAG::Instruction::I64::RemU, WAG::Instruction::I64::Rotl, WAG::Instruction::I64::Rotr, WAG::Instruction::I64::Shl, WAG::Instruction::I64::ShrS, WAG::Instruction::I64::ShrU, WAG::Instruction::I64::Store, WAG::Instruction::I64::Store16, WAG::Instruction::I64::Store32, WAG::Instruction::I64::Store8, WAG::Instruction::I64::Sub, WAG::Instruction::I64::TruncF32S, WAG::Instruction::I64::TruncF32U, WAG::Instruction::I64::TruncF64S, WAG::Instruction::I64::TruncF64U, WAG::Instruction::I64::Xor, WAG::Instruction::If, WAG::Instruction::Local::Get, WAG::Instruction::Local::Set, WAG::Instruction::Local::Tee, WAG::Instruction::Loop, WAG::Instruction::Memory::Grow, WAG::Instruction::Memory::Size, WAG::Instruction::Return, WAG::Instruction::Select, Then
Defined in:
lib/wag/instructable.rb

Instance Method Summary collapse

Instance Method Details

#f32Object



24
25
26
# File 'lib/wag/instructable.rb', line 24

def f32
  WAG::F32Instructions.new(instructions)
end

#f64Object



28
29
30
# File 'lib/wag/instructable.rb', line 28

def f64
  WAG::F64Instructions.new(instructions)
end

#i32Object



40
41
42
# File 'lib/wag/instructable.rb', line 40

def i32
  WAG::I32Instructions.new(instructions)
end

#i64Object



44
45
46
# File 'lib/wag/instructable.rb', line 44

def i64
  WAG::I64Instructions.new(instructions)
end

#local(*args) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/wag/instructable.rb', line 32

def local(*args)
  return WAG::LocalInstructions.new(instructions) if args.empty?

  instruction = WAG::Local.new(*args)
  instructions << instruction
  instruction
end

#memoryObject



48
49
50
# File 'lib/wag/instructable.rb', line 48

def memory
  WAG::MemoryInstructions.new(instructions)
end

#to_sexprObject



52
53
54
55
56
57
# File 'lib/wag/instructable.rb', line 52

def to_sexpr
  value = super()
  return value if instructions.empty?

  Array(value).concat(instructions.map(&:to_sexpr))
end