Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stdlib)!: Add ** (pow) operator to Pervasives module #1690

Merged
merged 7 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions compiler/test/__snapshots__/arrays.0f9e7d37.0.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ arrays › array_access
(import \"GRAIN$MODULE$runtime/gc\" \"incRef\" (func $incRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"decRef\" (func $decRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$runtime/exception\" \"panicWithException\" (func $panicWithException_0 (param i32 i32) (result i32)))
(global $x_1110 (mut i32) (i32.const 0))
(global $x_1113 (mut i32) (i32.const 0))
(global $GRAIN$TABLE_SIZE i32 (i32.const 0))
(elem $elem (global.get $relocBase_0))
(export \"memory\" (memory $0))
Expand Down Expand Up @@ -44,7 +44,7 @@ arrays › array_access
(local.set $0
(block $compile_block.10 (result i32)
(block $compile_store.3
(global.set $x_1110
(global.set $x_1113
(tuple.extract 0
(tuple.make
(block $allocate_array.1 (result i32)
Expand Down Expand Up @@ -77,7 +77,7 @@ arrays › array_access
)
(call $decRef_0
(global.get $GRAIN$EXPORT$decRef_0)
(global.get $x_1110)
(global.get $x_1113)
)
)
)
Expand All @@ -90,7 +90,7 @@ arrays › array_access
(i32.const 1)
)
(local.set $2
(global.get $x_1110)
(global.get $x_1113)
)
(block $resolve_idx.8
(if
Expand Down
8 changes: 4 additions & 4 deletions compiler/test/__snapshots__/arrays.28fcc534.0.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ arrays › array_access4
(import \"GRAIN$MODULE$runtime/gc\" \"incRef\" (func $incRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"decRef\" (func $decRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$runtime/exception\" \"panicWithException\" (func $panicWithException_0 (param i32 i32) (result i32)))
(global $x_1110 (mut i32) (i32.const 0))
(global $x_1113 (mut i32) (i32.const 0))
(global $GRAIN$TABLE_SIZE i32 (i32.const 0))
(elem $elem (global.get $relocBase_0))
(export \"memory\" (memory $0))
Expand Down Expand Up @@ -44,7 +44,7 @@ arrays › array_access4
(local.set $0
(block $compile_block.10 (result i32)
(block $compile_store.3
(global.set $x_1110
(global.set $x_1113
(tuple.extract 0
(tuple.make
(block $allocate_array.1 (result i32)
Expand Down Expand Up @@ -77,7 +77,7 @@ arrays › array_access4
)
(call $decRef_0
(global.get $GRAIN$EXPORT$decRef_0)
(global.get $x_1110)
(global.get $x_1113)
)
)
)
Expand All @@ -90,7 +90,7 @@ arrays › array_access4
(i32.const -3)
)
(local.set $2
(global.get $x_1110)
(global.get $x_1113)
)
(block $resolve_idx.8
(if
Expand Down
8 changes: 4 additions & 4 deletions compiler/test/__snapshots__/arrays.4c8c9f91.0.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ arrays › array_access2
(import \"GRAIN$MODULE$runtime/gc\" \"incRef\" (func $incRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"decRef\" (func $decRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$runtime/exception\" \"panicWithException\" (func $panicWithException_0 (param i32 i32) (result i32)))
(global $x_1110 (mut i32) (i32.const 0))
(global $x_1113 (mut i32) (i32.const 0))
(global $GRAIN$TABLE_SIZE i32 (i32.const 0))
(elem $elem (global.get $relocBase_0))
(export \"memory\" (memory $0))
Expand Down Expand Up @@ -44,7 +44,7 @@ arrays › array_access2
(local.set $0
(block $compile_block.10 (result i32)
(block $compile_store.3
(global.set $x_1110
(global.set $x_1113
(tuple.extract 0
(tuple.make
(block $allocate_array.1 (result i32)
Expand Down Expand Up @@ -77,7 +77,7 @@ arrays › array_access2
)
(call $decRef_0
(global.get $GRAIN$EXPORT$decRef_0)
(global.get $x_1110)
(global.get $x_1113)
)
)
)
Expand All @@ -90,7 +90,7 @@ arrays › array_access2
(i32.const 3)
)
(local.set $2
(global.get $x_1110)
(global.get $x_1113)
)
(block $resolve_idx.8
(if
Expand Down
8 changes: 4 additions & 4 deletions compiler/test/__snapshots__/arrays.6eac4e1f.0.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ arrays › array_access3
(import \"GRAIN$MODULE$runtime/gc\" \"incRef\" (func $incRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"decRef\" (func $decRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$runtime/exception\" \"panicWithException\" (func $panicWithException_0 (param i32 i32) (result i32)))
(global $x_1110 (mut i32) (i32.const 0))
(global $x_1113 (mut i32) (i32.const 0))
(global $GRAIN$TABLE_SIZE i32 (i32.const 0))
(elem $elem (global.get $relocBase_0))
(export \"memory\" (memory $0))
Expand Down Expand Up @@ -44,7 +44,7 @@ arrays › array_access3
(local.set $0
(block $compile_block.10 (result i32)
(block $compile_store.3
(global.set $x_1110
(global.set $x_1113
(tuple.extract 0
(tuple.make
(block $allocate_array.1 (result i32)
Expand Down Expand Up @@ -77,7 +77,7 @@ arrays › array_access3
)
(call $decRef_0
(global.get $GRAIN$EXPORT$decRef_0)
(global.get $x_1110)
(global.get $x_1113)
)
)
)
Expand All @@ -90,7 +90,7 @@ arrays › array_access3
(i32.const 5)
)
(local.set $2
(global.get $x_1110)
(global.get $x_1113)
)
(block $resolve_idx.8
(if
Expand Down
8 changes: 4 additions & 4 deletions compiler/test/__snapshots__/arrays.74d79181.0.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ arrays › array_access5
(import \"GRAIN$MODULE$runtime/gc\" \"incRef\" (func $incRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"decRef\" (func $decRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$runtime/exception\" \"panicWithException\" (func $panicWithException_0 (param i32 i32) (result i32)))
(global $x_1110 (mut i32) (i32.const 0))
(global $x_1113 (mut i32) (i32.const 0))
(global $GRAIN$TABLE_SIZE i32 (i32.const 0))
(elem $elem (global.get $relocBase_0))
(export \"memory\" (memory $0))
Expand Down Expand Up @@ -44,7 +44,7 @@ arrays › array_access5
(local.set $0
(block $compile_block.10 (result i32)
(block $compile_store.3
(global.set $x_1110
(global.set $x_1113
(tuple.extract 0
(tuple.make
(block $allocate_array.1 (result i32)
Expand Down Expand Up @@ -77,7 +77,7 @@ arrays › array_access5
)
(call $decRef_0
(global.get $GRAIN$EXPORT$decRef_0)
(global.get $x_1110)
(global.get $x_1113)
)
)
)
Expand All @@ -90,7 +90,7 @@ arrays › array_access5
(i32.const -5)
)
(local.set $2
(global.get $x_1110)
(global.get $x_1113)
)
(block $resolve_idx.8
(if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ basic functionality › comp5
(import \"_genv\" \"relocBase\" (global $relocBase_0 i32))
(import \"_genv\" \"moduleRuntimeId\" (global $moduleRuntimeId_0 i32))
(import \"GRAIN$MODULE$runtime/gc\" \"GRAIN$EXPORT$incRef\" (global $GRAIN$EXPORT$incRef_0 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$<\" (global $<_1111 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$<\" (global $<_1114 (mut i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"incRef\" (func $incRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"<\" (func $<_1111 (param i32 i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"<\" (func $<_1114 (param i32 i32 i32) (result i32)))
(global $GRAIN$TABLE_SIZE i32 (i32.const 0))
(elem $elem (global.get $relocBase_0))
(export \"memory\" (memory $0))
Expand Down Expand Up @@ -42,10 +42,10 @@ basic functionality › comp5
(block $compile_block.5 (result i32)
(block $compile_store.2
(local.set $6
(call $<_1111
(call $<_1114
(call $incRef_0
(global.get $GRAIN$EXPORT$incRef_0)
(global.get $<_1111)
(global.get $<_1114)
)
(i32.const 5)
(i32.const 7)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ basic functionality › modulo4
(import \"_genv\" \"relocBase\" (global $relocBase_0 i32))
(import \"_genv\" \"moduleRuntimeId\" (global $moduleRuntimeId_0 i32))
(import \"GRAIN$MODULE$runtime/gc\" \"GRAIN$EXPORT$incRef\" (global $GRAIN$EXPORT$incRef_0 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$%\" (global $%_1110 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$%\" (global $%_1113 (mut i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"incRef\" (func $incRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"%\" (func $%_1110 (param i32 i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"%\" (func $%_1113 (param i32 i32 i32) (result i32)))
(global $GRAIN$TABLE_SIZE i32 (i32.const 0))
(elem $elem (global.get $relocBase_0))
(export \"memory\" (memory $0))
Expand Down Expand Up @@ -39,10 +39,10 @@ basic functionality › modulo4
(block $cleanup_locals.2 (result i32)
(local.set $0
(block $compile_block.1 (result i32)
(call $%_1110
(call $%_1113
(call $incRef_0
(global.get $GRAIN$EXPORT$incRef_0)
(global.get $%_1110)
(global.get $%_1113)
)
(i32.const -33)
(i32.const 35)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ basic functionality › land4
(import \"_genv\" \"relocBase\" (global $relocBase_0 i32))
(import \"_genv\" \"moduleRuntimeId\" (global $moduleRuntimeId_0 i32))
(import \"GRAIN$MODULE$runtime/gc\" \"GRAIN$EXPORT$incRef\" (global $GRAIN$EXPORT$incRef_0 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$&\" (global $&_1110 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$&\" (global $&_1113 (mut i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"incRef\" (func $incRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"&\" (func $&_1110 (param i32 i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"&\" (func $&_1113 (param i32 i32 i32) (result i32)))
(global $GRAIN$TABLE_SIZE i32 (i32.const 0))
(elem $elem (global.get $relocBase_0))
(export \"memory\" (memory $0))
Expand Down Expand Up @@ -39,10 +39,10 @@ basic functionality › land4
(block $cleanup_locals.2 (result i32)
(local.set $0
(block $compile_block.1 (result i32)
(call $&_1110
(call $&_1113
(call $incRef_0
(global.get $GRAIN$EXPORT$incRef_0)
(global.get $&_1110)
(global.get $&_1113)
)
(i32.const 1)
(i32.const 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ basic functionality › lxor1
(import \"_genv\" \"relocBase\" (global $relocBase_0 i32))
(import \"_genv\" \"moduleRuntimeId\" (global $moduleRuntimeId_0 i32))
(import \"GRAIN$MODULE$runtime/gc\" \"GRAIN$EXPORT$incRef\" (global $GRAIN$EXPORT$incRef_0 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$^\" (global $^_1110 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$^\" (global $^_1113 (mut i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"incRef\" (func $incRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"^\" (func $^_1110 (param i32 i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"^\" (func $^_1113 (param i32 i32 i32) (result i32)))
(global $GRAIN$TABLE_SIZE i32 (i32.const 0))
(elem $elem (global.get $relocBase_0))
(export \"memory\" (memory $0))
Expand Down Expand Up @@ -39,10 +39,10 @@ basic functionality › lxor1
(block $cleanup_locals.2 (result i32)
(local.set $0
(block $compile_block.1 (result i32)
(call $^_1110
(call $^_1113
(call $incRef_0
(global.get $GRAIN$EXPORT$incRef_0)
(global.get $^_1110)
(global.get $^_1113)
)
(i32.const 3)
(i32.const 3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ basic functionality › lor1
(import \"_genv\" \"relocBase\" (global $relocBase_0 i32))
(import \"_genv\" \"moduleRuntimeId\" (global $moduleRuntimeId_0 i32))
(import \"GRAIN$MODULE$runtime/gc\" \"GRAIN$EXPORT$incRef\" (global $GRAIN$EXPORT$incRef_0 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$|\" (global $|_1110 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$|\" (global $|_1113 (mut i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"incRef\" (func $incRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"|\" (func $|_1110 (param i32 i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"|\" (func $|_1113 (param i32 i32 i32) (result i32)))
(global $GRAIN$TABLE_SIZE i32 (i32.const 0))
(elem $elem (global.get $relocBase_0))
(export \"memory\" (memory $0))
Expand Down Expand Up @@ -39,10 +39,10 @@ basic functionality › lor1
(block $cleanup_locals.2 (result i32)
(local.set $0
(block $compile_block.1 (result i32)
(call $|_1110
(call $|_1113
(call $incRef_0
(global.get $GRAIN$EXPORT$incRef_0)
(global.get $|_1110)
(global.get $|_1113)
)
(i32.const 3)
(i32.const 3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ basic functionality › modulo6
(import \"_genv\" \"relocBase\" (global $relocBase_0 i32))
(import \"_genv\" \"moduleRuntimeId\" (global $moduleRuntimeId_0 i32))
(import \"GRAIN$MODULE$runtime/gc\" \"GRAIN$EXPORT$incRef\" (global $GRAIN$EXPORT$incRef_0 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$%\" (global $%_1110 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$%\" (global $%_1113 (mut i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"incRef\" (func $incRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"%\" (func $%_1110 (param i32 i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"%\" (func $%_1113 (param i32 i32 i32) (result i32)))
(global $GRAIN$TABLE_SIZE i32 (i32.const 0))
(elem $elem (global.get $relocBase_0))
(export \"memory\" (memory $0))
Expand Down Expand Up @@ -39,10 +39,10 @@ basic functionality › modulo6
(block $cleanup_locals.2 (result i32)
(local.set $0
(block $compile_block.1 (result i32)
(call $%_1110
(call $%_1113
(call $incRef_0
(global.get $GRAIN$EXPORT$incRef_0)
(global.get $%_1110)
(global.get $%_1113)
)
(i32.const 35)
(i32.const 35)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ basic functionality › precedence1
(import \"_genv\" \"moduleRuntimeId\" (global $moduleRuntimeId_0 i32))
(import \"GRAIN$MODULE$runtime/gc\" \"GRAIN$EXPORT$incRef\" (global $GRAIN$EXPORT$incRef_0 (mut i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"GRAIN$EXPORT$decRef\" (global $GRAIN$EXPORT$decRef_0 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$*\" (global $*_1113 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$+\" (global $+_1110 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$*\" (global $*_1116 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$+\" (global $+_1113 (mut i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"incRef\" (func $incRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"decRef\" (func $decRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"*\" (func $*_1113 (param i32 i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"+\" (func $+_1110 (param i32 i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"*\" (func $*_1116 (param i32 i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"+\" (func $+_1113 (param i32 i32 i32) (result i32)))
(global $GRAIN$TABLE_SIZE i32 (i32.const 0))
(elem $elem (global.get $relocBase_0))
(export \"memory\" (memory $0))
Expand Down Expand Up @@ -48,10 +48,10 @@ basic functionality › precedence1
(local.set $6
(tuple.extract 0
(tuple.make
(call $*_1113
(call $*_1116
(call $incRef_0
(global.get $GRAIN$EXPORT$incRef_0)
(global.get $*_1113)
(global.get $*_1116)
)
(i32.const 9)
(i32.const 13)
Expand All @@ -66,10 +66,10 @@ basic functionality › precedence1
(block $do_backpatches.1
)
)
(call $+_1110
(call $+_1113
(call $incRef_0
(global.get $GRAIN$EXPORT$incRef_0)
(global.get $+_1110)
(global.get $+_1113)
)
(i32.const 7)
(call $incRef_0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ basic functionality › comp16
(import \"_genv\" \"relocBase\" (global $relocBase_0 i32))
(import \"_genv\" \"moduleRuntimeId\" (global $moduleRuntimeId_0 i32))
(import \"GRAIN$MODULE$runtime/gc\" \"GRAIN$EXPORT$incRef\" (global $GRAIN$EXPORT$incRef_0 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$==\" (global $==_1110 (mut i32)))
(import \"GRAIN$MODULE$pervasives\" \"GRAIN$EXPORT$==\" (global $==_1113 (mut i32)))
(import \"GRAIN$MODULE$runtime/gc\" \"incRef\" (func $incRef_0 (param i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"==\" (func $==_1110 (param i32 i32 i32) (result i32)))
(import \"GRAIN$MODULE$pervasives\" \"==\" (func $==_1113 (param i32 i32 i32) (result i32)))
(global $GRAIN$TABLE_SIZE i32 (i32.const 0))
(elem $elem (global.get $relocBase_0))
(export \"memory\" (memory $0))
Expand Down Expand Up @@ -39,10 +39,10 @@ basic functionality › comp16
(block $cleanup_locals.2 (result i32)
(local.set $0
(block $compile_block.1 (result i32)
(call $==_1110
(call $==_1113
(call $incRef_0
(global.get $GRAIN$EXPORT$incRef_0)
(global.get $==_1110)
(global.get $==_1113)
)
(i32.const 2147483646)
(i32.const 2147483646)
Expand Down
Loading