A relatively complicated program compiles and validates.
This commit is contained in:
parent
cceb24e475
commit
aafde4b7a4
201 changed files with 916 additions and 61 deletions
|
@ -1,6 +1,7 @@
|
|||
image: ruby:latest
|
||||
|
||||
before_script:
|
||||
- apt-get update && apt-get install wabt && rm -rf /var/cache/apt
|
||||
- bundle install
|
||||
|
||||
test:
|
||||
|
|
|
@ -6,7 +6,7 @@ module WAG
|
|||
class Error < StandardError; end
|
||||
# Your code goes here...
|
||||
|
||||
require 'wag/wat'
|
||||
require 'wag/encodable'
|
||||
require 'wag/inflector'
|
||||
require 'wag/instructable'
|
||||
|
||||
|
@ -26,11 +26,17 @@ module WAG
|
|||
require 'wag/instruction'
|
||||
require 'wag/label'
|
||||
require 'wag/local_instructions'
|
||||
require 'wag/local'
|
||||
require 'wag/memory_instructions'
|
||||
require 'wag/memory'
|
||||
require 'wag/module'
|
||||
require 'wag/param'
|
||||
require 'wag/result'
|
||||
require 'wag/table'
|
||||
require 'wag/then'
|
||||
require 'wag/type'
|
||||
|
||||
require 'wag/wabt'
|
||||
require 'wag/wasm'
|
||||
require 'wag/wat'
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module WAG
|
||||
class Data
|
||||
include WAG::WAT
|
||||
include WAG::Encodable
|
||||
|
||||
attr_reader :offset, :value
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module WAG
|
||||
class Element
|
||||
include WAG::WAT
|
||||
include WAG::Encodable
|
||||
|
||||
attr_reader :table_id, :labels
|
||||
|
||||
|
|
23
lib/wag/encodable.rb
Normal file
23
lib/wag/encodable.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module WAG
|
||||
# A simple mixin which formats s-expressions as WAT.
|
||||
module Encodable
|
||||
def to_wat
|
||||
WAG::WAT.new(wat_encode(to_sexpr))
|
||||
end
|
||||
|
||||
def to_wasm
|
||||
to_wat.to_wasm
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def wat_encode(data)
|
||||
return "(#{data.map { |e| wat_encode(e) }.join(' ')})" if data.is_a?(Enumerable)
|
||||
return data.inspect if data.is_a?(String)
|
||||
|
||||
data.to_s
|
||||
end
|
||||
end
|
||||
end
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module WAG
|
||||
class Export
|
||||
include WAG::WAT
|
||||
include WAG::Encodable
|
||||
|
||||
attr_reader :name, :desc
|
||||
|
||||
|
@ -26,7 +26,7 @@ module WAG
|
|||
@desc
|
||||
end
|
||||
|
||||
def table(number, type = :funcref, &block)
|
||||
def table(number, type = :anyfunc, &block)
|
||||
@desc = Table.new(number, type)
|
||||
@desc.instance_exec(&block) if block
|
||||
@desc
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module WAG
|
||||
class Function
|
||||
include WAG::WAT
|
||||
include WAG::Encodable
|
||||
prepend WAG::Instructable
|
||||
|
||||
attr_reader :label, :params
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module WAG
|
||||
class Global
|
||||
include WAG::WAT
|
||||
include WAG::Encodable
|
||||
|
||||
attr_reader :label, :type
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module WAG
|
||||
class Import
|
||||
include WAG::WAT
|
||||
include WAG::Encodable
|
||||
|
||||
attr_reader :module_name, :name, :desc
|
||||
|
||||
|
@ -29,7 +29,7 @@ module WAG
|
|||
@desc
|
||||
end
|
||||
|
||||
def table(number, type = :funcref, &block)
|
||||
def table(number, type = :anyfunc, &block)
|
||||
@desc = Table.new(number, type)
|
||||
@desc.instance_exec(&block) if block
|
||||
@desc
|
||||
|
|
|
@ -14,6 +14,12 @@ module WAG
|
|||
end
|
||||
end
|
||||
|
||||
# Alias Ruby keywords because reasons.
|
||||
alias if_ if
|
||||
alias else_ else
|
||||
alias end_ end
|
||||
alias loop_ loop
|
||||
|
||||
def f32
|
||||
WAG::F32Instructions.new(instructions)
|
||||
end
|
||||
|
@ -22,8 +28,12 @@ module WAG
|
|||
WAG::F64Instructions.new(instructions)
|
||||
end
|
||||
|
||||
def local
|
||||
WAG::LocalInstructions.new(instructions)
|
||||
def local(*args)
|
||||
return WAG::LocalInstructions.new(instructions) if args.empty?
|
||||
|
||||
instruction = WAG::Local.new(*args)
|
||||
instructions << instruction
|
||||
instruction
|
||||
end
|
||||
|
||||
def i32
|
||||
|
@ -39,7 +49,10 @@ module WAG
|
|||
end
|
||||
|
||||
def to_sexpr
|
||||
super().concat(instructions.map(&:to_sexpr))
|
||||
value = super()
|
||||
return value if instructions.empty?
|
||||
|
||||
Array(value).concat(instructions.map(&:to_sexpr))
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
module WAG
|
||||
module Instruction
|
||||
class Base
|
||||
include WAG::WAT
|
||||
prepend WAG::Instructable
|
||||
include WAG::Encodable
|
||||
|
||||
def self.instruction(op_code)
|
||||
klass = Class.new(self)
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
module WAG
|
||||
module Instruction
|
||||
class Block < Base.instruction(0x02)
|
||||
prepend WAG::Instructable
|
||||
|
||||
def result(*types)
|
||||
return @result if types.empty?
|
||||
|
||||
|
@ -10,9 +12,9 @@ module WAG
|
|||
end
|
||||
|
||||
def to_sexpr
|
||||
[:block].tap do |expr|
|
||||
expr << @result.to_sexpr if @result
|
||||
end
|
||||
return [name, @result.to_sexpr] if @result
|
||||
|
||||
[name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
module WAG
|
||||
module Instruction
|
||||
class Br < Base.instruction(0x0c)
|
||||
prepend WAG::Instructable
|
||||
attr_reader :label
|
||||
|
||||
def initialize(label)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
module WAG
|
||||
module Instruction
|
||||
class BrIf < Base.instruction(0x0d)
|
||||
prepend WAG::Instructable
|
||||
attr_reader :label
|
||||
|
||||
def initialize(label)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
module WAG
|
||||
module Instruction
|
||||
class BrTable < Base.instruction(0x0e)
|
||||
prepend WAG::Instructable
|
||||
attr_reader :label
|
||||
|
||||
def initialize(*labels)
|
||||
|
|
|
@ -3,6 +3,16 @@
|
|||
module WAG
|
||||
module Instruction
|
||||
class Call < Base.instruction(0x10)
|
||||
prepend WAG::Instructable
|
||||
attr_reader :label
|
||||
|
||||
def initialize(label)
|
||||
@label = WAG::Label.from(label)
|
||||
end
|
||||
|
||||
def to_sexpr
|
||||
[:call, label.to_sexpr]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,6 +3,16 @@
|
|||
module WAG
|
||||
module Instruction
|
||||
class CallIndirect < Base.instruction(0x11)
|
||||
prepend WAG::Instructable
|
||||
def result(*types)
|
||||
@result = WAG::Result.new(*types)
|
||||
end
|
||||
|
||||
def to_sexpr
|
||||
return [name, @result.to_sexpr] if @result
|
||||
|
||||
super()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
module WAG
|
||||
module Instruction
|
||||
class Else < Base.instruction(0x05)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Abs < Base.instruction(0x8b)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Add < Base.instruction(0x92)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Ceil < Base.instruction(0x8d)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Const < Base.instruction(0x43)
|
||||
prepend WAG::Instructable
|
||||
attr_reader :literal
|
||||
|
||||
def initialize(literal)
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class ConvertI32S < Base.instruction(0xb2)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class ConvertI32U < Base.instruction(0xb3)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class ConvertI64S < Base.instruction(0xb4)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class ConvertI64U < Base.instruction(0xb5)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Copysign < Base.instruction(0x98)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class DemoteF64 < Base.instruction(0xb6)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Div < Base.instruction(0x95)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Eq < Base.instruction(0x5b)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Floor < Base.instruction(0x8e)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Ge < Base.instruction(0x60)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Gt < Base.instruction(0x5e)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Le < Base.instruction(0x5f)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Load < Base.instruction(0x2a)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Lt < Base.instruction(0x5d)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Max < Base.instruction(0x97)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Min < Base.instruction(0x96)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Mul < Base.instruction(0x94)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Ne < Base.instruction(0x5c)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Nearest < Base.instruction(0x90)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Neg < Base.instruction(0x8c)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class ReinterpretI32 < Base.instruction(0xbe)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Sqrt < Base.instruction(0x91)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Store < Base.instruction(0x38)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Sub < Base.instruction(0x93)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F32
|
||||
class Trunc < Base.instruction(0x8f)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Abs < Base.instruction(0x99)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Add < Base.instruction(0xa0)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Ceil < Base.instruction(0x9b)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Const < Base.instruction(0x44)
|
||||
prepend WAG::Instructable
|
||||
attr_reader :literal
|
||||
|
||||
def initialize(literal)
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class ConvertI32S < Base.instruction(0xb7)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class ConvertI32U < Base.instruction(0xb8)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class ConvertI64S < Base.instruction(0xb9)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class ConvertI64U < Base.instruction(0xba)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Copysign < Base.instruction(0xa6)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Div < Base.instruction(0xa3)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Eq < Base.instruction(0x61)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Floor < Base.instruction(0x9c)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Ge < Base.instruction(0x66)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Gt < Base.instruction(0x64)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Le < Base.instruction(0x65)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Load < Base.instruction(0x2b)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Lt < Base.instruction(0x63)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Max < Base.instruction(0xa5)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Min < Base.instruction(0xa4)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Mul < Base.instruction(0xa2)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Ne < Base.instruction(0x62)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Nearest < Base.instruction(0x9e)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Neg < Base.instruction(0x9a)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class PromoteF32 < Base.instruction(0xbb)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class ReinterpretI64 < Base.instruction(0xbf)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Sqrt < Base.instruction(0x9f)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Store < Base.instruction(0x39)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Sub < Base.instruction(0xa1)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module F64
|
||||
class Trunc < Base.instruction(0x9d)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module Global
|
||||
class Get < Base.instruction(0x23)
|
||||
prepend WAG::Instructable
|
||||
attr_reader :label
|
||||
|
||||
def initialize(label)
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module Global
|
||||
class Set < Base.instruction(0x24)
|
||||
prepend WAG::Instructable
|
||||
attr_reader :label
|
||||
|
||||
def initialize(label)
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class Add < Base.instruction(0x6a)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class And < Base.instruction(0x71)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class Clz < Base.instruction(0x67)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class Const < Base.instruction(0x41)
|
||||
prepend WAG::Instructable
|
||||
attr_reader :literal
|
||||
|
||||
def initialize(literal)
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class Ctz < Base.instruction(0x68)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class DivS < Base.instruction(0x6d)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class DivU < Base.instruction(0x6e)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class Eq < Base.instruction(0x46)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class Eqz < Base.instruction(0x45)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class GeS < Base.instruction(0x4e)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class GeU < Base.instruction(0x4f)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class GtS < Base.instruction(0x4a)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class GtU < Base.instruction(0x4b)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class LeS < Base.instruction(0x4c)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class LeU < Base.instruction(0x4d)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class Load < Base.instruction(0x28)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class Load16S < Base.instruction(0x2e)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class Load16U < Base.instruction(0x2f)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class Load8S < Base.instruction(0x2c)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class Load8U < Base.instruction(0x2d)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class LtS < Base.instruction(0x48)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
|||
module Instruction
|
||||
module I32
|
||||
class LtU < Base.instruction(0x49)
|
||||
prepend WAG::Instructable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue