param-reg-1 R14 [] MOV
R14 cell SUB ;
+: %vm-invoke-2nd-arg ( function -- )
+ param-reg-2 0 MOV rc-absolute-cell rt-vm rel-fixup
+ f %alien-invoke ;
+
+
M:: x86.64 %unbox ( n rep func -- )
! Call the unboxer
- func f %alien-invoke
+ func %vm-invoke-2nd-arg
! Store the return value on the C stack if this is an
! alien-invoke, otherwise leave it the return register if
! this is the end of alien-callback
{ float-regs [ float-regs get pop swap MOVSD ] }
} case ;
+
M: x86.64 %unbox-small-struct ( c-type -- )
! Alien must be in param-reg-1.
- "alien_offset" f %alien-invoke
+ "alien_offset" %vm-invoke-2nd-arg
! Move alien_offset() return value to R11 so that we don't
! clobber it.
R11 RAX MOV
] [
rep load-return-value
] if
- func f %alien-invoke ;
+ func %vm-invoke-2nd-arg ;
M: x86.64 %box-long-long ( n func -- )
[ int-rep ] dip %box ;
param-reg-1 0 MOV rc-absolute-cell rt-vm rel-fixup
f %alien-invoke ;
+
M: x86.64 %vm-invoke-3rd-arg ( function -- )
param-reg-3 0 MOV rc-absolute-cell rt-vm rel-fixup
f %alien-invoke ;
VM_C_API char *unbox_alien(factorvm *myvm)
{
- //printf("PHIL unbox_alien %d %d\n",vm,myvm);fflush(stdout);
+ ASSERTVM();
return VM_PTR->unbox_alien();
}
VM_C_API void to_value_struct(cell src, void *dest, cell size, factorvm *myvm)
{
- //printf("PHIL to_value_struct %d %d\n",vm,myvm);fflush(stdout);
+ ASSERTVM();
return VM_PTR->to_value_struct(src,dest,size);
}
VM_C_API void box_value_struct(void *src, cell size,factorvm *myvm)
{
- //printf("PHIL box_value_struct %d %d\n",vm,myvm);fflush(stdout);
+ ASSERTVM();
return VM_PTR->box_value_struct(src,size);
}
VM_C_API void box_small_struct(cell x, cell y, cell size, factorvm *myvm)
{
- //printf("PHIL box_small_struct %d %d\n",vm,myvm);fflush(stdout);
+ ASSERTVM();
return VM_PTR->box_small_struct(x,y,size);
}
VM_C_API void box_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size, factorvm *myvm)
{
- //printf("PHIL box_medium_struct %d %d\n",vm,myvm);fflush(stdout);
+ ASSERTVM();
return VM_PTR->box_medium_struct(x1, x2, x3, x4, size);
}
VM_ASM_API void inline_gc(cell *gc_roots_base, cell gc_roots_size, factorvm *myvm)
{
+ ASSERTVM();
return VM_PTR->inline_gc(gc_roots_base,gc_roots_size);
}
VM_C_API fixnum to_fixnum(cell tagged,factorvm *myvm)
{
+ ASSERTVM();
return VM_PTR->to_fixnum(tagged);
}
VM_C_API cell to_cell(cell tagged, factorvm *myvm)
{
+ ASSERTVM();
return VM_PTR->to_cell(tagged);
}
VM_C_API float to_float(cell value,factorvm *myvm)
{
+ ASSERTVM();
return VM_PTR->to_float(value);
}
VM_ASM_API cell lazy_jit_compile_impl(cell quot_, stack_frame *stack, factorvm *myvm)
{
+ ASSERTVM();
return VM_PTR->lazy_jit_compile_impl(quot_,stack);
}