! Copyright (C) 2005 Slava Pestov. ! See http://factor.sf.net/license.txt for BSD license. IN: compiler-backend USING: alien arrays assembler compiler inference kernel kernel-internals lists math memory namespaces sequences words ; ! Not used on x86 M: %prologue generate-node drop ; : compile-dlsym ( symbol dll quot -- ) >r 2dup dlsym r> call 1 0 rel-dlsym ; inline : compile-c-call ( symbol dll -- ) [ CALL ] compile-dlsym ; M: %call generate-node ( vop -- ) drop label dup postpone-word dup primitive? [ address-operand ] when CALL ; M: %call-label generate-node ( vop -- ) drop label CALL ; M: %jump generate-node ( vop -- ) drop label dup postpone-word dup primitive? [ address-operand ] when JMP ; M: %jump-label generate-node ( vop -- ) drop label JMP ; M: %jump-t generate-node ( vop -- ) drop ! Compare input with f 0 input-operand f address CMP ! If not equal, jump label JNE ; M: %return-to generate-node ( vop -- ) drop label address-operand PUSH ; M: %return generate-node ( vop -- ) drop RET ; M: %dispatch generate-node ( vop -- ) #! Compile a piece of code that jumps to an offset in a #! jump table indexed by the fixnum at the top of the stack. #! The jump table must immediately follow this macro.