Chakracore: Wasm todo

Created on 11 Jun 2016  路  13Comments  路  Source: chakra-core/ChakraCore

This is a list of thing we need to implement for Wasm MVP

  • [x] Br yielding values #1111
  • [x] I32Popcnt
  • [x] F32Min/Max #659
  • [x] Trunc JIT
  • [x] Nearest JIT
  • [x] Int64 (@Cellule #1806)
  • [x] Unreachable operator
  • [x] Unreachable state
  • [ ] Missing OpCodes

    • [x] current_memory (0x3b)

    • [ ] grow_memory (0x39) (@MikeHolman)

    • [x] f64.copysign (0x91)

    • [ ] i32.trunc_u/f32 (0x9f) (@Krovatkin #1812)

    • [ ] i32.trunc_u/f64 (0xa0) (@Krovatkin #1812)

    • [ ] f32.convert_u/i32 (0xa9) (@Krovatkin)

    • [x] f32.reinterpret/i32 (0xad) (@Krovatkin #1813)

    • [x] get_global (0xbb)

    • [x] set_global (0xbc)

    • [ ] Int64 Conversions

    • [ ] i64.trunc_s/f32

    • [ ] i64.trunc_s/f64

    • [ ] i64.trunc_u/f32

    • [ ] i64.trunc_u/f64

    • [ ] i64.extend_s/i32 (@meg-gupta)

    • [ ] i64.extend_u/i32 (@meg-gupta)

    • [ ] f32.convert_s/i64

    • [ ] f32.convert_u/i64

    • [ ] f64.convert_s/i64

    • [ ] f64.convert_u/i64

    • [ ] f64.reinterpret/i64 (@arunetm)

    • [ ] i64.reinterpret/f64 (@arunetm)

  • [x] [Globals](https://github.com/WebAssembly/design/blob/binary_0xc/BinaryEncoding.md#global-section)
  • [ ] [Init Expressions](https://github.com/WebAssembly/design/blob/binary_0xc/BinaryEncoding.md#init_expr)
  • [ ] Correctly call imported functions from the function table (intermediary function used for the conversion) (@Cellule #1807)
  • [ ] [Import types](https://github.com/WebAssembly/design/blob/binary_0xc/BinaryEncoding.md#import-entry)

    • [ ] Kind: Table

    • [ ] Kind: Memory (@MikeHolman)

    • [x] Kind: Global

  • [ ] [Export types](https://github.com/WebAssembly/design/blob/binary_0xc/BinaryEncoding.md#export-entry)

    • [ ] Kind: Table

    • [x] Kind: Global

  • [ ] Runtime Traps

    • [ ] Array access out of bound (@meg-gupta)

    • [ ] Verify math trapping

    • [ ] Trap on invalid indirect call (out of bounds and invalid signature)

  • [ ] Spec compliant
  • [ ] Ignore the names section until we have use of it (@cellule #1855)
  • [ ] Copy the binary buffer to prevent modification after call to wasm.instantiateModule() or new WebAssembly.Module() (@Cellule #1808)
  • [x] 0xD format (@Cellule #1822)

    • [x] [OpCode Reordering](https://github.com/WebAssembly/design/blob/binary_0xd/BinaryEncoding.md#function-bodies)

    • [x] [Negative type constructors](https://github.com/WebAssembly/design/blob/binary_0xd/BinaryEncoding.md#language-types)

    • [x] [Block signature has byte -0x40 for no return value](https://github.com/WebAssembly/design/blob/binary_0xd/BinaryEncoding.md#block_type)

  • [x] Enable deferred parsing by default
  • [ ] Investigate Debugging/Profiling scenario on Edge
  • [ ] Implement final Javascript API (@MikeHolman)

    • [ ] Remove Wasm Object from the global scope #1834

  • [x] Retire WebAssembly branch completely (all dev work done in master)
  • [ ] Security analysis (@Penguinwizzard)
  • [ ] Known Bug Fixes

    • [ ] Assert on print(Wasm.instantiateModule(buffer, ffi).exports.a);

  • [ ] Call import with int64 and float32 in arguments
  • [ ] Performance

    • [ ] Use 4G array to detect out of bounds access and trap

    • [ ] Fold const math operations (#1852)

Task WebAssembly

Most helpful comment

I'm working on adding new JS API. In particular so far have implemented (or partially implemented)
WebAssembly.compile, WebAssembly.Module, WebAssembly.Instance, WebAssembly.RuntimeError, WebAssembly.CompileError

All 13 comments

Good list for tracking. Can we add debugging there as well?

This is more to track what is missing to be spec compliant.
Debugging is, in my opinion, an extra feature that we need to look into

Yeah I agree.

f32min/max is done.

trunc and nearest done.

@Cellule PR #1514 adds current_memory and we also got a working version of unreachable_operator Should be able to open a PR shortly.

Updated the list with everything I know we still needs to do for MVP
@LouisLaf for visibility

@Cellule, fyi @MikeHolman

a small update,

  • redid globals. i should be able to open a PR as soon as we make sure it doesnt have any obvious goofs :-)
  • finishing up with

i32.trunc_u/f32 (0x9f)
i32.trunc_u/f64 (0xa0)
i32.trunc_s/f64 (0xa0) //needs to throw an overflow exception
i32.trunc_s/f64 (0xa0) //needs to throw an overflow exception

@Cellule hey do you know if anyone is implementing f32.reinterpret/i32? if not, i think it's perfect for my afternoon pastime :-)

@Cellule actually it seems that f32.reinterpret/i32 is already fully implemented. Reinterpret_ITF , on the other hand, seems to be missing the codegen part.

  DEF2_WMS( I1toF1Mem        , Reinterpret_ITF, NumberUtilities::ReinterpretBits                 ) // reinterpret bits of int to float
  DEF2_WMS( F1toI1Scr        , Reinterpret_FTI, NumberUtilities::ToSpecial                       ) // reinterpret bits of float to int

I was also thinking maybe we could try to merge these

    NUMBER_UTIL_INLINE uint64 NumberUtilities::ToSpecial(double value)
    {
        return  *(reinterpret_cast<uint64 *>(&value));
    }

    NUMBER_UTIL_INLINE uint32 NumberUtilities::ToSpecial(float value)
    {
        return  *(reinterpret_cast<uint32 *>(&value));
    }

    NUMBER_UTIL_INLINE float NumberUtilities::ReinterpretBits(int value)
    {
        return  *(reinterpret_cast<float *>(&value));
    }

into

template<typename  T, typename U>
inline T Reinterpret(U src) 
{
    Assert(sizeof(T) == sizeof(U));
    return *(reinterpret_cast<T*> (&src));
}

@Cellule oops, i take that back :-) im sry. it looks the only thing that was missing is Reinterpret_ITF -> Reinterpret_Prim in IRBuilderAsmJs :-)

I'm working on adding new JS API. In particular so far have implemented (or partially implemented)
WebAssembly.compile, WebAssembly.Module, WebAssembly.Instance, WebAssembly.RuntimeError, WebAssembly.CompileError

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ross-weir picture ross-weir  路  4Comments

d3x0r picture d3x0r  路  5Comments

Kureev picture Kureev  路  5Comments

kunalspathak picture kunalspathak  路  4Comments

ljharb picture ljharb  路  4Comments