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
|
image: ruby:latest
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
|
- apt-get update && apt-get install wabt && rm -rf /var/cache/apt
|
||||||
- bundle install
|
- bundle install
|
||||||
|
|
||||||
test:
|
test:
|
||||||
|
|
|
@ -6,7 +6,7 @@ module WAG
|
||||||
class Error < StandardError; end
|
class Error < StandardError; end
|
||||||
# Your code goes here...
|
# Your code goes here...
|
||||||
|
|
||||||
require 'wag/wat'
|
require 'wag/encodable'
|
||||||
require 'wag/inflector'
|
require 'wag/inflector'
|
||||||
require 'wag/instructable'
|
require 'wag/instructable'
|
||||||
|
|
||||||
|
@ -26,11 +26,17 @@ module WAG
|
||||||
require 'wag/instruction'
|
require 'wag/instruction'
|
||||||
require 'wag/label'
|
require 'wag/label'
|
||||||
require 'wag/local_instructions'
|
require 'wag/local_instructions'
|
||||||
|
require 'wag/local'
|
||||||
require 'wag/memory_instructions'
|
require 'wag/memory_instructions'
|
||||||
require 'wag/memory'
|
require 'wag/memory'
|
||||||
require 'wag/module'
|
require 'wag/module'
|
||||||
require 'wag/param'
|
require 'wag/param'
|
||||||
require 'wag/result'
|
require 'wag/result'
|
||||||
require 'wag/table'
|
require 'wag/table'
|
||||||
|
require 'wag/then'
|
||||||
require 'wag/type'
|
require 'wag/type'
|
||||||
|
|
||||||
|
require 'wag/wabt'
|
||||||
|
require 'wag/wasm'
|
||||||
|
require 'wag/wat'
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module WAG
|
module WAG
|
||||||
class Data
|
class Data
|
||||||
include WAG::WAT
|
include WAG::Encodable
|
||||||
|
|
||||||
attr_reader :offset, :value
|
attr_reader :offset, :value
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module WAG
|
module WAG
|
||||||
class Element
|
class Element
|
||||||
include WAG::WAT
|
include WAG::Encodable
|
||||||
|
|
||||||
attr_reader :table_id, :labels
|
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
|
module WAG
|
||||||
class Export
|
class Export
|
||||||
include WAG::WAT
|
include WAG::Encodable
|
||||||
|
|
||||||
attr_reader :name, :desc
|
attr_reader :name, :desc
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ module WAG
|
||||||
@desc
|
@desc
|
||||||
end
|
end
|
||||||
|
|
||||||
def table(number, type = :funcref, &block)
|
def table(number, type = :anyfunc, &block)
|
||||||
@desc = Table.new(number, type)
|
@desc = Table.new(number, type)
|
||||||
@desc.instance_exec(&block) if block
|
@desc.instance_exec(&block) if block
|
||||||
@desc
|
@desc
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module WAG
|
module WAG
|
||||||
class Function
|
class Function
|
||||||
include WAG::WAT
|
include WAG::Encodable
|
||||||
prepend WAG::Instructable
|
prepend WAG::Instructable
|
||||||
|
|
||||||
attr_reader :label, :params
|
attr_reader :label, :params
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module WAG
|
module WAG
|
||||||
class Global
|
class Global
|
||||||
include WAG::WAT
|
include WAG::Encodable
|
||||||
|
|
||||||
attr_reader :label, :type
|
attr_reader :label, :type
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module WAG
|
module WAG
|
||||||
class Import
|
class Import
|
||||||
include WAG::WAT
|
include WAG::Encodable
|
||||||
|
|
||||||
attr_reader :module_name, :name, :desc
|
attr_reader :module_name, :name, :desc
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ module WAG
|
||||||
@desc
|
@desc
|
||||||
end
|
end
|
||||||
|
|
||||||
def table(number, type = :funcref, &block)
|
def table(number, type = :anyfunc, &block)
|
||||||
@desc = Table.new(number, type)
|
@desc = Table.new(number, type)
|
||||||
@desc.instance_exec(&block) if block
|
@desc.instance_exec(&block) if block
|
||||||
@desc
|
@desc
|
||||||
|
|
|
@ -14,6 +14,12 @@ module WAG
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Alias Ruby keywords because reasons.
|
||||||
|
alias if_ if
|
||||||
|
alias else_ else
|
||||||
|
alias end_ end
|
||||||
|
alias loop_ loop
|
||||||
|
|
||||||
def f32
|
def f32
|
||||||
WAG::F32Instructions.new(instructions)
|
WAG::F32Instructions.new(instructions)
|
||||||
end
|
end
|
||||||
|
@ -22,8 +28,12 @@ module WAG
|
||||||
WAG::F64Instructions.new(instructions)
|
WAG::F64Instructions.new(instructions)
|
||||||
end
|
end
|
||||||
|
|
||||||
def local
|
def local(*args)
|
||||||
WAG::LocalInstructions.new(instructions)
|
return WAG::LocalInstructions.new(instructions) if args.empty?
|
||||||
|
|
||||||
|
instruction = WAG::Local.new(*args)
|
||||||
|
instructions << instruction
|
||||||
|
instruction
|
||||||
end
|
end
|
||||||
|
|
||||||
def i32
|
def i32
|
||||||
|
@ -39,7 +49,10 @@ module WAG
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_sexpr
|
def to_sexpr
|
||||||
super().concat(instructions.map(&:to_sexpr))
|
value = super()
|
||||||
|
return value if instructions.empty?
|
||||||
|
|
||||||
|
Array(value).concat(instructions.map(&:to_sexpr))
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
module WAG
|
module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
class Base
|
class Base
|
||||||
include WAG::WAT
|
include WAG::Encodable
|
||||||
prepend WAG::Instructable
|
|
||||||
|
|
||||||
def self.instruction(op_code)
|
def self.instruction(op_code)
|
||||||
klass = Class.new(self)
|
klass = Class.new(self)
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
module WAG
|
module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
class Block < Base.instruction(0x02)
|
class Block < Base.instruction(0x02)
|
||||||
|
prepend WAG::Instructable
|
||||||
|
|
||||||
def result(*types)
|
def result(*types)
|
||||||
return @result if types.empty?
|
return @result if types.empty?
|
||||||
|
|
||||||
|
@ -10,9 +12,9 @@ module WAG
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_sexpr
|
def to_sexpr
|
||||||
[:block].tap do |expr|
|
return [name, @result.to_sexpr] if @result
|
||||||
expr << @result.to_sexpr if @result
|
|
||||||
end
|
[name]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
module WAG
|
module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
class Br < Base.instruction(0x0c)
|
class Br < Base.instruction(0x0c)
|
||||||
|
prepend WAG::Instructable
|
||||||
attr_reader :label
|
attr_reader :label
|
||||||
|
|
||||||
def initialize(label)
|
def initialize(label)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
module WAG
|
module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
class BrIf < Base.instruction(0x0d)
|
class BrIf < Base.instruction(0x0d)
|
||||||
|
prepend WAG::Instructable
|
||||||
attr_reader :label
|
attr_reader :label
|
||||||
|
|
||||||
def initialize(label)
|
def initialize(label)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
module WAG
|
module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
class BrTable < Base.instruction(0x0e)
|
class BrTable < Base.instruction(0x0e)
|
||||||
|
prepend WAG::Instructable
|
||||||
attr_reader :label
|
attr_reader :label
|
||||||
|
|
||||||
def initialize(*labels)
|
def initialize(*labels)
|
||||||
|
|
|
@ -3,6 +3,16 @@
|
||||||
module WAG
|
module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
class Call < Base.instruction(0x10)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,16 @@
|
||||||
module WAG
|
module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
class CallIndirect < Base.instruction(0x11)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
module WAG
|
module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
class Else < Base.instruction(0x05)
|
class Else < Base.instruction(0x05)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Abs < Base.instruction(0x8b)
|
class Abs < Base.instruction(0x8b)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Add < Base.instruction(0x92)
|
class Add < Base.instruction(0x92)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Ceil < Base.instruction(0x8d)
|
class Ceil < Base.instruction(0x8d)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Const < Base.instruction(0x43)
|
class Const < Base.instruction(0x43)
|
||||||
|
prepend WAG::Instructable
|
||||||
attr_reader :literal
|
attr_reader :literal
|
||||||
|
|
||||||
def initialize(literal)
|
def initialize(literal)
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class ConvertI32S < Base.instruction(0xb2)
|
class ConvertI32S < Base.instruction(0xb2)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class ConvertI32U < Base.instruction(0xb3)
|
class ConvertI32U < Base.instruction(0xb3)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class ConvertI64S < Base.instruction(0xb4)
|
class ConvertI64S < Base.instruction(0xb4)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class ConvertI64U < Base.instruction(0xb5)
|
class ConvertI64U < Base.instruction(0xb5)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Copysign < Base.instruction(0x98)
|
class Copysign < Base.instruction(0x98)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class DemoteF64 < Base.instruction(0xb6)
|
class DemoteF64 < Base.instruction(0xb6)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Div < Base.instruction(0x95)
|
class Div < Base.instruction(0x95)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Eq < Base.instruction(0x5b)
|
class Eq < Base.instruction(0x5b)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Floor < Base.instruction(0x8e)
|
class Floor < Base.instruction(0x8e)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Ge < Base.instruction(0x60)
|
class Ge < Base.instruction(0x60)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Gt < Base.instruction(0x5e)
|
class Gt < Base.instruction(0x5e)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Le < Base.instruction(0x5f)
|
class Le < Base.instruction(0x5f)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Load < Base.instruction(0x2a)
|
class Load < Base.instruction(0x2a)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Lt < Base.instruction(0x5d)
|
class Lt < Base.instruction(0x5d)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Max < Base.instruction(0x97)
|
class Max < Base.instruction(0x97)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Min < Base.instruction(0x96)
|
class Min < Base.instruction(0x96)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Mul < Base.instruction(0x94)
|
class Mul < Base.instruction(0x94)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Ne < Base.instruction(0x5c)
|
class Ne < Base.instruction(0x5c)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Nearest < Base.instruction(0x90)
|
class Nearest < Base.instruction(0x90)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Neg < Base.instruction(0x8c)
|
class Neg < Base.instruction(0x8c)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class ReinterpretI32 < Base.instruction(0xbe)
|
class ReinterpretI32 < Base.instruction(0xbe)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Sqrt < Base.instruction(0x91)
|
class Sqrt < Base.instruction(0x91)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Store < Base.instruction(0x38)
|
class Store < Base.instruction(0x38)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Sub < Base.instruction(0x93)
|
class Sub < Base.instruction(0x93)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F32
|
module F32
|
||||||
class Trunc < Base.instruction(0x8f)
|
class Trunc < Base.instruction(0x8f)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Abs < Base.instruction(0x99)
|
class Abs < Base.instruction(0x99)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Add < Base.instruction(0xa0)
|
class Add < Base.instruction(0xa0)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Ceil < Base.instruction(0x9b)
|
class Ceil < Base.instruction(0x9b)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Const < Base.instruction(0x44)
|
class Const < Base.instruction(0x44)
|
||||||
|
prepend WAG::Instructable
|
||||||
attr_reader :literal
|
attr_reader :literal
|
||||||
|
|
||||||
def initialize(literal)
|
def initialize(literal)
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class ConvertI32S < Base.instruction(0xb7)
|
class ConvertI32S < Base.instruction(0xb7)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class ConvertI32U < Base.instruction(0xb8)
|
class ConvertI32U < Base.instruction(0xb8)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class ConvertI64S < Base.instruction(0xb9)
|
class ConvertI64S < Base.instruction(0xb9)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class ConvertI64U < Base.instruction(0xba)
|
class ConvertI64U < Base.instruction(0xba)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Copysign < Base.instruction(0xa6)
|
class Copysign < Base.instruction(0xa6)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Div < Base.instruction(0xa3)
|
class Div < Base.instruction(0xa3)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Eq < Base.instruction(0x61)
|
class Eq < Base.instruction(0x61)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Floor < Base.instruction(0x9c)
|
class Floor < Base.instruction(0x9c)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Ge < Base.instruction(0x66)
|
class Ge < Base.instruction(0x66)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Gt < Base.instruction(0x64)
|
class Gt < Base.instruction(0x64)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Le < Base.instruction(0x65)
|
class Le < Base.instruction(0x65)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Load < Base.instruction(0x2b)
|
class Load < Base.instruction(0x2b)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Lt < Base.instruction(0x63)
|
class Lt < Base.instruction(0x63)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Max < Base.instruction(0xa5)
|
class Max < Base.instruction(0xa5)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Min < Base.instruction(0xa4)
|
class Min < Base.instruction(0xa4)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Mul < Base.instruction(0xa2)
|
class Mul < Base.instruction(0xa2)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Ne < Base.instruction(0x62)
|
class Ne < Base.instruction(0x62)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Nearest < Base.instruction(0x9e)
|
class Nearest < Base.instruction(0x9e)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Neg < Base.instruction(0x9a)
|
class Neg < Base.instruction(0x9a)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class PromoteF32 < Base.instruction(0xbb)
|
class PromoteF32 < Base.instruction(0xbb)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class ReinterpretI64 < Base.instruction(0xbf)
|
class ReinterpretI64 < Base.instruction(0xbf)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Sqrt < Base.instruction(0x9f)
|
class Sqrt < Base.instruction(0x9f)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Store < Base.instruction(0x39)
|
class Store < Base.instruction(0x39)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Sub < Base.instruction(0xa1)
|
class Sub < Base.instruction(0xa1)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module F64
|
module F64
|
||||||
class Trunc < Base.instruction(0x9d)
|
class Trunc < Base.instruction(0x9d)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module Global
|
module Global
|
||||||
class Get < Base.instruction(0x23)
|
class Get < Base.instruction(0x23)
|
||||||
|
prepend WAG::Instructable
|
||||||
attr_reader :label
|
attr_reader :label
|
||||||
|
|
||||||
def initialize(label)
|
def initialize(label)
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module Global
|
module Global
|
||||||
class Set < Base.instruction(0x24)
|
class Set < Base.instruction(0x24)
|
||||||
|
prepend WAG::Instructable
|
||||||
attr_reader :label
|
attr_reader :label
|
||||||
|
|
||||||
def initialize(label)
|
def initialize(label)
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class Add < Base.instruction(0x6a)
|
class Add < Base.instruction(0x6a)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class And < Base.instruction(0x71)
|
class And < Base.instruction(0x71)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class Clz < Base.instruction(0x67)
|
class Clz < Base.instruction(0x67)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class Const < Base.instruction(0x41)
|
class Const < Base.instruction(0x41)
|
||||||
|
prepend WAG::Instructable
|
||||||
attr_reader :literal
|
attr_reader :literal
|
||||||
|
|
||||||
def initialize(literal)
|
def initialize(literal)
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class Ctz < Base.instruction(0x68)
|
class Ctz < Base.instruction(0x68)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class DivS < Base.instruction(0x6d)
|
class DivS < Base.instruction(0x6d)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class DivU < Base.instruction(0x6e)
|
class DivU < Base.instruction(0x6e)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class Eq < Base.instruction(0x46)
|
class Eq < Base.instruction(0x46)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class Eqz < Base.instruction(0x45)
|
class Eqz < Base.instruction(0x45)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class GeS < Base.instruction(0x4e)
|
class GeS < Base.instruction(0x4e)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class GeU < Base.instruction(0x4f)
|
class GeU < Base.instruction(0x4f)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class GtS < Base.instruction(0x4a)
|
class GtS < Base.instruction(0x4a)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class GtU < Base.instruction(0x4b)
|
class GtU < Base.instruction(0x4b)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class LeS < Base.instruction(0x4c)
|
class LeS < Base.instruction(0x4c)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class LeU < Base.instruction(0x4d)
|
class LeU < Base.instruction(0x4d)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class Load < Base.instruction(0x28)
|
class Load < Base.instruction(0x28)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class Load16S < Base.instruction(0x2e)
|
class Load16S < Base.instruction(0x2e)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class Load16U < Base.instruction(0x2f)
|
class Load16U < Base.instruction(0x2f)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class Load8S < Base.instruction(0x2c)
|
class Load8S < Base.instruction(0x2c)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class Load8U < Base.instruction(0x2d)
|
class Load8U < Base.instruction(0x2d)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class LtS < Base.instruction(0x48)
|
class LtS < Base.instruction(0x48)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ module WAG
|
||||||
module Instruction
|
module Instruction
|
||||||
module I32
|
module I32
|
||||||
class LtU < Base.instruction(0x49)
|
class LtU < Base.instruction(0x49)
|
||||||
|
prepend WAG::Instructable
|
||||||
end
|
end
|
||||||
end
|
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