CFLAGS = -g
STRIP = touch
else
- CFLAGS = -Wall -O3 -ffast-math -fomit-frame-pointer $(SITE_CFLAGS)
+ CFLAGS = -Wall -O3 -ffast-math $(SITE_CFLAGS)
STRIP = strip
endif
$(MAKE) $(BINARY) CONFIG=vm/Config.macosx.ppc
macosx-x86: macosx-freetype
- $(MAKE) $(BINARY) CONFIG=vm/Config.macosx
+ $(MAKE) $(BINARY) CONFIG=vm/Config.macosx.x86
linux-x86:
- $(MAKE) $(BINARY) CONFIG=vm/Config.linux
- $(STRIP) $(BINARY)
+ $(MAKE) $(BINARY) CONFIG=vm/Config.linux.x86
+ # $(STRIP) $(BINARY)
linux-amd64:
$(MAKE) $(BINARY) CONFIG=vm/Config.linux.amd64
! Load a literal (immediate or indirect)
G: load-literal ( obj vreg -- ) 1 standard-combination ;
-! Set up caller stack frame (PowerPC and AMD64)
-: %prologue ( n -- ) drop ; inline
+! Set up caller stack frame
+DEFER: %prologue ( n -- )
-! Tear down stack frame (PowerPC and AMD64)
-: %epilogue ( -- ) ; inline
+! Tear down stack frame
+DEFER: %epilogue ( -- )
! Tail call another word
DEFER: %jump ( label -- )
M: object load-literal
v>operand load-indirect ;
+: %prologue ( n -- )
+ drop
+ EBP PUSH
+ EBP ESP MOV ;
+
+: %epilogue ( -- )
+ LEAVE ;
+
: (%call) ( label -- label )
dup (compile) dup primitive? [ address-operand ] when ;
: JLE HEX: 8e JUMPcc ;
: JG HEX: 8f JUMPcc ;
+: LEAVE ( -- ) HEX: c9 , ;
: RET ( -- ) HEX: c3 , ;
! Arithmetic
--- /dev/null
+include vm/Config.linux
+include vm/Config.x86
--- /dev/null
+include vm/Config.macosx
+include vm/Config.x86
LIBS = -lm
PLAF_SUFFIX = .exe
PLAF_OBJS = vm/os-windows.o
+include wm/Config.x86
--- /dev/null
+PLAF_OBJS += vm/cpu-x86.o
--- /dev/null
+/* Callable from C as
+void *native_stack_pointer(void) */
+ .globl native_stack_pointer
+native_stack_pointer:
+ mov %ebp,%eax
+ ret
INLINE void flush_icache(CELL start, CELL len) {}
-INLINE void *native_stack_pointer(void)
-{
- void *ptr;
- asm("mov %%ebp, %0" : "=r" (ptr));
- return ptr;
-}
+void *native_stack_pointer(void);
typedef struct _F_STACK_FRAME {
struct _F_STACK_FRAME *previous;
while((CELL)frame < (CELL)stack_chain->native_stack_pointer)
{
- fflush(stdout);
REGISTER_ARRAY(array);
CELL cell = allot_cell((CELL)frame->return_address);
UNREGISTER_ARRAY(array);
GROWABLE_ADD(array,cell);
if((CELL)frame->previous <= (CELL)frame)
- critical_error("C stack is busted",(CELL)frame);
+ {
+ fprintf(stderr,"Factor warning: unusual C stack layout\n");
+ fflush(stderr);
+ break;
+ }
frame = frame->previous;
}