Wasmer Ruby Versions Save

💎🕸 WebAssembly runtime for Ruby

1.0.0

2 years ago

It's basically the 0.5.0 version. The only noticeable change is that the Wasmer runtime has been updated to version 2.0.

Added

  • All examples are now tested as part of the test suite (#53 by @Hywan)

Changed

  • The Ruby embedding has been updated to Wasmer 2.0, which is faster in many regards (#57 by @Hywan)

0.5.0

2 years ago

This is a full rewrite of the entire project. This version is a candidate to become the 1.0 version.

We advise to take a look at:

Shortly, here are the new types the extension provides:

  • Store, which holds the engine, the compiler etc.
  • Module, which represents a Wasm module, with validate, new, name=, name, exports, imports, custom_sections, serialize and deserialize,
  • Instance, which represents a Wasm instance, with new and exports,
  • Exports, which represents a collection of exported entities, with respond_to_missing?, method_missing, and length,
  • ImportObject, which represents a collection of imports that will be passed to Instance, with new, contains_namespace, and register,
  • Function, which represents an imported or exported function, with new, call and type,
  • Memory, which represents an imported or exported memory, with new, type, size, data_size, grow, + memory views that extends Enumerable,
  • Global, which represents an imported or exported global, with new, mutable?, value, value=, and type,
  • Table, which represents an imported or exported table, with new (small API for the moment),
  • Type, FunctionType, MemoryType, GlobalType and TableType,
  • ExportType and ImportType,
  • Value which represents a Wasm value,
  • Wasi module, which provides the Version, StateBuilder and Environment classes.

Added

  • Online documentation, with tested examples (#51 by [@Hywan])
  • Tests run against Ruby 2.7 + 3.0, and against Linux + macOS (#49 by [@Hywan])

Changed

As we said, the extension has been fully rewritten, and the code is likely to not be compatible anymore. Here are the most notable patches:

  • The big rewrite (#48 by @Hywan)
  • Remove Ruby dependency to rutie (#52 by @Hywan)

0.4.0

4 years ago

Added

  • Support exported global variables (#32 by @Hywan)

    instance = Wasmer::Instance.new bytes
    x = instance.globals.x
    
    assert x.mutable
    assert_equal x.value, 7
    
    x.value = 42
    
    assert_equal x.value, 42
    
  • Support memory without an exported memory (#31 by @Hywan)

Changed

  • Set @memory to nil if none is exported (#33 by @Hywan)
  • Migrate CI from CircleCI to Github Actions (#28 by @Hywan)
  • Format code (#26 by @Atul9)
  • Update Rutie to 0.7.0 (Rust) and 0.0.4 (Ruby) (#23 by @Hywan)
  • Update Wasmer from 0.6.0 to 0.14.0 (#23, #24, #25, #35, by @Hywan)

Security

  • Update rake and other dependencies (#36 by @Hywan)

0.3.0

4 years ago

Features

Extension

  • #19 Add the Memory.grow method (@Hywan)

  • #15 Typed arrays implement the Enumerable mixin (@irxground)

    memory = instance.memory.uint8_view pointer
    string = ""
    
    # Now we can write this more Ruby idiomatic loop:
    memory.each do |char|
      break if char == 0
      string += char.chr
    end
    
  • #9 Implement instance.exports.respond_to? to test whether an exported function exists (@irxground)

    instance = Wasmer::Instance.new(self.bytes)
    
    assert instance.exports.respond_to?(:foo)
    
  • #5 Improve Ruby exception raising (@irxground)

Runtime

  • #20 Update Wasmer to 0.5.5 (@Hywan)
  • #11 Update Wasmer to 0.4.2 (@Hywan)
  • #7 Update Wasmer to 0.4.1 (@Hywan)

Bug/security fixes

  • #16 Update Rutie (@edvakf)

  • #8 Handle exported functions that return nothing, aka void functions (@Hywan)

  • #4 Move all symbols inside the Wasmer module (@irxground)

    # Read from the `Wasmer` module.
    instance = Wasmer::Instance.new()
    

Documentation

  • #14 Improve documentation (@denniscollective)
  • #12 Add the greet eaxmple (@Hywan)

Chore

  • #13 Use assert_nil instead of assert_equal_nil in tests (@Hywan)
  • #10 Set up Bors (@Hywan)