removed some vm-> pointers
parent
6e5ddc0c33
commit
fcfd971108
|
@ -232,7 +232,7 @@ char *factorvm::unbox_alien()
|
|||
|
||||
VM_C_API char *unbox_alien()
|
||||
{
|
||||
printf("*PHIL unbox_alien\n");
|
||||
printf("*PHIL unbox_alien\n");fflush(stdout);
|
||||
return vm->unbox_alien();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ const char *vm_executable_path()
|
|||
if(strcmp(path, "unknown") == 0)
|
||||
return NULL;
|
||||
|
||||
return safe_strdup(path);
|
||||
return vm->safe_strdup(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ const char *default_image_path()
|
|||
const char *iter = path;
|
||||
while(*iter) { len++; iter++; }
|
||||
|
||||
char *new_path = (char *)safe_malloc(PATH_MAX + SUFFIX_LEN + 1);
|
||||
char *new_path = (char *)vm->safe_malloc(PATH_MAX + SUFFIX_LEN + 1);
|
||||
memcpy(new_path,path,len + 1);
|
||||
memcpy(new_path + len,SUFFIX,SUFFIX_LEN + 1);
|
||||
return new_path;
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace factor
|
|||
/* Snarfed from SBCL linux-so.c. You must free() this yourself. */
|
||||
const char *vm_executable_path()
|
||||
{
|
||||
char *path = (char *)safe_malloc(PATH_MAX + 1);
|
||||
char *path = (char *)vm->safe_malloc(PATH_MAX + 1);
|
||||
|
||||
int size = readlink("/proc/self/exe", path, PATH_MAX);
|
||||
if (size < 0)
|
||||
|
@ -17,7 +17,7 @@ const char *vm_executable_path()
|
|||
else
|
||||
{
|
||||
path[size] = '\0';
|
||||
return safe_strdup(path);
|
||||
return vm->safe_strdup(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ void ffi_dlclose(dll *dll)
|
|||
PRIMITIVE(existsp)
|
||||
{
|
||||
struct stat sb;
|
||||
char *path = (char *)(untag_check<byte_array>(dpop()) + 1);
|
||||
char *path = (char *)(vm->untag_check<byte_array>(dpop()) + 1);
|
||||
box_boolean(stat(path,&sb) >= 0);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ segment *alloc_segment(cell size)
|
|||
if(mprotect(array + pagesize + size,pagesize,PROT_NONE) == -1)
|
||||
fatal_error("Cannot protect high guard page",(cell)array);
|
||||
|
||||
segment *retval = (segment *)safe_malloc(sizeof(segment));
|
||||
segment *retval = (segment *)vm->safe_malloc(sizeof(segment));
|
||||
|
||||
retval->start = (cell)(array + pagesize);
|
||||
retval->size = size;
|
||||
|
|
|
@ -40,7 +40,7 @@ typedef char symbol_char;
|
|||
#define OPEN_READ(path) fopen(path,"rb")
|
||||
#define OPEN_WRITE(path) fopen(path,"wb")
|
||||
|
||||
#define print_native_string(string) print_string(string)
|
||||
#define print_native_string(string) vm->print_string(string)
|
||||
|
||||
void start_thread(void *(*start_routine)(void *));
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ bool quotation_jit::stack_frame_p()
|
|||
switch(tagged<object>(obj).type())
|
||||
{
|
||||
case WORD_TYPE:
|
||||
if(untag<word>(obj)->subprimitive == F)
|
||||
if(myvm->untag<word>(obj)->subprimitive == F)
|
||||
return true;
|
||||
break;
|
||||
case QUOTATION_TYPE:
|
||||
|
|
|
@ -64,20 +64,9 @@ template <typename TYPE> TYPE *factorvm::untag_check(cell value)
|
|||
return tagged<TYPE>(value).untag_check(this);
|
||||
}
|
||||
|
||||
template <typename TYPE> TYPE *untag_check(cell value)
|
||||
{
|
||||
return vm->untag_check<TYPE>(value);
|
||||
}
|
||||
|
||||
template <typename TYPE> TYPE *factorvm::untag(cell value)
|
||||
{
|
||||
return tagged<TYPE>(value).untagged();
|
||||
}
|
||||
|
||||
template <typename TYPE> TYPE *untag(cell value)
|
||||
{
|
||||
return vm->untag<TYPE>(value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,11 +11,6 @@ void *factorvm::safe_malloc(size_t size)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
void *safe_malloc(size_t size)
|
||||
{
|
||||
return vm->safe_malloc(size);
|
||||
}
|
||||
|
||||
vm_char *factorvm::safe_strdup(const vm_char *str)
|
||||
{
|
||||
vm_char *ptr = STRDUP(str);
|
||||
|
@ -23,10 +18,6 @@ vm_char *factorvm::safe_strdup(const vm_char *str)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
vm_char *safe_strdup(const vm_char *str)
|
||||
{
|
||||
return vm->safe_strdup(str);
|
||||
}
|
||||
|
||||
/* We don't use printf directly, because format directives are not portable.
|
||||
Instead we define the common cases here. */
|
||||
|
@ -40,10 +31,6 @@ void factorvm::print_string(const char *str)
|
|||
fputs(str,stdout);
|
||||
}
|
||||
|
||||
void print_string(const char *str)
|
||||
{
|
||||
return vm->print_string(str);
|
||||
}
|
||||
|
||||
void factorvm::print_cell(cell x)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
namespace factor
|
||||
{
|
||||
void *safe_malloc(size_t size);
|
||||
vm_char *safe_strdup(const vm_char *str);
|
||||
void print_string(const char *str);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue