static word min_bytes_allocd(void)
{
word result;
-# ifdef STACK_GROWS_UP
+# ifdef __EMSCRIPTEN__
+ word stack_size = 0;
+# else
+# ifdef STACK_GROWS_UP
word stack_size = GC_approx_sp() - GC_stackbottom;
/* GC_stackbottom is used only for a single-threaded case. */
-# else
+# else
word stack_size = GC_stackbottom - GC_approx_sp();
+# endif
# endif
word total_root_size; /* includes double stack size, */
# define mach_type_known
# endif
+# if defined(__EMSCRIPTEN__)
+# define I386
+# define ALIGNMENT 4
+# define mach_type_known
+# endif
+
/* Feel free to add more clauses here */
/* Or manually define the machine type here. A machine type is */
# define DATAEND NULL
# endif
+# ifdef __EMSCRIPTEN__
+# define OS_TYPE "EMSCRIPTEN"
+# define CPP_WORDSZ 32
+# define ALIGNMENT 4
+# define DATASTART NULL
+# define DATAEND NULL
+# endif
+
# define STACK_GRAN 0x1000000
# ifdef M68K
# define MACH_TYPE "M68K"
}
# define HAVE_PUSH_REGS
# endif /* __MWERKS__ */
+# elif defined(EMSCRIPTEN)
+ void GC_push_regs(void)
+ {
+ }
+# define HAVE_PUSH_REGS
# endif /* MACOS */
#endif /* !USE_ASM_PUSH_REGS */
* This is usually done by saving the current context on the
* stack, and then just tracing from the stack.
*/
+#ifndef __EMSCRIPTEN__
GC_push_regs_and_stack(cold_gc_frame);
+#endif
if (GC_push_other_roots != 0) (*GC_push_other_roots)();
/* In the threads case, this also pushes thread stacks. */
/* another frame. */
GC_API void * GC_CALL GC_clear_stack(void *arg)
{
+#ifdef __EMSCRIPTEN__
+ return arg;
+#endif
ptr_t sp = GC_approx_sp(); /* Hotter than actual sp */
# ifdef THREADS
word volatile dummy[SMALL_CLEAR_SIZE];