From 99020b36cd96dae59ba3638d01c69d18ee9edcd1 Mon Sep 17 00:00:00 2001 From: Raymond Toy <toy.raymond@gmail.com> Date: Mon, 16 Jul 2012 19:43:14 -0700 Subject: [PATCH] Clean up not-inline-allocation. src/lisp/x86-assem.S: o Remove the (now) unused alloc_to_<reg> functions. src/compiler/x86/macros.lisp: o Simplify the not-inline-allocation to use the same routines as inline allocation. --- src/compiler/x86/macros.lisp | 35 +++++-------- src/lisp/x86-assem.S | 97 ------------------------------------ 2 files changed, 12 insertions(+), 120 deletions(-) diff --git a/src/compiler/x86/macros.lisp b/src/compiler/x86/macros.lisp index 9d955f40e..21b68e485 100644 --- a/src/compiler/x86/macros.lisp +++ b/src/compiler/x86/macros.lisp @@ -183,31 +183,20 @@ (defun not-inline-allocation (alloc-tn size) ;; C call to allocate via dispatch routines. Each destination has a ;; special entry point. The size may be a register or a constant. - (ecase (tn-offset alloc-tn) + (load-size alloc-tn alloc-tn size) + (case (tn-offset alloc-tn) (#.eax-offset - (load-size alloc-tn eax-tn size) - (inst call (make-fixup (extern-alien-name "alloc_to_eax") + (inst call (make-fixup (extern-alien-name #-sse2 "alloc_overflow_x87" + #+sse2 "alloc_overflow_sse2") :foreign))) - (#.ecx-offset - (load-size alloc-tn ecx-tn size) - (inst call (make-fixup (extern-alien-name "alloc_to_ecx") - :foreign))) - (#.edx-offset - (load-size alloc-tn edx-tn size) - (inst call (make-fixup (extern-alien-name "alloc_to_edx") - :foreign))) - (#.ebx-offset - (load-size alloc-tn ebx-tn size) - (inst call (make-fixup (extern-alien-name "alloc_to_ebx") - :foreign))) - (#.esi-offset - (load-size alloc-tn esi-tn size) - (inst call (make-fixup (extern-alien-name "alloc_to_esi") - :foreign))) - (#.edi-offset - (load-size alloc-tn edi-tn size) - (inst call (make-fixup (extern-alien-name "alloc_to_edi") - :foreign)))) + (t + (inst push eax-tn) ; Save any value in eax + (inst mov eax-tn alloc-tn) + (inst call (make-fixup (extern-alien-name #-sse2 "alloc_overflow_x87" + #+sse2 "alloc_overflow_sse2") + :foreign)) + (inst mov alloc-tn eax-tn) ; Save allocated address in alloc-tn + (inst pop eax-tn))) (values)) ;;; diff --git a/src/lisp/x86-assem.S b/src/lisp/x86-assem.S index 46640fad1..9583e843e 100644 --- a/src/lisp/x86-assem.S +++ b/src/lisp/x86-assem.S @@ -458,101 +458,6 @@ ENDFUNC(fastcopy16) #endif -/* - Allocate bytes and return the start of the allocated space - in the specified destination register. - - In the general case the size will be in the destination register. - - All registers must be preserved except the destination. - The C conventions will preserve ebx, esi, edi, and ebp. - So only eax, ecx, and edx need special care here. */ - -FUNCDEF(alloc_to_eax) - STACK_PROLOGUE(12) - movl %ecx, 8(%esp) # Save ecx and edx as C could destroy them. - movl %edx, 4(%esp) - movl %eax, (%esp) # Push the size - call GNAME(alloc) - movl 4(%esp), %edx # Restore ecx and edx. - movl 8(%esp), %ecx - STACK_EPILOGUE - ret -ENDFUNC(alloc_to_eax) - -FUNCDEF(alloc_to_ecx) - STACK_PROLOGUE(12) - movl %eax, 8(%esp) # Save eax and edx as C could destroy them. - movl %edx, 4(%esp) - movl %ecx, (%esp) # Push the size - call GNAME(alloc) - movl %eax,%ecx # setup the destination. - movl 4(%esp), %edx # Restore eax and edx. - movl 8(%esp), %eax - STACK_EPILOGUE - ret -ENDFUNC(alloc_to_ecx) - -FUNCDEF(alloc_to_edx) - STACK_PROLOGUE(12) - movl %eax, 8(%esp) # Save eax and ecx as C could destroy them. - movl %ecx, 4(%esp) - movl %edx, (%esp) # Push the size - call GNAME(alloc) - movl %eax,%edx # setup the destination. - movl 4(%esp), %ecx # Restore eax and ecx. - movl 8(%esp), %eax - STACK_EPILOGUE - ret -ENDFUNC(alloc_to_edx) - -FUNCDEF(alloc_to_ebx) - STACK_PROLOGUE(16) - movl %eax, 12(%esp) # Save eax, ecx, and edx as C could destroy them. - movl %ecx, 8(%esp) - movl %edx, 4(%esp) - movl %ebx, (%esp) # Push the size - call GNAME(alloc) - movl %eax,%ebx # setup the destination. - movl 4(%esp), %edx # Restore eax, ecx and edx. - movl 8(%esp), %ecx - movl 12(%esp), %eax - STACK_EPILOGUE - ret -ENDFUNC(alloc_to_ebx) - -FUNCDEF(alloc_to_esi) - STACK_PROLOGUE(16) - movl %eax, 12(%esp) # Save eax, ecx, and edx as C could destroy them. - movl %ecx, 8(%esp) - movl %edx, 4(%esp) - movl %esi, (%esp) # Push the size - call GNAME(alloc) - movl %eax,%esi # setup the destination. - movl 4(%esp), %edx # Restore eax, ecx and edx. - movl 8(%esp), %ecx - movl 12(%esp), %eax - STACK_EPILOGUE - ret -ENDFUNC(alloc_to_esi) - -FUNCDEF(alloc_to_edi) - STACK_PROLOGUE(16) - movl %eax, 12(%esp) # Save eax, ecx, and edx as C could destroy them. - movl %ecx, 8(%esp) - movl %edx, 4(%esp) - movl %edi, (%esp) # Push the size - call GNAME(alloc) - movl %eax,%edi # setup the destination. - movl 4(%esp), %edx # Restore eax, ecx and edx. - movl 8(%esp), %ecx - movl 12(%esp), %eax - STACK_EPILOGUE - ret -ENDFUNC(alloc_to_edi) - -#ifdef GENCGC - /* * alloc_overflow_x87 and alloc_overflow_sse2 must not be called from * C because it doesn't follow C conventions. @@ -595,8 +500,6 @@ FUNCDEF(alloc_overflow_sse2) ret ENDFUNC(alloc_overflow_sse2) -#endif /* GENCGC */ - #ifdef LINKAGE_TABLE /* Call into C code to resolve a linkage entry. The initial code in the -- GitLab