From cc060be1c7528eed96890566d0697e09eedd1369 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 25 Jan 2021 07:39:32 +0700 Subject: [PATCH] Remove assembly fn call optimizations. (#276) These were for old platforms and not used in recent history. There's no NOASMFNCALL flag as there's no more asm fn call code. --- bin/compile-flags | 1 - inc/inln386i.h | 35 -- inc/inln68k.h | 4 - inc/inlnPS2.h | 351 ------------- inc/inlndos.h | 358 -------------- inc/tosfns.h | 59 --- inc/tosret.h | 24 +- inc/version.h | 1 - src/dsp386.il | 1196 --------------------------------------------- src/dspSPARC.il | 150 ------ src/xc.c | 4 - 11 files changed, 1 insertion(+), 2182 deletions(-) diff --git a/bin/compile-flags b/bin/compile-flags index c32e592..b08bced 100755 --- a/bin/compile-flags +++ b/bin/compile-flags @@ -31,7 +31,6 @@ NOASM If true, suppress any attempt to include assembler SUN4_OS4_IL OPDISP PROFILE - and enables NOASMFNCALL C_ONLY SUN4_OS4_IL Try assembler peephole optimizations for SPARC & SunOS4.x SUN3_OS3_IL Try assembler peephole optimizations for 68K & SunOS 3.x diff --git a/inc/inln386i.h b/inc/inln386i.h index 5eb60f0..aea74b3 100755 --- a/inc/inln386i.h +++ b/inc/inln386i.h @@ -224,38 +224,3 @@ addbase_err: \ asm(" movw %ax,%bx"); \ asm(" rorl $16,%ebx"); \ nextop1; } - - -/***********/ -/* Fast function call */ - -#undef FN0 -#define FN0 fast_FN0() - -#undef FN1 -#define FN1 fast_FN1() - -#undef FN2 -#define FN2 fast_FN2() - -#undef FN3 -#define FN3 fast_FN3() - -#undef FN4 -#define FN4 fast_FN4() - -#undef FN5 -#define FN5 fast_FN5() - -#undef FN6 -#define FN6 fast_FN6() - -#undef FN7 -#define FN7 fast_FN7() - -#undef FN8 -#define FN8 fast_FN8() - -#undef FN9 -#define FN9 fast_FN9() - diff --git a/inc/inln68k.h b/inc/inln68k.h index 696bb8e..be7eba9 100755 --- a/inc/inln68k.h +++ b/inc/inln68k.h @@ -40,10 +40,6 @@ #undef NTYPEX #undef TYPEP #undef SWAP_WORDS -/* -#undef FN3 -#undef RETURN -*/ #define SWAP_WORDS(x) swapx(x) diff --git a/inc/inlnPS2.h b/inc/inlnPS2.h index f9b1c0f..428463e 100755 --- a/inc/inlnPS2.h +++ b/inc/inlnPS2.h @@ -695,354 +695,3 @@ extern inline void fast_op_addbase(LispPTR value) asm(" rorl $16,%ebx"); \ nextop1; } - -/***********/ -/* Fast function call */ -#define asm_label_check_interrupt() asm volatile("check_interrupt:"); - -/* * These are the pieces of the function-call code. lbl is the label - to use to defeat the dead-code eliminator, lpfx is the string to - be used to disambiguate interior labels in the asm code, and nargs - is the number of args in this FN call (e.g. FN0 => 0) */ - -#define fn_section1(lbl,lpfx,nargs) \ - struct fnhead *LOCFNCELL; \ - int defcell_word; \ - int NEXTBLOCK; \ - int result; \ - int RESTARGS; \ - asm volatile(" \n\ - movl %%esi,%%eax // fn_atom_index = \n\ - xorb $3,%%al // get_AtomNo_PCMAC1 \n\ - movzbl (%%eax),%%edx \n\ - sall $16,%%edx \n\ - leal 1(%%esi),%%eax \n\ - xorb $3,%%al \n\ - movb (%%eax),%%dh \n\ - leal 2(%%esi),%%eax \n\ - xorb $3,%%al \n\ - movb (%%eax),%%dl \n\ - movl %%edx,%0 // fn_atom_index is in edx now. \n\ - " : "=g" (fn_atom_index) : : "ax", "cx", "dx"); \ - -#define fnx_section1(lbl,lpfx,nargs) \ - struct fnhead *LOCFNCELL; \ - int defcell_word; \ - int NEXTBLOCK; \ - int result, num_args; \ - int RESTARGS; \ - asm volatile(" \n\ - leal 0(%%esi),%%eax \n\ - xorb $3,%%al \n\ - movzbl (%%eax),%%edx \n\ - movl %%edx,%1 // num_args = Get_Byte_PCMAC1; \n\ - leal 1(%%esi),%%eax // fn_atom_index = \n\ - xorb $3,%%al // get_AtomNo_PCMAC1 \n\ - movzbl (%%eax),%%edx \n\ - sall $16,%%edx \n\ - leal 2(%%esi),%%eax \n\ - xorb $3,%%al \n\ - movb (%%eax),%%dh \n\ - leal 3(%%esi),%%eax \n\ - xorb $3,%%al \n\ - movb (%%eax),%%dl \n\ - movl %%edx,%0 // fn_atom_index is in edx now. \n\ - " : "=g" (fn_atom_index), "=g" (num_args) : : "ax", "cx", "dx"); \ - -#define fn_section1a(lbl,lpfx,nargs) \ - asm volatile(" \n\ - testl $16711680,%%edx \n\ - je ." lpfx "118 \n\ - addl %%edx,%%edx // new atom case \n\ - addl Lisp_world,%%edx \n\ - addl $8,%%edx \n\ - jmp ." lpfx "119 \n\ - .align 4 \n\ -." lpfx "118: \n\ - sall $2,%%edx \n\ - addl Defspace,%%edx \n\ -." lpfx "119: \n\ - movl %%edx,%0 // to -92 \n\ - " : "=g" (fn_defcell) : "g" (fn_atom_index) : "ax", "cx", "dx"); \ - \ - asm volatile(" \n\ - movl (%%edx),%%eax \n\ - movl %%eax,%0 // to -32 (must remain, it's used by C below) \n\ - testl %%eax,%%eax // if defcell_word>0 \n\ - jnl ." lpfx "120 \n\ - testl $0x4000000,%%eax / check for needs-byte-swapping \n\ - jnz ." lpfx "swap / if so, go do it out of line. \n\ - " : "=g" (defcell_word) : "g" (fn_defcell) : "ax", "dx"); \ -lbl: \ - asm volatile(" \n\ -/ .align 4 / this isn't usually the target of a branch. \n\ - andl $16777215,%%eax \n\ - movl %%eax,%1 \n\ - addl %%eax,%%eax \n\ - addl Lisp_world,%%eax \n\ - movl %%eax,%0 // to -80 \n\ - " : "=g" (LOCFNCELL), "=g" (defcell_word) : : "cx"); \ - \ - asm volatile(" \n\ - movw MachineState+20,%%dx // currentfx pc = \n\ - incw %%dx \n\ - movl %%esi,%%ecx // PCMAC - \n\ - subw %%dx,%%cx // funcobj \n\ - addw $4,%%cx // + opcode size \n\ - movl MachineState+4,%%edx \n\ - movw %%cx,-12(%%edx) // save in frame \n\ - movzwl 2(%%eax),%%edx \n\ - addl %%edx,%%edx \n\ - movl MachineState+32,%%eax \n\ - subl %%edx,%%eax \n\ - movl %%eax,MachineState+28 // Irq_Stk_Check = \n\ - cmpl %%eax,%%edi \n\ - jg check_interrupt //goto check_interrupt \n\ - " : : "g" (LOCFNCELL) : "ax", "dx", "cx"); - -#define fn_section2(lpfx) \ - asm volatile(" \n\ - movl %%ecx,MachineState \n\ - subl Stackspace,%%ecx \n\ - shrl $1,%%ecx // NEXTBLOCK in -88 \n\ - movl %%ecx,%0 \n\ - movl MachineState+4,%%edx \n\ - movw %%cx,-10(%%edx) // currentfx->nextblock = \n\ - movl %%ebx,(%%edi) // HARD_PUSH tos \n\ - addl $4,%%edi \n\ - " : "=g" (NEXTBLOCK) : : "ax", "dx", "cx"); \ - \ - asm volatile(" \n\ - movl %1,%%ecx // if LOCFNCELL->na \n\ - cmpw $0,(%%ecx) // >= 0 \n\ - jl ." lpfx "122 \n\ - // then \n\ - movswl (%%ecx),%%ecx // RESTARGS = #args(0) \n\ - " : "=g" (RESTARGS) : "g" (LOCFNCELL) : "ax", "dx", "cx"); - - /* Between these sections comes some code that subtracts */ - /* the true arg count from %ecx. It's safe to use eax if you need it */ - -#define fn_section3(lpfx,nargs) \ - asm volatile(" \n\ - jle ." lpfx "124 // if < 0, skip loop. \n\ - .align 4 \n\ -." lpfx "125: // while RESTARGS<0 \n\ - xorl %%eax,%%eax // storing NILs \n\ - cld // so stosl increments edi \n\ - rep // repeat for ecx count \n\ - stosl // store them. \n\ -." lpfx "124: \n\ - sall $2,%%ecx // RESTARGS \n\ - addl %%ecx,%%edi // ecx is <= 0 here.... \n\ - " : "=g" (RESTARGS) : "g" (LOCFNCELL) : "ax", "dx", "cx"); \ - \ - asm volatile(" \n\ -." lpfx "122: // na <0 ?? \n\ - movl %1,%%ecx // HARDPUSH(BFMARK | NEXTBLOCK) \n\ - orl $-2147483648,%%ecx \n\ - movl %%ecx,(%%edi) \n\ - movl MachineState+4,%%edx // * CSTKPTR = \n\ - subl Stackspace,%%edx // FXMARK<<16 | \n\ - shrl $1,%%edx // StkOffsetfrom68k(PVAR). \n\ - orl $-1073741824,%%edx \n\ - movl %%edx,4(%%edi) \n\ - \n\ - movl %3,%%eax // fnheader = \n\ - roll $16,%%eax // swapx(defcell_word) \n\ - movl %%eax,8(%%edi) \n\ - leal 24(%%edi),%%edi // CSTKPTRL = \n\ - movl %%edi,MachineState+4 // PVAR = CSTKPTR \n\ - \n\ - movl %2,%%edx // result = \n\ - movswl 6(%%edx),%%ecx // LOCFNCELL->pv \n\ - incl %%ecx // pv is (# of quadwords)-1, so inc it. \n\ - shll $1,%%ecx // and * 2 to get 32-bit words worth \n\ - cld // so stosl increments edi \n\ - movl $-1,%%eax // The UNBOUND_VALUE to be pushed \n\ - rep \n\ - stosl \n\ -." lpfx "127: \n\ - leal 4(%%edi),%%edi // CSTKPTRL += 1 \n\ - movl %2,%%ecx // PCMACL = LOCFNCELL \n\ - movzwl 4(%%ecx),%%ecx // + LOCFNCELL-> startpc \n\ - movl %2,%%edx \n\ - leal 1(%%ecx,%%edx),%%edx \n\ - movl %%edx,%%esi //replace above 2 inst \n\ - movl %2,%%eax //FuncObj = LOCFNCELL \n\ - movl %%eax,MachineState+20 \n\ - " : "=&g" (result) : "g" (NEXTBLOCK), "g" (LOCFNCELL), \ - "g" (defcell_word) : "ax", "dx", "cx"); \ - \ - fast0_dispatcher(); /* can't be nextop0, or the following */ \ - /* code winds up dead and removed. */ \ - asm volatile(" \n\ - .align 4 \n\ -." lpfx "swap: / Come here if we need to byte-swap the fn \n\ - pushl %%eax \n\ - pushl %%eax \n\ - call byte_swap_code_block / swap it \n\ - popl %%eax \n\ - popl %%eax \n\ - jmp %l0" : : "" (&&lbl)); \ - asm volatile(" \n\ - .align 4 \n\ -." lpfx "swap: / Come here if we need to byte-swap the fn \n\ - call byte_swap_ \n\ -." lpfx "120:"); - - -#define fn_section4(nargs) \ - { /* it's not a CCODEP */ \ - fn_num_args = nargs /* argcount*/; \ - fn_opcode_size = FN_OPCODE_SIZE; \ - fn_apply = 0; \ - goto op_fn_common; \ - } \ - - - -#undef FN0 -#define FN0 \ - { \ - fn_section1(L0120,"0",0); \ - fn_section1a(L0120,"0",0); \ - asm volatile(" \n\ - leal 4(%edi),%ecx // newivar = CSTKPTR-argcount+1"); \ - fn_section2("0"); \ - /* decl %%ecx's would go here, 1 per arg */ \ - fn_section3("0",0); \ - fn_section4(0); \ - } - - -#undef FN1 -#define FN1 \ - { \ - fn_section1(L1120,"1",1); \ - fn_section1a(L1120,"1",1); \ - asm volatile(" \n\ - leal (%edi),%ecx // newivar = CSTKPTR-argcount+1"); \ - fn_section2("1"); \ - asm volatile("decl %ecx"); \ - fn_section3("1",1); \ - fn_section4(1); \ - } - -#undef FN2 -#define FN2 \ - { \ - fn_section1(L2120,"2",2); \ - fn_section1a(L2120,"2",2); \ - asm volatile(" \n\ - leal -4(%edi),%ecx // newivar = CSTKPTR-argcount+1"); \ - fn_section2("2"); \ - asm volatile("subl $2,%ecx"); \ - fn_section3("2",2); \ - fn_section4(2); \ - } - -#undef FN3 -#define FN3 \ - { \ - fn_section1(L3120,"3",3); \ - fn_section1a(L3120,"3",3); \ - asm volatile(" \n\ - leal -8(%edi),%ecx // newivar = CSTKPTR-argcount+1"); \ - fn_section2("3"); \ - asm volatile("subl $3,%ecx"); \ - fn_section3("3",3); \ - fn_section4(3); \ - } - - -#undef FN4 -#define FN4 \ - { \ - fn_section1(L4120,"4",4); \ - fn_section1a(L4120,"4",4); \ - asm volatile(" \n\ - leal -12(%edi),%ecx // newivar = CSTKPTR-argcount+1"); \ - fn_section2("4"); \ - asm volatile("subl $4,%ecx"); \ - fn_section3("4",4); \ - fn_section4(4); \ - } - -#undef xFNX -#define xFNX \ - { \ - fnx_section1(Lx120,"x",4); \ - fn_section1a(Lx120,"x",4); \ - asm volatile(" \n\ - movl %0,%%eax // get num_args \n\ - leal -4(,%%eax,4),%%eax \n\ - negl %%eax \n\ - leal (%%edi,%%eax),%%ecx // newivar = CSTKPTR-argcount+1" : : "g" (num_args)); \ - fn_section2("x"); \ - asm volatile("subl %0,%%ecx" : : "g" (num_args)); \ - fn_section3("x",4); \ - { /* it's not a CCODEP */ \ - fn_num_args = num_args; /* argcount*/ \ - fn_opcode_size = FNX_OPCODE_SIZE; \ - fn_apply = 0; \ - goto op_fn_common; \ - } \ - } - - - - - -/************************************************************************/ -/* */ -/* o p r e t u r n */ -/* */ -/* Inline version of the RETURN opcode. */ -/* */ -/************************************************************************/ - -inline const extern void opreturn() - { - asm volatile(" \n\ - movl MachineState+4,%%edx \n\ - movzwl -20(%%edx),%%edx \n\ - testb $1,%%dl \n\ - jne opret_fail \n\ - movl MachineState,%%edi \n\ - movl Stackspace,%%ecx \n\ - leal 0(%%ecx,%%edx,2),%%eax \n\ - movl %%eax,MachineState+4 \n\ - leal -22(%%eax),%%edx \n\ - xorb $2,%%dl \n\ - movzwl (%%edx),%%edx \n\ - leal 0(%%ecx,%%edx,2),%%edx \n\ - movl %%edx,MachineState \n\ - movl -16(%%eax),%%ecx \n\ - roll $16,%%ecx \n\ - andl $16777215,%%ecx \n\ - addl %%ecx,%%ecx \n\ - addl Lisp_world,%%ecx \n\ - movl %%ecx,MachineState+20 \n\ - movzwl -12(%%eax),%%eax \n\ - leal 1(%%eax,%%ecx),%%esi \n\ - movzwl 2(%%ecx),%%edx \n\ - addl %%edx,%%edx \n\ - movl MachineState+24,%%eax \n\ - subl %%edx,%%eax \n\ - movl %%eax,MachineState+28 \n\ - cmpl %%eax,%%edi \n\ - jg check_interrupt \n\ - cmpl $0,MachineState+32 \n\ - jle check_interrupt \n\ - movl MachineState+24,%%ecx \n\ - movl %%ecx,MachineState+32 \n\ - \n\ - leal -1(%%esi),%%eax \n\ - xorb $3,%%al \n\ - movzbl (%%eax),%%eax \n\ - jmp *optable(,%%eax,4) \n\ - \n\ - .align 4 \n\ -opret_fail:" : : : "ax", "dx", "cx"); - } diff --git a/inc/inlndos.h b/inc/inlndos.h index 1d537a3..78d1c4d 100755 --- a/inc/inlndos.h +++ b/inc/inlndos.h @@ -701,361 +701,3 @@ extern inline void fast_op_addbase(LispPTR value) asm(" ror ebx,16"); \ nextop1; } - - -#ifdef NOTYET -TO FIX FIXME: Need to fix instruction names, and operand order. -TO FIX FIXME: $constant -> constant, (edi) -> [edi], - -/***********/ -/* Fast function call */ -#define asm_label_check_interrupt() asm volatile("check_interrupt:"); - -/* * These are the pieces of the function-call code. lbl is the label - to use to defeat the dead-code eliminator, lpfx is the string to - be used to disambiguate interior labels in the asm code, and nargs - is the number of args in this FN call (e.g. FN0 => 0) */ - -#define fn_section1(lbl,lpfx,nargs) \ - struct fnhead *LOCFNCELL; \ - int defcell_word; \ - int NEXTBLOCK; \ - int result; \ - int RESTARGS; \ - asm volatile(" \n\ - mov eax,esi // fn_atom_index = \n\ - xor al,3 // get_AtomNo_PCMAC1 \n\ - movz edx, byte ptr [eax] \n\ - sal edx,16 \n\ - leal eax,1[esi] \n\ - xorb al,3 \n\ - movb dh,[eax] \n\ - leal eax,2[esi] \n\ - xorb al,3 \n\ - movb dl,[eax] \n\ - movl %0,edx // fn_atom_index is in edx now. \n\ - " : "=g" (fn_atom_index) : : "ax", "cx", "dx"); \ - -#define fnx_section1(lbl,lpfx,nargs) \ - struct fnhead *LOCFNCELL; \ - int defcell_word; \ - int NEXTBLOCK; \ - int result, num_args; \ - int RESTARGS; \ - asm volatile(" \n\ - lea eax,0[esi] \n\ - xor al,3 \n\ - movz edx, byte ptr [eax] \n\ - mov %1,edx // num_args = Get_Byte_PCMAC1; \n\ - lea eax,1[esi] // fn_atom_index = \n\ - xor al,$3 // get_AtomNo_PCMAC1 \n\ - movz edx, byte ptr [eax] \n\ - sal edx,16 \n\ - lea eax,2[esi] \n\ - xor al,3 \n\ - mov dh, byte ptr [eax] \n\ - lea eax,3[esi] \n\ - xor al,3 \n\ - mov dl, byte ptr [eax] \n\ - mov %0,edx // fn_atom_index is in edx now. \n\ - " : "=g" (fn_atom_index), "=g" (num_args) : : "ax", "cx", "dx"); \ - -#define fn_section1a(lbl,lpfx,nargs) \ - asm volatile(" \n\ - test edx,16711680 \n\ - je ." lpfx "118 \n\ - add edx,edx // new atom case \n\ - add edx, dword ptr Lisp_world \n\ - add edx,8 \n\ - jmp ." lpfx "119 \n\ - .align 4 \n\ -." lpfx "118: \n\ - sal edx,2 \n\ - add edx, dword ptr Defspace \n\ -." lpfx "119: \n\ - mov %0,edx // to -92 \n\ - " : "=g" (fn_defcell) : "g" (fn_atom_index) : "ax", "cx", "dx"); \ - \ - asm volatile(" \n\ - movl eax,(edx) \n\ - movl %0,eax // to -32 (must remain, it's used by C below) \n\ - testl eax,eax // if defcell_word>0 \n\ - jnl ." lpfx "120 \n\ - testl eax,$0x4000000 / check for needs-byte-swapping \n\ - jnz ." lpfx "swap / if so, go do it out of line. \n\ - " : "=g" (defcell_word) : "g" (fn_defcell) : "ax", "dx"); \ -lbl: \ - asm volatile(" \n\ -/ .align 4 / this isn't usually the target of a branch. \n\ - andl eax,$16777215 \n\ - movl %1,eax \n\ - addl eax,eax \n\ - addl eax,Lisp_world \n\ - movl %0,eax // to -80 \n\ - " : "=g" (LOCFNCELL), "=g" (defcell_word) : : "cx"); \ - \ - asm volatile(" \n\ - movw MachineState+20,dx // currentfx pc = \n\ - incw dx \n\ - movl esi,ecx // PCMAC - \n\ - subw dx,cx // funcobj \n\ - addw $4,cx // + opcode size \n\ - movl MachineState+4,edx \n\ - movw cx,-12(edx) // save in frame \n\ - movzwl 2(eax),edx \n\ - addl edx,edx \n\ - movl MachineState+32,eax \n\ - subl edx,eax \n\ - movl eax,MachineState+28 // Irq_Stk_Check = \n\ - cmpl eax,edi \n\ - jg check_interrupt //goto check_interrupt \n\ - " : : "g" (LOCFNCELL) : "ax", "dx", "cx"); - -#define fn_section2(lpfx) \ - asm volatile(" \n\ - movl ecx,MachineState \n\ - subl Stackspace,ecx \n\ - shrl $1,ecx // NEXTBLOCK in -88 \n\ - movl ecx,%0 \n\ - movl MachineState+4,edx \n\ - movw cx,-10(edx) // currentfx->nextblock = \n\ - movl ebx,(edi) // HARD_PUSH tos \n\ - addl $4,edi \n\ - " : "=g" (NEXTBLOCK) : : "ax", "dx", "cx"); \ - \ - asm volatile(" \n\ - movl %1,ecx // if LOCFNCELL->na \n\ - cmpw $0,(ecx) // >= 0 \n\ - jl ." lpfx "122 \n\ - // then \n\ - movswl (ecx),ecx // RESTARGS = #args(0) \n\ - " : "=g" (RESTARGS) : "g" (LOCFNCELL) : "ax", "dx", "cx"); - - /* Between these sections comes some code that subtracts */ - /* the true arg count from %ecx. It's safe to use eax if you need it */ - -#define fn_section3(lpfx,nargs,lbl) \ - asm volatile(" \n\ - jle ." lpfx "124 // if < 0, skip loop. \n\ - .align 4 \n\ -." lpfx "125: // while RESTARGS<0 \n\ - xorl eax,eax // storing NILs \n\ - cld // so stosl increments edi \n\ - rep // repeat for ecx count \n\ - stosl // store them. \n\ -." lpfx "124: \n\ - sall $2,ecx // RESTARGS \n\ - addl ecx,edi // ecx is <= 0 here.... \n\ - " : "=g" (RESTARGS) : "g" (LOCFNCELL) : "ax", "dx", "cx"); \ - \ - asm volatile(" \n\ -." lpfx "122: // na <0 ?? \n\ - movl %1,ecx // HARDPUSH(BFMARK | NEXTBLOCK) \n\ - orl $-2147483648,ecx \n\ - movl ecx,(edi) \n\ - movl MachineState+4,edx // * CSTKPTR = \n\ - subl Stackspace,edx // FXMARK<<16 | \n\ - shrl $1,edx // StkOffsetfrom68k(PVAR). \n\ - orl $-1073741824,edx \n\ - movl edx,4(edi) \n\ - \n\ - movl %3,eax // fnheader = \n\ - roll $16,eax // swapx(defcell_word) \n\ - movl eax,8(edi) \n\ - leal 24(edi),edi // CSTKPTRL = \n\ - movl edi,MachineState+4 // PVAR = CSTKPTR \n\ - \n\ - movl %2,edx // result = \n\ - movswl 6(edx),ecx // LOCFNCELL->pv \n\ - incl ecx // pv is (# of quadwords)-1, so inc it. \n\ - shll $1,ecx // and * 2 to get 32-bit words worth \n\ - cld // so stosl increments edi \n\ - movl $-1,eax // The UNBOUND_VALUE to be pushed \n\ - rep \n\ - stosl \n\ -." lpfx "127: \n\ - leal 4(edi),edi // CSTKPTRL += 1 \n\ - movl %2,ecx // PCMACL = LOCFNCELL \n\ - movzwl 4(ecx),ecx // + LOCFNCELL-> startpc \n\ - movl %2,edx \n\ - leal 1(ecx,edx),edx \n\ - movl edx,esi //replace above 2 inst \n\ - movl %2,eax //FuncObj = LOCFNCELL \n\ - movl eax,MachineState+20 \n\ - " : "=&g" (result) : "g" (NEXTBLOCK), "g" (LOCFNCELL), \ - "g" (defcell_word) : "ax", "dx", "cx"); \ - \ - fast0_dispatcher(); /* can't be nextop0, or the following */ \ - /* code winds up dead and removed. */ \ - asm volatile(" \n\ - .align 4 \n\ -." lpfx "swap: / Come here if we need to byte-swap the fn \n\ - pushl eax \n\ - pushl eax \n\ - call byte_swap_code_block / swap it \n\ - popl eax \n\ - popl eax \n\ - jmp %l0" : : "" (&&lbl)); \ - asm volatile(" \n\ - .align 4 \n\ -." lpfx "swap: / Come here if we need to byte-swap the fn \n\ - call byte_swap_ -." lpfx "120:"); - - -#define fn_section4(nargs) \ - { /* it's not a CCODEP */ \ - fn_num_args = nargs /* argcount*/; \ - fn_opcode_size = FN_OPCODE_SIZE; \ - fn_apply = 0; \ - goto op_fn_common; \ - } \ - - - -#undef FN0 -#define FN0 \ - { \ - fn_section1(L0120,"0",0); \ - fn_section1a(L0120,"0",0); \ - asm volatile(" \n\ - leal 4(%edi),%ecx // newivar = CSTKPTR-argcount+1"); \ - fn_section2("0"); \ - /* decl ecx's would go here, 1 per arg */ \ - fn_section3("0",0,L0120); \ - fn_section4(0); \ - } - - -#undef FN1 -#define FN1 \ - { \ - fn_section1(L1120,"1",1); \ - fn_section1a(L1120,"1",1); \ - asm volatile(" \n\ - leal (%edi),%ecx // newivar = CSTKPTR-argcount+1"); \ - fn_section2("1"); \ - asm volatile("decl %ecx"); \ - fn_section3("1",1,L1120); \ - fn_section4(1); \ - } - -#undef FN2 -#define FN2 \ - { \ - fn_section1(L2120,"2",2); \ - fn_section1a(L2120,"2",2); \ - asm volatile(" \n\ - leal -4(%edi),%ecx // newivar = CSTKPTR-argcount+1"); \ - fn_section2("2"); \ - asm volatile("subl $2,%ecx"); \ - fn_section3("2",2,L2120); \ - fn_section4(2); \ - } - -#undef FN3 -#define FN3 \ - { \ - fn_section1(L3120,"3",3); \ - fn_section1a(L3120,"3",3); \ - asm volatile(" \n\ - leal -8(%edi),%ecx // newivar = CSTKPTR-argcount+1"); \ - fn_section2("3"); \ - asm volatile("subl $3,%ecx"); \ - fn_section3("3",3,L3120); \ - fn_section4(3); \ - } - - -#undef FN4 -#define FN4 \ - { \ - fn_section1(L4120,"4",4); \ - fn_section1a(L4120,"4",4); \ - asm volatile(" \n\ - leal -12(%edi),%ecx // newivar = CSTKPTR-argcount+1"); \ - fn_section2("4"); \ - asm volatile("subl $4,%ecx"); \ - fn_section3("4",4,L4120); \ - fn_section4(4); \ - } - -#undef xFNX -#define xFNX \ - { \ - fnx_section1(Lx120,"x",4); \ - fn_section1a(Lx120,"x",4); \ - asm volatile(" \n\ - movl %0,eax // get num_args \n\ - leal -4(,eax,4),eax \n\ - negl eax \n\ - leal (edi,eax),ecx // newivar = CSTKPTR-argcount+1" : : "g" (num_args)); \ - fn_section2("x"); \ - asm volatile("subl %0,ecx" : : "g" (num_args)); \ - fn_section3("x",4,Lx120); \ - { /* it's not a CCODEP */ \ - fn_num_args = num_args; /* argcount*/ \ - fn_opcode_size = FNX_OPCODE_SIZE; \ - fn_apply = 0; \ - goto op_fn_common; \ - } \ - } - - - - - -/************************************************************************/ -/* */ -/* o p r e t u r n */ -/* */ -/* Inline version of the RETURN opcode. */ -/* */ -/************************************************************************/ - -inline extern void opreturn() - { - asm volatile(" \n\ - movl MachineState+4,edx \n\ - movzwl -20(edx),edx \n\ - testb $1,dl \n\ - jne opret_fail \n\ - movl MachineState,edi \n\ - movl Stackspace,ecx \n\ - leal 0(ecx,edx,2),eax \n\ - movl eax,MachineState+4 \n\ - leal -22(eax),edx \n\ - xorb $2,dl \n\ - movzwl (edx),edx \n\ - leal 0(ecx,edx,2),edx \n\ - movl edx,MachineState \n\ - movl -16(eax),ecx \n\ - roll $16,ecx \n\ - andl $16777215,ecx \n\ - addl ecx,ecx \n\ - addl Lisp_world,ecx \n\ - movl ecx,MachineState+20 \n\ - movzwl -12(eax),eax \n\ - leal 1(eax,ecx),esi \n\ - movzwl 2(ecx),edx \n\ - addl edx,edx \n\ - movl MachineState+24,eax \n\ - subl edx,eax \n\ - movl eax,MachineState+28 \n\ - cmpl eax,edi \n\ - jg check_interrupt \n\ - cmpl $0,MachineState+32 \n\ - jle check_interrupt \n\ - movl MachineState+24,ecx \n\ - movl ecx,MachineState+32 \n\ - \n\ - leal -1(esi),eax \n\ - xorb $3,al \n\ - movzbl (eax),eax \n\ - jmp *optable(,eax,4) \n\ - \n\ - .align 4 \n\ -opret_fail:" : : : "ax", "dx", "cx"); - } - -#endif NEVER diff --git a/inc/tosfns.h b/inc/tosfns.h index 49848ac..7320fd9 100755 --- a/inc/tosfns.h +++ b/inc/tosfns.h @@ -46,15 +46,6 @@ #endif /* BIGVM */ - -#ifdef GCC386 -#define ASM_LABEL_OF_FN_COMMON asm("fn_common:"); -#else -#define ASM_LABEL_OF_FN_COMMON -#endif /* GCC386 */ - - - /************************************************************************/ /* */ /* A P P L Y _ P O P _ P U S H _ T E S T */ @@ -196,53 +187,6 @@ /****** OPFN(x) ********/ /****************************************************************/ -#if (defined(SUN3_OS3_OR_OS4_IL) && !(defined(NOASMFNCALL)) ) - -#define OPFN(x, num_args_fn, fn_xna_args, fn_native) \ -{ /* asm inlines for fn call (much care put into keeping optimizer \ - from moving things around). */ \ - fn_section1(); \ - fn_section2(); \ - num_args_fn(); \ - fn_section3(); \ - fn_xna_args(); \ - fn_section4(); \ - fast1_dispatcher(); /* nextop0 don't work here */ \ - fn_section5(); \ - /* asm code jumps here when not ccodep */ \ - { fn_atom_index = Get_AtomNo_PCMAC1; \ - fn_defcell = (DefCell *) GetDEFCELL68k(fn_atom_index); \ - fn_num_args = x; \ - fn_opcode_size = FN_OPCODE_SIZE; \ - fn_apply = 0; \ - goto op_fn_common; \ - } \ -} - -#define OPFNX \ -{ /* asm inlines for fn call (much care put into keeping optimizer \ - from moving things around. */ \ - fnx_section1(); \ - fn_section2(); \ - fnx_args(); \ - fn_section3(); \ - fnx_xna(); \ - fn_section4(); \ - fast1_dispatcher(); /* nextop0 don't work here */ \ - fn_section5(); \ - fn_atom_index = Get_AtomNo_PCMAC2; \ - fn_defcell = (DefCell *) GetDEFCELL68k(fn_atom_index); \ - fn_num_args = Get_BYTE_PCMAC1; \ - fn_opcode_size = FNX_OPCODE_SIZE; \ - fn_apply = 0; \ - goto op_fn_common; \ - /* *** these carefully arranged to satisfy optimizer */ \ -label1: fast1_dispatcher(); \ - \ -} - -#else - #define OPFN(argcount, num_args_fn, fn_xna_args, fn_native) \ { /* argcount is a number of the arguments on stack */ \ register struct fnhead *LOCFNCELL; \ @@ -375,8 +319,6 @@ label1: fast1_dispatcher(); \ FuncObj = LOCFNCELL; \ } /* end OPFN */ -#endif /* NOASMFNCALL */ - @@ -436,7 +378,6 @@ op_ufn: use code in XC.c \ #define needpush NEXTBLOCK #define OP_FN_COMMON \ op_fn_common: \ - ASM_LABEL_OF_FN_COMMON; \ { register struct fnhead *LOCFNCELL; \ register DefCell *defcell; /* this reg is not allocated */ \ CClosure *closure; \ diff --git a/inc/tosret.h b/inc/tosret.h index 19fd2b6..16e7b2c 100644 --- a/inc/tosret.h +++ b/inc/tosret.h @@ -17,31 +17,10 @@ /* */ /* t o s r e t m a c r o . h */ /* */ -/* Implements RETURN for the inner evaluation loop. There are */ -/* two versions--one for when hand optimization has been done, */ -/* and one for the naive case. To use the hand-optimization */ -/* version, you'll need to define an inline function or macro */ -/* called opreturn(). It must fall thru if alink is odd, but */ -/* must handle all other cases. You can rely on check_interrupt */ -/* being a defined label. */ +/* Implements RETURN for the inner evaluation loop. */ /* */ /************************************************************************/ -#if ((defined(ISC) || defined(SUN3_OS3_OR_OS4_IL)) && !(defined(NOASMFNCALL)) ) - -/* JDS 22 May 96 CSTKPTR >- Irq... was just >, but got overflows with last - frame right against endofstack, causing 0-long free blocks, inf loops... */ -#define OPRETURN \ -{ opreturn(); \ - EXT; if(slowreturn()) goto stackoverflow_help; RET; \ - Irq_Stk_Check = STK_END_COMPUTE(EndSTKP,FuncObj); \ - if (((UNSIGNED)(CSTKPTR) >= Irq_Stk_Check) || (Irq_Stk_End <= 0)) \ - { goto check_interrupt; } \ - Irq_Stk_End = (UNSIGNED) EndSTKP; \ - } - -#else - #define OPRETURN { \ register struct frameex2 *returnFX ; \ register int alink; \ @@ -75,5 +54,4 @@ retxit: {} \ } /* OPRETURN end */ -#endif #endif /* TOSRET_H */ diff --git a/inc/version.h b/inc/version.h index bfe1582..698ead1 100644 --- a/inc/version.h +++ b/inc/version.h @@ -186,7 +186,6 @@ error Must specify RELEASE to build Medley. #undef SUN4_OS4_IL #undef OPDISP #undef PROFILE -#define NOASMFNCALL 1 #endif #ifdef SUN3_OS3_IL diff --git a/src/dsp386.il b/src/dsp386.il index 7aede19..1556362 100755 --- a/src/dsp386.il +++ b/src/dsp386.il @@ -428,1199 +428,3 @@ idiffn_err: moveq #0,d7 115$: .end - -///////////////////////////////////////////////////////////////// -/// -/// F U N C T I O N C A L L S P E E D - U P S -/// -///////////////////////////////////////////////////////////////// - - -.inline fast_FN0,0 - cld // so we can use string instructions - leal 1(%edi),%edx - xorl $3,%edx - movzbl (%edx),%eax - leal 0(%edi),%edx - xorl $3,%edx - movb (%edx),%ah - leal (,%eax,4),%eax - addl Defspace,%eax - movl (%eax),%edx - testl %edx,%edx - jl .LFN0ccode - movl %eax,-12(%ebp) - movl $0,-24(%ebp) - movl $3,-20(%ebp) - leal 1(%edi),%edx - xorl $3,%edx - movzbl (%edx),%eax - leal 0(%edi),%edx - xorl $3,%edx - movb (%edx),%ah - movl %eax,-16(%ebp) - movl $0,-28(%ebp) - jmp fn_common -.LFN0ccode: - andl $16777215,%edx - movl %edx,-40(%ebp) - leal (%edx,%edx),%ecx - addl Lisp_world,%ecx - movl MachineState+4,%eax - leal -1(%edi),%edx - subl MachineState+20,%edx - leal 3(%edx),%edx - movw %dx,-12(%eax) - movzwl 2(%ecx),%eax - leal (%eax,%eax),%eax - movl MachineState+32,%edx - subl %eax,%edx - movl %edx,MachineState+28 - cmpl %edx,%esi - jg check_interrupt - xchg %edi,%esi - leal 4(%edi),%eax - movl %eax,MachineState - movl %eax,-48(%ebp) - movl MachineState+4,%eax - movl -48(%ebp),%edx - subl Stackspace,%edx - shrl $1,%edx - movl %edx,-44(%ebp) - movw %dx,-10(%eax) - movl %ebx,(%edi) -/ movl %ecx,%eax - movw (%ecx),%dx - addl $4,%edi - testw %dx,%dx - jl .FN0noarg1 - xorl %eax,%eax -/ movl %ecx,%edx - movswl (%ecx),%edx - subl %edx,%eax - movl %eax,-48(%ebp) - xorl %eax,%eax // for storing NILs. - jmp .FN0argls1 -.FN0arglp1: -/ movl $0,(%edi) -/ addl $4,%edi - stosl - incl -48(%ebp) -.FN0argls1: - cmpl $0,-48(%ebp) - jl .FN0arglp1 - movl -48(%ebp),%eax - leal (,%eax,4),%eax - subl %eax,%edi -.FN0noarg1: -/ movl %edi,%eax - movl -44(%ebp),%eax -/ addl $4,%edi - orl $-2147483648,%eax -/ movl %edx,(%edi) -/ addl $4,%edi - stosl - movl MachineState+4,%eax - subl Stackspace,%eax - shrl $1,%eax - orl $-1073741824,%eax - movl %eax,(%edi) -/ pushl -40(%ebp) - movl -40(%ebp),%eax - rol $16,%eax -/ popl %ecx - movl %eax,4(%edi) - addl $20,%edi - movl %edi,MachineState+4 -/ movl %ecx,%eax - movswl 6(%ecx),%eax - movl %eax,-48(%ebp) - cmpl $0,-48(%ebp) - jl .FN0disp -/ movl $-1,-52(%ebp) -/ movl %edi,%eax - movl $-1,%eax -/ movl %edx,(%edi) -/ addl $4,%edi -/ movl %edx,(%edi) -/ addl $4,%edi - stosl - stosl - cmpl $0,-48(%ebp) - jle .FN0disp -.FNxxalp: -/ movl %edx,(%edi) -/ addl $4,%edi -/ movl %edx,(%edi) -/ addl $4,%edi - stosl - stosl - decl -48(%ebp) -.FN0xalp: - decl -48(%ebp) - jl .FN0disp -/ movl %edi,%eax -/ movl -52(%ebp),%edx -/ movl %edx,(%edi) -/ addl $4,%edi -/ movl %edx,(%edi) -/ addl $4,%edi - stosl - stosl - jmp .FN0xalp -.FN0disp: - movzwl 4(%ecx),%eax - movl %ecx,%edx - addl $4,%edi - addl %eax,%edx - incl %edx - movl %edx,%esi - movl %ecx,MachineState+20 - leal -1(%esi),%eax - xorb $3,%al - xchg %edi,%esi / done using edit to store fast with. - movzbl (%eax),%eax - jmp *optable(,%eax,4) -.end - -.inline fast_FN1,0 - cld // for string instruction use - leal 1(%edi),%edx - xorl $3,%edx - movzbl (%edx),%eax - leal 0(%edi),%edx - xorl $3,%edx - movb (%edx),%ah - movl %eax,%ecx - leal (,%eax,4),%eax - addl Defspace,%eax - movl (%eax),%edx - testl %edx,%edx - jl .FN1ccode - movl %eax,-12(%ebp) - movl $1,-24(%ebp) - movl $3,-20(%ebp) - movl %ecx,-16(%ebp) - movl $0,-28(%ebp) - jmp fn_common -.FN1ccode: -/ movl -40(%ebp),%eax - andl $16777215,%edx - movl %edx,-40(%ebp) - leal (%edx,%edx),%ecx - addl Lisp_world,%ecx -/ movl %eax,%ecx - movl MachineState+4,%eax - leal -1(%edi),%edx - subl MachineState+20,%edx - leal 3(%edx),%edx - movw %dx,-12(%eax) -/ movl %ecx,%eax - movzwl 2(%ecx),%eax - leal (%eax,%eax),%eax - movl MachineState+32,%edx - subl %eax,%edx - movl %edx,MachineState+28 - cmpl %edx,%esi - jg check_interrupt - xchg %edi,%esi -/ movl %edi,%eax - movl %edi,MachineState - movl %edi,-48(%ebp) - movl MachineState+4,%eax - movl %edi,%edx - subl Stackspace,%edx - shrl $1,%edx - movl %edx,-44(%ebp) - movw %dx,-10(%eax) - movl %ebx,(%edi) -/ movl %ecx,%eax - movw (%ecx),%dx - addl $4,%edi - testw %dx,%dx - jl .FN1noarg - movl $1,%eax -/ movl %ecx,%edx - movswl (%ecx),%edx - subl %edx,%eax - movl %eax,-48(%ebp) - xorl %eax,%eax - jmp .FN1lps -.FN1lp1: -/ movl $0,(%edi) -/ addl $4,%edi - stosl - incl -48(%ebp) -.FN1lps: - cmpl $0,-48(%ebp) - jl .FN1lp1 - movl -48(%ebp),%eax - leal (,%eax,4),%eax - subl %eax,%edi -.FN1noarg: -/ movl %edi,%eax - movl -44(%ebp),%edx -/ addl $4,%edi - orl $-2147483648,%edx - movl %edx,(%edi) - addl $4,%edi - movl MachineState+4,%eax - subl Stackspace,%eax - shrl $1,%eax - orl $-1073741824,%eax - movl %eax,(%edi) - movl -40(%ebp),%eax - rol $16,%eax - movl %eax,4(%edi) - addl $20,%edi - movl %edi,MachineState+4 - movswl 6(%ecx),%eax - movl %eax,-48(%ebp) - cmpl $0,-48(%ebp) - jl .FN1disp -/ movl $-1,-52(%ebp) -/ movl %edi,%eax -/ movl -52(%ebp),%edx - movl $-1,%eax -/ movl %eax,(%edi) -/ addl $4,%edi -/ movl %edx,(%edi) -/ addl $4,%edi - stosl - stosl - cmpl $0,-48(%ebp) - jle .FN1disp -/ movl %edx,(%edi) -/ addl $4,%edi -/ movl %edx,(%edi) -/ addl $4,%edi - stosl - stosl - decl -48(%ebp) -.FN1xlp: - decl -48(%ebp) - jl .FN1disp -/ movl %edi,%eax -/ movl -52(%ebp),%edx -/ movl %edx,(%eax) -/ addl $4,%edi -/ movl %edx,(%edi) -/ addl $4,%edi - stosl - stosl - jmp .FN1xlp - - // can be pointed to FN0disp when we do the ecx change here. -.FN1disp: - movzwl 4(%ecx),%eax - movl %ecx,%esi - addl $4,%edi - addl %eax,%esi - incl %esi -/ movl %edx,%esi - movl %ecx,MachineState+20 - leal -1(%esi),%eax - xchg %edi,%esi / done using edi to store fast with. - xorb $3,%al - movzbl (%eax),%eax - jmp *optable(,%eax,4) - -.end - -.inline fast_FN2,0 - cld // for string ops, so they push upward. - leal 1(%edi),%edx - xorl $3,%edx - movzbl (%edx),%eax - leal 0(%edi),%edx - xorl $3,%edx - movb (%edx),%ah - movl %eax,%ecx - leal (,%eax,4),%eax - addl Defspace,%eax - movl (%eax),%edx - testl %edx,%edx - jl .FN2ccode - movl %eax,-12(%ebp) - movl $2,-24(%ebp) - movl $3,-20(%ebp) - movl %ecx,-16(%ebp) - movl $0,-28(%ebp) - jmp fn_common -.FN2ccode: -/ movl -40(%ebp),%eax - andl $16777215,%edx - movl %edx,-40(%ebp) - leal (%edx,%edx),%ecx - addl Lisp_world,%ecx -/ movl %eax,%ecx - movl MachineState+4,%eax - leal -1(%edi),%edx - subl MachineState+20,%edx - leal 3(%edx),%edx - movw %dx,-12(%eax) -/ movl %ecx,%eax - movzwl 2(%ecx),%eax - leal (%eax,%eax),%eax - movl MachineState+32,%edx - subl %eax,%edx - movl %edx,MachineState+28 - cmpl %edx,%esi - jg check_interrupt - xchg %edi,%esi - movl %edi,%eax - subl $4,%eax - movl %eax,MachineState - movl %eax,-48(%ebp) - movl MachineState+4,%eax - movl -48(%ebp),%edx - subl Stackspace,%edx - shrl $1,%edx - movl %edx,-44(%ebp) - movw %dx,-10(%eax) - movl %ebx,(%edi) -/ movl %ecx,%eax - movw (%ecx),%dx - addl $4,%edi - testw %dx,%dx - jl .FN2noarg - movl $2,%eax -/ movl %ecx,%edx - movswl (%ecx),%edx - subl %edx,%eax - movl %eax,-48(%ebp) - xorl %eax,%eax - jmp .FN2lps -.FN2lp: -/ movl $0,(%edi) -/ addl $4,%edi - stosl - incl -48(%ebp) -.FN2lps: - cmpl $0,-48(%ebp) - jl .FN2lp - movl -48(%ebp),%eax - leal (,%eax,4),%eax - subl %eax,%edi -.FN2noarg: -/ movl %edi,%eax - movl -44(%ebp),%eax -/ addl $4,%edi - orl $-2147483648,%eax -/ movl %edx,(%eax) - stosl - movl MachineState+4,%eax - subl Stackspace,%eax - shrl $1,%eax - orl $-1073741824,%eax - movl %eax,(%edi) - movl -40(%ebp),%eax - rol $16,%eax - movl %eax,4(%edi) - addl $20,%edi - movl %edi,MachineState+4 - movswl 6(%ecx),%eax - movl %eax,-48(%ebp) - cmpl $0,-48(%ebp) - jl .FN1disp -/ movl $-1,-52(%ebp) -/ movl %edi,%eax - movl $-1,%eax -/ movl %edx,(%edi) -/ addl $4,%edi -/ movl %edx,(%edi) -/ addl $4,%edi - stosl - stosl - cmpl $0,-48(%ebp) - jle .FN1disp -/ movl %edx,(%edi) -/ addl $4,%edi -/ movl %edx,(%edi) -/ addl $4,%edi - stosl - stosl - decl -48(%ebp) -.FN2xlp: - decl -48(%ebp) - jl .FN1disp -/ movl %edi,%eax -/ movl -52(%ebp),%edx -/ movl %edx,(%edi) -/ addl $4,%edi -/ movl %edx,(%edi) -/ addl $4,%edi - stosl - stosl - jmp .FN2xlp -.end - - -.inline fast_FN3,0 - leal 1(%edi),%edx - xorl $3,%edx - movzbl (%edx),%eax - leal 0(%edi),%edx - xorl $3,%edx - movb (%edx),%ah - movl %eax,%ecx - leal (,%eax,4),%eax - addl Defspace,%eax - movl (%eax),%edx - testl %edx,%edx - jl .FN3ccode - movl %eax,-12(%ebp) - movl $3,-24(%ebp) - movl $3,-20(%ebp) - movl %ecx,-16(%ebp) - movl $0,-28(%ebp) - jmp fn_common -.FN3ccode: - cld // so string ops work upward. -/ movl -40(%ebp),%eax - andl $16777215,%edx - movl %edx,-40(%ebp) - leal (%edx,%edx),%ecx - addl Lisp_world,%ecx -/ movl %eax,%ecx - movl MachineState+4,%eax - leal -1(%edi),%edx - subl MachineState+20,%edx - leal 3(%edx),%edx - movw %dx,-12(%eax) -/ movl %ecx,%eax - movzwl 2(%ecx),%eax - leal (%eax,%eax),%eax - movl MachineState+32,%edx - subl %eax,%edx - movl %edx,MachineState+28 - cmpl %edx,%esi - jg check_interrupt - xchg %edi,%esi - movl %edi,%eax - subl $8,%eax - movl %eax,MachineState - movl %eax,-48(%ebp) - movl MachineState+4,%eax - movl -48(%ebp),%edx - subl Stackspace,%edx - shrl $1,%edx - movl %edx,-44(%ebp) - movw %dx,-10(%eax) - movl %ebx,(%edi) -/ movl %ecx,%eax - movw (%ecx),%dx - addl $4,%edi - testw %dx,%dx - jl .FN3noarg - movl $3,%eax -/ movl %ecx,%edx - movswl (%ecx),%edx - subl %edx,%eax - movl %eax,-48(%ebp) - xorl %eax,%eax - jmp .FN3lps -.FN3lp: -/ movl $0,(%edi) -/ addl $4,%edi - stosl - incl -48(%ebp) -.FN3lps: - cmpl $0,-48(%ebp) - jl .FN3lp - movl -48(%ebp),%eax - leal (,%eax,4),%eax - subl %eax,%edi -.FN3noarg: -/ movl %edi,%eax - movl -44(%ebp),%eax -/ addl $4,%edi - orl $-2147483648,%eax -/ movl %edx,(%eax) - stosl - movl MachineState+4,%eax - subl Stackspace,%eax - shrl $1,%eax - orl $-1073741824,%eax - movl %eax,(%edi) - movl -40(%ebp),%eax - rol $16,%eax - movl %eax,4(%edi) - addl $20,%edi - movl %edi,MachineState+4 - movswl 6(%ecx),%eax - movl %eax,-48(%ebp) - cmpl $0,-48(%ebp) - jl .FN1disp -/ movl $-1,-52(%ebp) -/ movl %edi,%eax - movl $-1,%eax -/ movl %edx,(%eax) -/ addl $4,%edi -/ movl %edx,(%edi) -/ addl $4,%edi - stosl - stosl - cmpl $0,-48(%ebp) - jle .FN1disp -/ movl %edx,(%edi) -/ addl $4,%edi -/ movl %edx,(%edi) -/ addl $4,%edi - stosl - stosl - decl -48(%ebp) -.FN3xlp: - decl -48(%ebp) - jl .FN1disp -/ movl %edi,%eax -/ movl -52(%ebp),%edx -/ movl %edx,(%edi) -/ addl $4,%edi -/ movl %edx,(%edi) -/ addl $4,%edi - stosl - stosl - jmp .FN3xlp -.end - - -.inline fast_FN4,0 - leal 1(%edi),%edx - xorl $3,%edx - movzbl (%edx),%eax - leal 0(%edi),%edx - xorl $3,%edx - movb (%edx),%ah - movl %eax,%ecx - leal (,%eax,4),%eax - addl Defspace,%eax - movl (%eax),%edx - testl %edx,%edx - jl .FN4ccode - movl %eax,-12(%ebp) - movl $4,-24(%ebp) - movl $3,-20(%ebp) - movl %ecx,-16(%ebp) - movl $0,-28(%ebp) - jmp fn_common -.FN4ccode: - cld // so string ops work upward. - andl $16777215,%edx - movl %edx,-40(%ebp) - leal (%edx,%edx),%ecx - addl Lisp_world,%ecx - movl MachineState+4,%eax - leal -1(%edi),%edx - subl MachineState+20,%edx - leal 3(%edx),%edx - movw %dx,-12(%eax) - movzwl 2(%ecx),%eax - leal (%eax,%eax),%eax - movl MachineState+32,%edx - subl %eax,%edx - movl %edx,MachineState+28 - cmpl %edx,%esi - jg check_interrupt - xchg %edi,%esi - movl %edi,%eax - subl $12,%eax - movl %eax,MachineState - movl %eax,-48(%ebp) - movl MachineState+4,%eax - movl -48(%ebp),%edx - subl Stackspace,%edx - shrl $1,%edx - movl %edx,-44(%ebp) - movw %dx,-10(%eax) - movl %ebx,(%edi) - movw (%ecx),%dx - addl $4,%edi - testw %dx,%dx - jl .FN4noarg - movl $4,%eax - movswl (%ecx),%edx - subl %edx,%eax - movl %eax,-48(%ebp) - xorl %eax,%eax - jmp .FN4lps -.FN4lp: - stosl - incl -48(%ebp) -.FN4lps: - cmpl $0,-48(%ebp) - jl .FN4lp - movl -48(%ebp),%eax - leal (,%eax,4),%eax - subl %eax,%edi -.FN4noarg: - movl -44(%ebp),%eax - orl $-2147483648,%eax - stosl - movl MachineState+4,%eax - subl Stackspace,%eax - shrl $1,%eax - orl $-1073741824,%eax - movl %eax,(%edi) - movl -40(%ebp),%eax - rol $16,%eax - movl %eax,4(%edi) - addl $20,%edi - movl %edi,MachineState+4 - movswl 6(%ecx),%eax - movl %eax,-48(%ebp) - cmpl $0,-48(%ebp) - jl .FN1disp - movl $-1,%eax - stosl - stosl - cmpl $0,-48(%ebp) - jle .FN1disp - stosl - stosl - decl -48(%ebp) -.FN4xlp: - decl -48(%ebp) - jl .FN1disp - stosl - stosl - jmp .FN4xlp -.end - - - -.inline fast_FN5,0 - leal 1(%edi),%edx - xorl $3,%edx - movzbl (%edx),%eax - leal 0(%edi),%edx - xorl $3,%edx - movb (%edx),%ah - movl %eax,%ecx - leal (,%eax,4),%eax - addl Defspace,%eax - movl (%eax),%edx - testl %edx,%edx - jl .FN5ccode - movl %eax,-12(%ebp) - movl $5,-24(%ebp) - movl $3,-20(%ebp) - movl %ecx,-16(%ebp) - movl $0,-28(%ebp) - jmp fn_common -.FN5ccode: - cld // so string ops work upward. - andl $16777215,%edx - movl %edx,-40(%ebp) - leal (%edx,%edx),%ecx - addl Lisp_world,%ecx - movl MachineState+4,%eax - leal -1(%edi),%edx - subl MachineState+20,%edx - leal 3(%edx),%edx - movw %dx,-12(%eax) - movzwl 2(%ecx),%eax - leal (%eax,%eax),%eax - movl MachineState+32,%edx - subl %eax,%edx - movl %edx,MachineState+28 - cmpl %edx,%esi - jg check_interrupt - xchg %edi,%esi - movl %edi,%eax - subl $16,%eax - movl %eax,MachineState - movl %eax,-48(%ebp) - movl MachineState+4,%eax - movl -48(%ebp),%edx - subl Stackspace,%edx - shrl $1,%edx - movl %edx,-44(%ebp) - movw %dx,-10(%eax) - movl %ebx,(%edi) - movw (%ecx),%dx - addl $4,%edi - testw %dx,%dx - jl .FN5noarg - movl $5,%eax - movswl (%ecx),%edx - subl %edx,%eax - movl %eax,-48(%ebp) - xorl %eax,%eax - jmp .FN5lps -.FN5lp: - stosl - incl -48(%ebp) -.FN5lps: - cmpl $0,-48(%ebp) - jl .FN5lp - movl -48(%ebp),%eax - leal (,%eax,4),%eax - subl %eax,%edi -.FN5noarg: - movl -44(%ebp),%eax - orl $-2147483648,%eax - stosl - movl MachineState+4,%eax - subl Stackspace,%eax - shrl $1,%eax - orl $-1073741824,%eax - movl %eax,(%edi) - movl -40(%ebp),%eax - rol $16,%eax - movl %eax,4(%edi) - addl $20,%edi - movl %edi,MachineState+4 - movswl 6(%ecx),%eax - movl %eax,-48(%ebp) - cmpl $0,-48(%ebp) - jl .FN1disp - movl $-1,%eax - stosl - stosl - cmpl $0,-48(%ebp) - jle .FN1disp - stosl - stosl - decl -48(%ebp) -.FN5xlp: - decl -48(%ebp) - jl .FN1disp - stosl - stosl - jmp .FN5xlp -.end - - - -.inline fast_FN6,0 - leal 1(%edi),%edx - xorl $3,%edx - movzbl (%edx),%eax - leal 0(%edi),%edx - xorl $3,%edx - movb (%edx),%ah - movl %eax,%ecx - leal (,%eax,4),%eax - addl Defspace,%eax - movl (%eax),%edx - testl %edx,%edx - jl .FN6ccode - movl %eax,-12(%ebp) - movl $6,-24(%ebp) - movl $3,-20(%ebp) - movl %ecx,-16(%ebp) - movl $0,-28(%ebp) - jmp fn_common -.FN6ccode: - cld // so string ops work upward. - andl $16777215,%edx - movl %edx,-40(%ebp) - leal (%edx,%edx),%ecx - addl Lisp_world,%ecx - movl MachineState+4,%eax - leal -1(%edi),%edx - subl MachineState+20,%edx - leal 3(%edx),%edx - movw %dx,-12(%eax) - movzwl 2(%ecx),%eax - leal (%eax,%eax),%eax - movl MachineState+32,%edx - subl %eax,%edx - movl %edx,MachineState+28 - cmpl %edx,%esi - jg check_interrupt - xchg %edi,%esi - movl %edi,%eax - subl $20,%eax - movl %eax,MachineState - movl %eax,-48(%ebp) - movl MachineState+4,%eax - movl -48(%ebp),%edx - subl Stackspace,%edx - shrl $1,%edx - movl %edx,-44(%ebp) - movw %dx,-10(%eax) - movl %ebx,(%edi) - movw (%ecx),%dx - addl $4,%edi - testw %dx,%dx - jl .FN6noarg - movl $6,%eax - movswl (%ecx),%edx - subl %edx,%eax - movl %eax,-48(%ebp) - xorl %eax,%eax - jmp .FN6lps -.FN6lp: - stosl - incl -48(%ebp) -.FN6lps: - cmpl $0,-48(%ebp) - jl .FN6lp - movl -48(%ebp),%eax - leal (,%eax,4),%eax - subl %eax,%edi -.FN6noarg: - movl -44(%ebp),%eax - orl $-2147483648,%eax - stosl - movl MachineState+4,%eax - subl Stackspace,%eax - shrl $1,%eax - orl $-1073741824,%eax - movl %eax,(%edi) - movl -40(%ebp),%eax - rol $16,%eax - movl %eax,4(%edi) - addl $20,%edi - movl %edi,MachineState+4 - movswl 6(%ecx),%eax - movl %eax,-48(%ebp) - cmpl $0,-48(%ebp) - jl .FN1disp - movl $-1,%eax - stosl - stosl - cmpl $0,-48(%ebp) - jle .FN1disp - stosl - stosl - decl -48(%ebp) -.FN6xlp: - decl -48(%ebp) - jl .FN1disp - stosl - stosl - jmp .FN6xlp -.end - - - -.inline fast_FN7,0 - leal 1(%edi),%edx - xorl $3,%edx - movzbl (%edx),%eax - leal 0(%edi),%edx - xorl $3,%edx - movb (%edx),%ah - movl %eax,%ecx - leal (,%eax,4),%eax - addl Defspace,%eax - movl (%eax),%edx - testl %edx,%edx - jl .FN7ccode - movl %eax,-12(%ebp) - movl $7,-24(%ebp) - movl $3,-20(%ebp) - movl %ecx,-16(%ebp) - movl $0,-28(%ebp) - jmp fn_common -.FN7ccode: - cld // so string ops work upward. - andl $16777215,%edx - movl %edx,-40(%ebp) - leal (%edx,%edx),%ecx - addl Lisp_world,%ecx - movl MachineState+4,%eax - leal -1(%edi),%edx - subl MachineState+20,%edx - leal 3(%edx),%edx - movw %dx,-12(%eax) - movzwl 2(%ecx),%eax - leal (%eax,%eax),%eax - movl MachineState+32,%edx - subl %eax,%edx - movl %edx,MachineState+28 - cmpl %edx,%esi - jg check_interrupt - xchg %edi,%esi - movl %edi,%eax - subl $24,%eax - movl %eax,MachineState - movl %eax,-48(%ebp) - movl MachineState+4,%eax - movl -48(%ebp),%edx - subl Stackspace,%edx - shrl $1,%edx - movl %edx,-44(%ebp) - movw %dx,-10(%eax) - movl %ebx,(%edi) - movw (%ecx),%dx - addl $4,%edi - testw %dx,%dx - jl .FN7noarg - movl $7,%eax - movswl (%ecx),%edx - subl %edx,%eax - movl %eax,-48(%ebp) - xorl %eax,%eax - jmp .FN7lps -.FN7lp: - stosl - incl -48(%ebp) -.FN7lps: - cmpl $0,-48(%ebp) - jl .FN7lp - movl -48(%ebp),%eax - leal (,%eax,4),%eax - subl %eax,%edi -.FN7noarg: - movl -44(%ebp),%eax - orl $-2147483648,%eax - stosl - movl MachineState+4,%eax - subl Stackspace,%eax - shrl $1,%eax - orl $-1073741824,%eax - movl %eax,(%edi) - movl -40(%ebp),%eax - rol $16,%eax - movl %eax,4(%edi) - addl $20,%edi - movl %edi,MachineState+4 - movswl 6(%ecx),%eax - movl %eax,-48(%ebp) - cmpl $0,-48(%ebp) - jl .FN1disp - movl $-1,%eax - stosl - stosl - cmpl $0,-48(%ebp) - jle .FN1disp - stosl - stosl - decl -48(%ebp) -.FN7xlp: - decl -48(%ebp) - jl .FN1disp - stosl - stosl - jmp .FN7xlp -.end - - - -.inline fast_FN8,0 - leal 1(%edi),%edx - xorl $3,%edx - movzbl (%edx),%eax - leal 0(%edi),%edx - xorl $3,%edx - movb (%edx),%ah - movl %eax,%ecx - leal (,%eax,4),%eax - addl Defspace,%eax - movl (%eax),%edx - testl %edx,%edx - jl .FN8ccode - movl %eax,-12(%ebp) - movl $8,-24(%ebp) - movl $3,-20(%ebp) - movl %ecx,-16(%ebp) - movl $0,-28(%ebp) - jmp fn_common -.FN8ccode: - cld // so string ops work upward. - andl $16777215,%edx - movl %edx,-40(%ebp) - leal (%edx,%edx),%ecx - addl Lisp_world,%ecx - movl MachineState+4,%eax - leal -1(%edi),%edx - subl MachineState+20,%edx - leal 3(%edx),%edx - movw %dx,-12(%eax) - movzwl 2(%ecx),%eax - leal (%eax,%eax),%eax - movl MachineState+32,%edx - subl %eax,%edx - movl %edx,MachineState+28 - cmpl %edx,%esi - jg check_interrupt - xchg %edi,%esi - movl %edi,%eax - subl $28,%eax - movl %eax,MachineState - movl %eax,-48(%ebp) - movl MachineState+4,%eax - movl -48(%ebp),%edx - subl Stackspace,%edx - shrl $1,%edx - movl %edx,-44(%ebp) - movw %dx,-10(%eax) - movl %ebx,(%edi) - movw (%ecx),%dx - addl $4,%edi - testw %dx,%dx - jl .FN8noarg - movl $8,%eax - movswl (%ecx),%edx - subl %edx,%eax - movl %eax,-48(%ebp) - xorl %eax,%eax - jmp .FN8lps -.FN8lp: - stosl - incl -48(%ebp) -.FN8lps: - cmpl $0,-48(%ebp) - jl .FN8lp - movl -48(%ebp),%eax - leal (,%eax,4),%eax - subl %eax,%edi -.FN8noarg: - movl -44(%ebp),%eax - orl $-2147483648,%eax - stosl - movl MachineState+4,%eax - subl Stackspace,%eax - shrl $1,%eax - orl $-1073741824,%eax - movl %eax,(%edi) - movl -40(%ebp),%eax - rol $16,%eax - movl %eax,4(%edi) - addl $20,%edi - movl %edi,MachineState+4 - movswl 6(%ecx),%eax - movl %eax,-48(%ebp) - cmpl $0,-48(%ebp) - jl .FN1disp - movl $-1,%eax - stosl - stosl - cmpl $0,-48(%ebp) - jle .FN1disp - stosl - stosl - decl -48(%ebp) -.FN8xlp: - decl -48(%ebp) - jl .FN1disp - stosl - stosl - jmp .FN8xlp -.end - - - -.inline fast_FN9,0 - leal 1(%edi),%edx - xorl $3,%edx - movzbl (%edx),%eax - leal 0(%edi),%edx - xorl $3,%edx - movb (%edx),%ah - movl %eax,%ecx - leal (,%eax,4),%eax - addl Defspace,%eax - movl (%eax),%edx - testl %edx,%edx - jl .FN9ccode - movl %eax,-12(%ebp) - movl $9,-24(%ebp) - movl $3,-20(%ebp) - movl %ecx,-16(%ebp) - movl $0,-28(%ebp) - jmp fn_common -.FN9ccode: - cld // so string ops work upward. - andl $16777215,%edx - movl %edx,-40(%ebp) - leal (%edx,%edx),%ecx - addl Lisp_world,%ecx - movl MachineState+4,%eax - leal -1(%edi),%edx - subl MachineState+20,%edx - leal 3(%edx),%edx - movw %dx,-12(%eax) - movzwl 2(%ecx),%eax - leal (%eax,%eax),%eax - movl MachineState+32,%edx - subl %eax,%edx - movl %edx,MachineState+28 - cmpl %edx,%esi - jg check_interrupt - xchg %edi,%esi - movl %edi,%eax - subl $32,%eax - movl %eax,MachineState - movl %eax,-48(%ebp) - movl MachineState+4,%eax - movl -48(%ebp),%edx - subl Stackspace,%edx - shrl $1,%edx - movl %edx,-44(%ebp) - movw %dx,-10(%eax) - movl %ebx,(%edi) - movw (%ecx),%dx - addl $4,%edi - testw %dx,%dx - jl .FN9noarg - movl $9,%eax - movswl (%ecx),%edx - subl %edx,%eax - movl %eax,-48(%ebp) - xorl %eax,%eax - jmp .FN9lps -.FN9lp: - stosl - incl -48(%ebp) -.FN9lps: - cmpl $0,-48(%ebp) - jl .FN9lp - movl -48(%ebp),%eax - leal (,%eax,4),%eax - subl %eax,%edi -.FN9noarg: - movl -44(%ebp),%eax - orl $-2147483648,%eax - stosl - movl MachineState+4,%eax - subl Stackspace,%eax - shrl $1,%eax - orl $-1073741824,%eax - movl %eax,(%edi) - movl -40(%ebp),%eax - rol $16,%eax - movl %eax,4(%edi) - addl $20,%edi - movl %edi,MachineState+4 - movswl 6(%ecx),%eax - movl %eax,-48(%ebp) - cmpl $0,-48(%ebp) - jl .FN1disp - movl $-1,%eax - stosl - stosl - cmpl $0,-48(%ebp) - jle .FN1disp - stosl - stosl - decl -48(%ebp) -.FN9xlp: - decl -48(%ebp) - jl .FN1disp - stosl - stosl - jmp .FN9xlp -.end - - - - - - -////////////////////////////////////////////////// -/// -/// assembler label definitions -/// -///////////////////////////////////////////////// - -.inline asm_label_check_interrupt,0 -check_interrupt: -.end -.inline asm_label_op_fn_common,0 -op_fn_common: -.end diff --git a/src/dspSPARC.il b/src/dspSPARC.il index d0fdc14..931e8b8 100755 --- a/src/dspSPARC.il +++ b/src/dspSPARC.il @@ -410,156 +410,6 @@ _xwzq6: movw a0@(0,d1:l:1),d0 .end - - - -.inline _opreturn,0 - - movl _CurrentFX,a1 |returnFX = a1 - movl #65536,d0 - movw a1@(2),d0 |returnFX->alink - lsrl #1,d0 |low bit to carry - jcs ni |jump if slow return - movl a2,a3 |CSTKPTR = IVAR - movl _Lisp_world,a0 |PVar= - lea a0@(0,d0:l:4),a0 - movl a0,_PVar - moveq #20,d1 - subl d1,a0 |returnFX = a0 - movl a0,_CurrentFX |CURRENTFX = returnFX - movl #65536,d0 - movw a0@(-2),d0 |returnFX -1 - movl _Lisp_world,a1 - lea a1@(0,d0:l:2),a2 |IVAR = a2 - moveq #0,d0 - movb a0@(7),d0 |returnFX->hi2fnheader - swap d0 - movw a0@(4),d0 |returnFX->lofnheader - movl _Lisp_world,a1 - lea a1@(0,d0:l:2),a1 - movl a1,_FuncObj |FuncObj = a1 - subl a5,a5 - movw a0@(10),a5 |returnFX->pc a5 - lea a1@(0,a5:l:1),a5 | a5 + FuncObj - movb a5@,d6 - movl a4@(0,d6:l:4),a0 - jmp a0@ - - -.end - - - -.inline _fn3,0 - - moveq #0,d0 - movw a5@(1),d0 - movl _Defspace,a0 - lea a0@(0,d0:l:4),a1 |defcell = a1 - movl a1,d4 |save defcell in d4 -| movl a1,a6@(-20) - btst #7,a1@ - jeq ni - movl a1@,d0 |defcell->defpointer - andl #16777215,d0 - movl _Lisp_world,a0 - lea a0@(0,d0:l:2),a1 |LOCFNCELL - movl a1,d2 |save LOCFNCELL in a1, d2 -| movl a1,a6@(-12) - moveq #0,d0 - movw a1@,d0 |LOCFNCELL->stkmin - lea a3@(4,d0:l:2),a0 -| addql #4,a0 - cmpl _StkLimO,a0 - jcc ni |stack overflow - lea a3@(-8),a1 |CSTKPTR-(x<<1)+2 - subl _Lisp_world,a1 - movl a1,d3 - lsrl #1,d3 -| movl d3,a1 - andl #65535,d3 |NEXTBLOCK = d3 -| movl d0,d3 - movl _CurrentFX,a1 |a1 = _CurrentFX - movw d3,a1@(8) |CURRENTFX->nextblock = - movl d3,d0 - orl #65536,d0 - movl _Lisp_world,a0 - lea a0@(0,d0:l:2),a2 |IVAR = -| movl _CurrentFX,a0 - movl a5,d0 - subl _FuncObj,d0 - addql #3,d0 - movw d0,a1@(10) |CURRENTFX->pc - movl d7,a3@+ |CPushCStack - movl d2,a1 |get LOCFNCELL = a1 - movw a1@(2),d0 - tstw d0 - jlt fn3noargs |no function arguments -| movw a0@(2),d0 - extl d0 - moveq #2,d1 - subl d0,d1 -| movl d1,d4 - jra fn3ly16 -fn3ly17: - clrl a3@+ - addql #1,d1 -fn3ly16: - tstl d1 - jlt fn3ly17 -| movl d4,d0 - asll #2,d1 - subl d1,a3 -fn3noargs: - movl d3,d0 |CPush(BF_MARK32 | NEXTBLOCK) - orl #-2147483648,d0 - movl d0,a3@+ - movl a3,_CurrentFX |CURRENTFX = - movl _PVar,d0 -| subl _Lisp_world,d0 - subl a0,d0 - lsrl #1,d0 - andl #65535,d0 - orl #-1073741824,d0 - movl d0,a3@ |*CSTKPTR=FX_MARK etc - movl d4,a0 |defcell = a0 - movw a0@(2),a3@(4) |->lofnheader = ->defpointer -| movl a6@(-20),a0 -| movl a0@,d0 -| andl #16777215,d0 -| movw d0,a3@(4) -| movl d4,a0 -| movl a6@(-20),a0 - movb a0@(1),a3@(7) |hi2fnheader = *((defcell)+1) - lea a3@(20),a3 - movl a3,_PVar |PVar = CSTKPTR -| movl d2,a0 - movw a1@(4),d0 ||LOCFNCELL->pv - extl d0 - addql #1,d0 -| movl d0,a6@(-8) - moveq #-1,d1 - jra fn3ly18 -fn3ly19: - movl d1,a3@+ - movl d1,a3@+ - subql #1,d0 -fn3ly18: - tstl d0 - jgt fn3ly19 - addqw #4,a3 | CSTKPTR += 2 -| movl d2,a0 -| moveq #0,d0 - subl a5,a5 - movw a1@(6),a5 |LOCFNCELL->startpc - addl a1,a5 -| movl d0,a5 - movl a1,_FuncObj - - -.end - - |.inline _min,8 | cmp %o0,%o1 | ble,a $10 diff --git a/src/xc.c b/src/xc.c index 53d023c..29b81df 100644 --- a/src/xc.c +++ b/src/xc.c @@ -1079,10 +1079,6 @@ native_check: /* TIMER INTERRUPT CHECK ROUTINE */ /************************************************************************/ check_interrupt: -#if (defined(SUN3_OS3_OR_OS4_IL) || defined(I386) || defined(ISC)) - asm_label_check_interrupt(); -#endif - if ((UNSIGNED)CSTKPTR > (UNSIGNED)EndSTKP) { EXT; error("Unrecoverable Stack Overflow");