Type limits

This commit is contained in:
dcodeIO
2017-12-15 15:00:19 +01:00
parent 8085a02df3
commit 7cf879fb4b
35 changed files with 911 additions and 86 deletions

View File

@ -43,6 +43,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
[program.exports]
;)

View File

@ -846,6 +846,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
binary/b
binary/i
binary/I

View File

@ -1063,6 +1063,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
builtins/b
builtins/i
builtins/I

View File

@ -71,6 +71,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
class/Animal
class/Animal.MAX
class/Animal.add

View File

@ -36,6 +36,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
declare/external
[program.exports]
declare/external

View File

@ -81,6 +81,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
do/loopDo
do/loopDoInDo
[program.exports]

View File

@ -66,6 +66,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
enum/Implicit
enum/Explicit
enum/Mixed

View File

@ -60,6 +60,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
export/add
export/sub
export/a

View File

@ -177,6 +177,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
for/i
[program.exports]

View File

@ -338,6 +338,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
../../examples/game-of-life/assembly/game-of-life/w
../../examples/game-of-life/assembly/game-of-life/h
../../examples/game-of-life/assembly/game-of-life/s

View File

@ -1219,6 +1219,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
../../examples/i64-polyfill/assembly/i64/lo
../../examples/i64-polyfill/assembly/i64/hi
../../examples/i64-polyfill/assembly/i64/getLo

View File

@ -76,6 +76,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
if/ifThenElse
if/ifThen
if/ifThenElseBlock

View File

@ -71,6 +71,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
export/add
export/sub
export/a

View File

@ -0,0 +1,9 @@
(module
(type $v (func))
(memory $0 1)
(export "memory" (memory $0))
(start $start)
(func $start (; 0 ;) (type $v)
(nop)
)
)

26
tests/compiler/limits.ts Normal file
View File

@ -0,0 +1,26 @@
i8.MIN_VALUE;
i8.MAX_VALUE;
i16.MIN_VALUE;
i16.MAX_VALUE;
i32.MIN_VALUE;
i32.MAX_VALUE;
i64.MIN_VALUE;
i64.MAX_VALUE;
isize.MIN_VALUE;
isize.MAX_VALUE;
u8.MIN_VALUE;
u8.MAX_VALUE;
u16.MIN_VALUE;
u16.MAX_VALUE;
u32.MIN_VALUE;
u32.MAX_VALUE;
u64.MIN_VALUE;
u64.MAX_VALUE;
usize.MIN_VALUE;
usize.MAX_VALUE;
bool.MIN_VALUE;
bool.MAX_VALUE;
f32.MIN_SAFE_INTEGER;
f32.MAX_SAFE_INTEGER;
f64.MIN_SAFE_INTEGER;
f64.MAX_SAFE_INTEGER;

155
tests/compiler/limits.wast Normal file
View File

@ -0,0 +1,155 @@
(module
(type $v (func))
(global $i8.MIN_VALUE (mut i32) (i32.const -128))
(global $i8.MAX_VALUE (mut i32) (i32.const 127))
(global $i16.MIN_VALUE (mut i32) (i32.const -32768))
(global $i16.MAX_VALUE (mut i32) (i32.const 32767))
(global $i32.MIN_VALUE (mut i32) (i32.const -2147483648))
(global $i32.MAX_VALUE (mut i32) (i32.const 2147483647))
(global $i64.MIN_VALUE (mut i64) (i64.const -9223372036854775808))
(global $i64.MAX_VALUE (mut i64) (i64.const 9223372036854775807))
(global $u8.MIN_VALUE (mut i32) (i32.const 0))
(global $u8.MAX_VALUE (mut i32) (i32.const 255))
(global $u16.MIN_VALUE (mut i32) (i32.const 0))
(global $u16.MAX_VALUE (mut i32) (i32.const 65535))
(global $u32.MIN_VALUE (mut i32) (i32.const 0))
(global $u32.MAX_VALUE (mut i32) (i32.const -1))
(global $u64.MIN_VALUE (mut i64) (i64.const 0))
(global $u64.MAX_VALUE (mut i64) (i64.const -1))
(global $bool.MIN_VALUE (mut i32) (i32.const 0))
(global $bool.MAX_VALUE (mut i32) (i32.const 1))
(global $f32.MIN_SAFE_INTEGER (mut f32) (f32.const -16777215))
(global $f32.MAX_SAFE_INTEGER (mut f32) (f32.const 16777215))
(global $f64.MIN_SAFE_INTEGER (mut f64) (f64.const -9007199254740991))
(global $f64.MAX_SAFE_INTEGER (mut f64) (f64.const 9007199254740991))
(global $HEAP_START i32 (i32.const 4))
(memory $0 1)
(export "memory" (memory $0))
(start $start)
(func $start (; 0 ;) (type $v)
(drop
(i32.const -128)
)
(drop
(i32.const 127)
)
(drop
(i32.const -32768)
)
(drop
(i32.const 32767)
)
(drop
(i32.const -2147483648)
)
(drop
(i32.const 2147483647)
)
(drop
(i64.const -9223372036854775808)
)
(drop
(i64.const 9223372036854775807)
)
(drop
(i32.const -2147483648)
)
(drop
(i32.const 2147483647)
)
(drop
(i32.const 0)
)
(drop
(i32.const 255)
)
(drop
(i32.const 0)
)
(drop
(i32.const 65535)
)
(drop
(i32.const 0)
)
(drop
(i32.const -1)
)
(drop
(i64.const 0)
)
(drop
(i64.const -1)
)
(drop
(i32.const 0)
)
(drop
(i32.const -1)
)
(drop
(i32.const 0)
)
(drop
(i32.const 1)
)
(drop
(f32.const -16777215)
)
(drop
(f32.const 16777215)
)
(drop
(f64.const -9007199254740991)
)
(drop
(f64.const 9007199254740991)
)
)
)
(;
[program.elements]
clz
ctz
popcnt
rotl
rotr
abs
ceil
copysign
floor
max
min
nearest
sqrt
trunc
current_memory
grow_memory
unreachable
load
store
reinterpret
select
sizeof
changetype
isNaN
isFinite
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
[program.exports]
;)

View File

@ -169,6 +169,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
[program.exports]
;)

View File

@ -285,6 +285,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
logical/i
logical/I
logical/f

View File

@ -2083,6 +2083,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
memcpy/memcpy
memcpy/base
memcpy/dest

View File

@ -47,6 +47,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
namespace/Outer
namespace/Outer.Inner
namespace/Outer.Inner.aVar

View File

@ -76,6 +76,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
export/add
export/sub
export/a

View File

@ -175,6 +175,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
switch/doSwitch
switch/doSwitchDefaultFirst
switch/doSwitchDefaultOmitted

View File

@ -63,6 +63,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
ternary/a
[program.exports]

View File

@ -358,6 +358,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
tlsf/fls
tlsf/ffs
tlsf/ALIGN_SIZE_LOG2

View File

@ -651,6 +651,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
unary/i
unary/I
unary/f

View File

@ -90,6 +90,19 @@
assert
parseInt
parseFloat
i8
i16
i32
i64
u8
u16
u32
u64
bool
f32
f64
isize
usize
while/loopWhile
while/loopWhileInWhile
[program.exports]