vm ptr passed to primitives on X86.32 (other cpus still use singleton vm ptr)

db4
Phil Dawes 2009-08-18 20:49:22 +01:00
parent a5f24c8fb9
commit 57011aed51
4 changed files with 13 additions and 6 deletions

View File

@ -27,6 +27,8 @@ IN: bootstrap.x86
temp0 0 [] MOV rc-absolute-cell rt-stack-chain jit-rel
! save stack pointer
temp0 [] stack-reg MOV
! pass vm ptr to primitive
EAX 0 MOV rc-absolute-cell rt-vm jit-rel
! call the primitive
0 JMP rc-relative rt-primitive jit-rel
] jit-primitive jit-define

View File

@ -7,5 +7,4 @@ register cell ds asm("esi");
register cell rs asm("edi");
#define VM_ASM_API VM_C_API __attribute__ ((regparm (2)))
}

View File

@ -35,8 +35,8 @@
/* Factor headers */
#include "layouts.hpp"
#include "primitives.hpp"
#include "platform.hpp"
#include "primitives.hpp"
#include "stacks.hpp"
#include "segments.hpp"
#include "contexts.hpp"

View File

@ -1,9 +1,15 @@
namespace factor
{
extern "C" typedef void (*primitive_type)();
extern const primitive_type primitives[];
#define PRIMITIVE(name) extern "C" void primitive_##name()
#if defined(FACTOR_X86)
extern "C" __attribute__ ((regparm (1))) typedef void (*primitive_type)(void *myvm);
#define PRIMITIVE(name) extern "C" __attribute__ ((regparm (1))) void primitive_##name(void *myvm)
#define PRIMITIVE_GETVM() ((factorvm*)myvm)
#else
extern "C" typedef void (*primitive_type)(void *myvm);
#define PRIMITIVE(name) extern "C" void primitive_##name(void *myvm)
#define PRIMITIVE_GETVM() vm
#endif
extern const primitive_type primitives[];
}