GetFirefly/firefly

Term::NIL.is_header() is true, so Term::NIL.is_valid() is false on wasm32-unknown-unknown

Closed this issue · 0 comments

An empty list (Term::NIL) cannot be stack_push'd on wasm32-unknown-unknown because it Term::NIL.is_valid() is false there.

Index: liblumen_alloc/src/erts/process.rs
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- liblumen_alloc/src/erts/process.rs	(revision f3d4d12e441cdf0e53b3bf680eb2946364046d11)
+++ liblumen_alloc/src/erts/process.rs	(date 1598375704729)
@@ -409,7 +409,7 @@
     /// Returns `Err(Alloc)` if the process is out of stack space
     #[inline]
     pub fn stack_push(&self, term: Term) -> AllocResult<()> {
-        assert!(term.is_valid());
+        assert!(term.is_valid(), "Term ({}) is not valid (is none? [{}]; is header? [{}]; Term::NIL is header? [{}]) to push to stack of process ({})", term, term.is_none(), term.is_header(), Term::NIL.is_header(), self);
         unsafe {
             let stack0 = self.alloca(1)?.as_ptr();
             ptr::write(stack0, term);
panicked at 'Term ([]) is not valid (is none? [false]; is header? [true]; Term:NIL is header? [true]) to push to stack of process (#PID<0.0.0>)', liblumen_alloc/src/erts/process.rs:412:9