asrt: derive constants

This commit is contained in:
dcode 2019-04-11 09:36:34 +02:00
parent 6b256bef47
commit 085e2db4c9
3 changed files with 24 additions and 21 deletions

View File

@ -34,7 +34,7 @@
if
i32.const 0
i32.const 24
i32.const 134
i32.const 137
i32.const 15
call $~lib/builtins/abort
unreachable
@ -142,7 +142,7 @@
if
i32.const 0
i32.const 24
i32.const 91
i32.const 94
i32.const 17
call $~lib/builtins/abort
unreachable
@ -190,7 +190,7 @@
if
i32.const 0
i32.const 24
i32.const 102
i32.const 105
i32.const 6
call $~lib/builtins/abort
unreachable
@ -220,7 +220,7 @@
end
i32.const 0
i32.const 24
i32.const 113
i32.const 116
i32.const 24
call $~lib/builtins/abort
unreachable
@ -242,7 +242,7 @@
if
i32.const 0
i32.const 24
i32.const 119
i32.const 122
i32.const 2
call $~lib/builtins/abort
unreachable

View File

@ -21,16 +21,19 @@ const ACYCLIC_FLAG: u32 = 0;
// @ts-ignore: decorator
@inline
const BUFFERED_BIT: u32 = 1 << 31;
const BUFFERED_BIT: u32 = 1 << (sizeof<u32>() * 8 - 1);
// @ts-ignore: decorator
@inline
const COLOR_SHIFT: u32 = 28;
const COLOR_SIZE = 3;
// @ts-ignore: decorator
@inline
const COLOR_BITS: u32 = 7 << COLOR_SHIFT;
const COLOR_SHIFT: u32 = ctz(BUFFERED_BIT) - COLOR_SIZE;
// @ts-ignore: decorator
@inline
const REFCOUNT_BITS: u32 = (1 << 28) - 1;
const COLOR_BITS: u32 = ((1 << COLOR_SIZE) - 1) << COLOR_SHIFT;
// @ts-ignore: decorator
@inline
const REFCOUNT_BITS: u32 = (1 << COLOR_SHIFT) - 1;
// ╒════════╤════════════ Colors ══════════════════════╕
// │ Color │ Meaning │
@ -46,26 +49,26 @@ const REFCOUNT_BITS: u32 = (1 << 28) - 1;
// @ts-ignore: decorator
@inline
const COLOR_BLACK = 0 << COLOR_SHIFT;
const COLOR_BLACK: u32 = 0 << COLOR_SHIFT;
// @ts-ignore: decorator
@inline
const COLOR_GRAY = 1 << COLOR_SHIFT;
const COLOR_GRAY: u32 = 1 << COLOR_SHIFT;
// @ts-ignore: decorator
@inline
const COLOR_WHITE = 2 << COLOR_SHIFT;
const COLOR_WHITE: u32 = 2 << COLOR_SHIFT;
// @ts-ignore: decorator
@inline
const COLOR_PURPLE = 3 << COLOR_SHIFT;
const COLOR_PURPLE: u32 = 3 << COLOR_SHIFT;
// @ts-ignore: decorator
@inline
const COLOR_RED = 4 << COLOR_SHIFT;
const COLOR_RED: u32 = 4 << COLOR_SHIFT;
// @ts-ignore: decorator
@inline
const COLOR_ORANGE = 5 << COLOR_SHIFT;
const COLOR_ORANGE: u32 = 5 << COLOR_SHIFT;
// @ts-ignore: decorator
@inline
const VISIT_DECREMENT = 1;
const VISIT_DECREMENT = 1; // guard 0
// @ts-ignore: decorator
@inline
const VISIT_MARKGRAY = 2;

View File

@ -351,7 +351,7 @@
if
i32.const 0
i32.const 24
i32.const 134
i32.const 137
i32.const 15
call $~lib/builtins/abort
unreachable
@ -555,7 +555,7 @@
if
i32.const 0
i32.const 24
i32.const 91
i32.const 94
i32.const 17
call $~lib/builtins/abort
unreachable
@ -602,7 +602,7 @@
if
i32.const 0
i32.const 24
i32.const 102
i32.const 105
i32.const 6
call $~lib/builtins/abort
unreachable
@ -639,7 +639,7 @@
if
i32.const 0
i32.const 24
i32.const 113
i32.const 116
i32.const 24
call $~lib/builtins/abort
unreachable
@ -668,7 +668,7 @@
if
i32.const 0
i32.const 24
i32.const 119
i32.const 122
i32.const 2
call $~lib/builtins/abort
unreachable