vm pointer passed to nest_stacks and unnest_stacks (win32)
							parent
							
								
									cdb6304fef
								
							
						
					
					
						commit
						005549ba43
					
				| 
						 | 
				
			
			@ -437,7 +437,7 @@ M: ##alien-indirect generate-insn
 | 
			
		|||
    ! Generate code for boxing input parameters in a callback.
 | 
			
		||||
    [
 | 
			
		||||
        dup \ %save-param-reg move-parameters
 | 
			
		||||
        "nest_stacks" f %alien-invoke
 | 
			
		||||
        "nest_stacks" %vm-invoke
 | 
			
		||||
        box-parameters
 | 
			
		||||
    ] with-param-regs ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -475,7 +475,7 @@ TUPLE: callback-context ;
 | 
			
		|||
        [ callback-context new do-callback ] %
 | 
			
		||||
    ] [ ] make ;
 | 
			
		||||
 | 
			
		||||
: %unnest-stacks ( -- ) "unnest_stacks" f %alien-invoke ;
 | 
			
		||||
: %unnest-stacks ( -- ) "unnest_stacks" %vm-invoke ;
 | 
			
		||||
 | 
			
		||||
M: ##callback-return generate-insn
 | 
			
		||||
    #! All the extra book-keeping for %unwind is only for x86.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -257,13 +257,13 @@ M: x86.32 %callback-value ( ctype -- )
 | 
			
		|||
    ESP 12 SUB
 | 
			
		||||
    ! Save top of data stack in non-volatile register
 | 
			
		||||
    %prepare-unbox
 | 
			
		||||
    push-vm-ptr
 | 
			
		||||
    EAX PUSH
 | 
			
		||||
    push-vm-ptr
 | 
			
		||||
    ! Restore data/call/retain stacks
 | 
			
		||||
    "unnest_stacks" f %alien-invoke
 | 
			
		||||
    ! Place top of data stack in EAX
 | 
			
		||||
    EAX POP
 | 
			
		||||
    temp-reg POP
 | 
			
		||||
    EAX POP
 | 
			
		||||
    ! Restore C stack
 | 
			
		||||
    ESP 12 ADD
 | 
			
		||||
    ! Unbox EAX
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -615,7 +615,7 @@ M:: x86 %call-gc ( gc-root-count -- )
 | 
			
		|||
    ! Pass number of roots as second parameter
 | 
			
		||||
    param-reg-2 gc-root-count MOV
 | 
			
		||||
    ! Call GC
 | 
			
		||||
    "inline_gc" %vm-invoke ;
 | 
			
		||||
    "inline_gc" %vm-invoke ; ! (PHIL) TODO: vm-invoke won't work with ppc or x86.64. need %vm-invoke-3rd
 | 
			
		||||
 | 
			
		||||
M: x86 %alien-global ( dst symbol library -- )
 | 
			
		||||
    [ 0 MOV ] 2dip rc-absolute-cell rel-dlsym ;    
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -92,8 +92,8 @@ void factorvm::nest_stacks()
 | 
			
		|||
 | 
			
		||||
void nest_stacks(factorvm *myvm)
 | 
			
		||||
{
 | 
			
		||||
	printf("PHIL nest_stacks %d %d\n",vm,myvm);fflush(stdout);
 | 
			
		||||
	return vm->nest_stacks();
 | 
			
		||||
	ASSERTVM();
 | 
			
		||||
	return VM_PTR->nest_stacks();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* called when leaving a compiled callback */
 | 
			
		||||
| 
						 | 
				
			
			@ -113,8 +113,8 @@ void factorvm::unnest_stacks()
 | 
			
		|||
 | 
			
		||||
void unnest_stacks(factorvm *myvm)
 | 
			
		||||
{
 | 
			
		||||
	printf("PHIL unnest_stacks %d %d\n",vm,myvm);fflush(stdout);
 | 
			
		||||
	return vm->unnest_stacks();
 | 
			
		||||
	ASSERTVM();
 | 
			
		||||
	return VM_PTR->unnest_stacks();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* called on startup */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue