[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gcl-devel] Re: gcl bad code generation for setf fill-pointer for fi
From: |
Camm Maguire |
Subject: |
Re: [Gcl-devel] Re: gcl bad code generation for setf fill-pointer for fixnum value |
Date: |
18 Dec 2007 11:04:34 -0500 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Greetings!
All of thes ework in cvs head:
BTW, are you interested in helping with the long-standing goal or
porting gcl as a new gcc front end for common lisp?
=============================================================================
>(disassemble '(lambda () (setf (fill-pointer xxx) 0))
)
;; Compiling /tmp/gazonk_22670_0.lsp.
; (DEFUN COMPILER::CMP-ANON ...) is being compiled.
;; Warning: ;; The variable XXX is undefined.
;; The compiler will assume this variable is a global.
;; End of Pass 1.
;; End of Pass 2.
;; OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3,
(Debug quality ignored)
;; Finished compiling /tmp/gazonk_22670_0.o.
#include "gazonk_22670_0.h"
void init_code(){do_init((void *)VV);}
/* local entry for function COMPILER::CMP-ANON */
static fixnum LI1__CMP_ANON___gazonk_22670_0()
{ VMB1 VMS1 VMV1
goto TTL;
TTL:;
{fixnum V1 =
(fixnum)((((((object)VV[0])->s.s_dbind))->st.st_fillp)=((((((object)VV[0])->s.s_dbind))->st.st_hasfillp)
? ((fixnum)0) : (((((object)VV[0])->s.s_dbind))->st.st_fillp)));VMR1
(V1);}
}
#(#(XXX
(%INIT
. #((LET ((*DISABLE-RECOMPILE* T))
(MFSFUN 'CMP-ANON 0 256 0)
(ADD-HASH 'CMP-ANON '(NIL SEQIND)
'((FILL-POINTER-SET (VECTOR FIXNUM) SEQIND))
static fixnum LI1__CMP_ANON___gazonk_22670_0();
#define VMB1
#define VMS1
#define VMV1
#define VMR1(VMT1) return(VMT1);
#define VM1 0
static void * VVi[2]={
#define Cdata VV[1]
(void *)(LI1__CMP_ANON___gazonk_22670_0)
};
#define VV (VVi)
/tmp/gazonk_22670_0.o: file format elf32-i386
Disassembly of section .text:
00000000 <LI1__CMP_ANON___gazonk_22670_0>:
0: a1 00 00 00 00 mov 0x0,%eax
5: 8b 50 08 mov 0x8(%eax),%edx
8: 31 c0 xor %eax,%eax
a: f6 42 08 01 testb $0x1,0x8(%edx)
e: 75 03 jne 13 <LI1__CMP_ANON___gazonk_22670_0+0x13>
10: 8b 42 10 mov 0x10(%edx),%eax
13: 89 42 10 mov %eax,0x10(%edx)
16: c3 ret
00000017 <init_code>:
17: 83 ec 18 sub $0x18,%esp
1a: 68 00 00 00 00 push $0x0
1f: e8 fc ff ff ff call 20 <init_code+0x9>
24: 83 c4 1c add $0x1c,%esp
27: c3 ret
NIL
>(disassemble '(lambda (n) (setf (fill-pointer xxx) n)))
;; Compiling /tmp/gazonk_22670_0.lsp.
; (DEFUN COMPILER::CMP-ANON ...) is being compiled.
;; Warning: ;; The variable XXX is undefined.
;; The compiler will assume this variable is a global.
;; End of Pass 1.
;; End of Pass 2.
;; OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3,
(Debug quality ignored)
;; Finished compiling /tmp/gazonk_22670_0.o.
#include "gazonk_22670_0.h"
void init_code(){do_init((void *)VV);}
/* local entry for function COMPILER::CMP-ANON */
static fixnum LI1__CMP_ANON___gazonk_22670_0(V2)
object V2;
{ VMB1 VMS1 VMV1
goto TTL;
TTL:;
{fixnum V3 =
(fixnum)((((((object)VV[0])->s.s_dbind))->st.st_fillp)=((((((object)VV[0])->s.s_dbind))->st.st_hasfillp)
? (fix((V2))) : (((((object)VV[0])->s.s_dbind))->st.st_fillp)));VMR1
(V3);}
}
#(#(XXX
(%INIT
. #((LET ((*DISABLE-RECOMPILE* T))
(MFSFUN 'CMP-ANON 0 257 0)
(ADD-HASH 'CMP-ANON '((T) SEQIND)
'((FILL-POINTER-SET (VECTOR FIXNUM) SEQIND))
static fixnum LI1__CMP_ANON___gazonk_22670_0();
#define VMB1
#define VMS1
#define VMV1
#define VMR1(VMT1) return(VMT1);
#define VM1 0
static void * VVi[2]={
#define Cdata VV[1]
(void *)(LI1__CMP_ANON___gazonk_22670_0)
};
#define VV (VVi)
/tmp/gazonk_22670_0.o: file format elf32-i386
Disassembly of section .text:
00000000 <LI1__CMP_ANON___gazonk_22670_0>:
0: a1 00 00 00 00 mov 0x0,%eax
5: 8b 4c 24 04 mov 0x4(%esp),%ecx
9: 8b 50 08 mov 0x8(%eax),%edx
c: f6 42 08 01 testb $0x1,0x8(%edx)
10: 74 13 je 25 <LI1__CMP_ANON___gazonk_22670_0+0x25>
12: 81 f9 ff ff ff bf cmp $0xbfffffff,%ecx
18: 8d 81 00 00 00 30 lea 0x30000000(%ecx),%eax
1e: 77 08 ja 28 <LI1__CMP_ANON___gazonk_22670_0+0x28>
20: 8b 41 04 mov 0x4(%ecx),%eax
23: eb 03 jmp 28 <LI1__CMP_ANON___gazonk_22670_0+0x28>
25: 8b 42 10 mov 0x10(%edx),%eax
28: 89 42 10 mov %eax,0x10(%edx)
2b: c3 ret
0000002c <init_code>:
2c: 83 ec 18 sub $0x18,%esp
2f: 68 00 00 00 00 push $0x0
34: e8 fc ff ff ff call 35 <init_code+0x9>
39: 83 c4 1c add $0x1c,%esp
3c: c3 ret
NIL
>(disassemble '(lambda (n) (declare (fixnum n)) (setf (fill-pointer xxx)
n)))
;; Compiling /tmp/gazonk_22670_0.lsp.
; (DEFUN COMPILER::CMP-ANON ...) is being compiled.
;; Warning: ;; The variable XXX is undefined.
;; The compiler will assume this variable is a global.
;; End of Pass 1.
;; End of Pass 2.
;; OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3,
(Debug quality ignored)
;; Finished compiling /tmp/gazonk_22670_0.o.
#include "gazonk_22670_0.h"
void init_code(){do_init((void *)VV);}
/* local entry for function COMPILER::CMP-ANON */
static fixnum LI1__CMP_ANON___gazonk_22670_0(V2)
fixnum V2;
{ VMB1 VMS1 VMV1
goto TTL;
TTL:;
{fixnum V3 =
(fixnum)((((((object)VV[0])->s.s_dbind))->st.st_fillp)=((((((object)VV[0])->s.s_dbind))->st.st_hasfillp)
? (V2) : (((((object)VV[0])->s.s_dbind))->st.st_fillp)));VMR1
(V3);}
}
#(#(XXX
(%INIT
. #((LET ((*DISABLE-RECOMPILE* T))
(MFSFUN 'CMP-ANON 0 4353 0)
(ADD-HASH 'CMP-ANON '((FIXNUM) SEQIND)
'((FILL-POINTER-SET (VECTOR FIXNUM) SEQIND))
static fixnum LI1__CMP_ANON___gazonk_22670_0();
#define VMB1
#define VMS1
#define VMV1
#define VMR1(VMT1) return(VMT1);
#define VM1 0
static void * VVi[2]={
#define Cdata VV[1]
(void *)(LI1__CMP_ANON___gazonk_22670_0)
};
#define VV (VVi)
/tmp/gazonk_22670_0.o: file format elf32-i386
Disassembly of section .text:
00000000 <LI1__CMP_ANON___gazonk_22670_0>:
0: a1 00 00 00 00 mov 0x0,%eax
5: 8b 54 24 04 mov 0x4(%esp),%edx
9: 8b 40 08 mov 0x8(%eax),%eax
c: f6 40 08 01 testb $0x1,0x8(%eax)
10: 75 03 jne 15 <LI1__CMP_ANON___gazonk_22670_0+0x15>
12: 8b 50 10 mov 0x10(%eax),%edx
15: 89 50 10 mov %edx,0x10(%eax)
18: 89 d0 mov %edx,%eax
1a: c3 ret
0000001b <init_code>:
1b: 83 ec 18 sub $0x18,%esp
1e: 68 00 00 00 00 push $0x0
23: e8 fc ff ff ff call 24 <init_code+0x9>
28: 83 c4 1c add $0x1c,%esp
2b: c3 ret
NIL
=============================================================================
Take care,
Tim Josling <address@hidden> writes:
> You can generate this problem more easily from the REPL as sollows
>
> (disassemble '(lambda () (setf (fill-pointer xxx) 0))
>
> However this is OK
>
> (disassemble '(lambda (n) (setf (fill-pointer xxx) n)))
>
> But this is not... it looks like an optimization that happens when it
> knows the parameter is a fixnum.
>
> (disassemble '(lambda (n) (declare (fixnum n)) (setf (fill-pointer xxx)
> n)))
>
> Regards,
> Tim Josling
>
> On Sun, 2007-12-16 at 06:54 +1100, Tim Josling wrote:
> > System:
> > uname -a
> > Linux tim-gcc 2.6.20-15-generic #2 SMP Sun Apr 15 06:17:24 UTC 2007
> > x86_64 GNU/Linux
> >
> > GCL:
> > GCL (GNU Common Lisp) 2.6.7 CLtL1 Nov 10 2006 14:25:02
> >
> > Run log of error:
> >
> > make cobol-tests
> > gcl \
> > -eval "(compile-file
> > \"/home2/gcb/gcb/gcc/gcc/gcb/gcbc-compiler-lexer.lisp\")"
> > GCL (GNU Common Lisp) 2.6.7 CLtL1 Nov 10 2006 14:25:02
> > Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
> > Binary License: GPL due to GPL'ed components: (XGCL READLINE BFD
> > UNEXEC)
> > Modifications of this banner must retain notice of a compatible license
> > Dedicated to the memory of W. Schelter
> >
> > Use (help) to get some basic information on how to use GCL.
> > Temporary directory for compiler files set to /tmp/
> > Compiling /home2/gcb/gcb/gcc/gcc/gcb/gcbc-compiler-lexer.lisp.
> > End of Pass 1.
> > End of Pass 2.
> > /home2/gcb/gcb/gcc/gcc/gcb/gcbc-compiler-lexer.c: In function 'L1':
> > /home2/gcb/gcb/gcc/gcc/gcb/gcbc-compiler-lexer.c:5158: error: invalid
> > lvalue in assignment
> >
> > Error: (SYSTEM "gcc -c -Wall -DVOL=volatile -fsigned-char -pipe
> > -I/usr/lib/gcl-2.6.7/unixport/../h -O3 -fomit-frame-pointer -c
> > \"/home2/gcb/gcb/gcc/gcc/gcb/gcbc-compiler-lexer.c\" -o
> > \"/home2/gcb/gcb/gcc/gcc/gcb/gcbc-compiler-lexer.o\" -w") returned a
> > non-zero value 0.
> > Fast links are on: do (si::use-fast-links nil) for debugging
> > Error signalled by UNLESS.
> > Broken at CERROR. Type :H for Help.
> > >>
> >
> > Input program:
> > ;;; -*- lisp -*-
> >
> > (defvar *current-token-chars* nil)
> >
> > (defun init-token-chars ()
> > (setf (fill-pointer *current-token-chars*) 0))
> >
> > Output C code (excerpt):
> >
> > #include "gcbc-compiler-lexer.h"
> > void init_code(){do_init((void *)VV);}
> > /* function definition for INIT-TOKEN-CHARS */
> >
> > static void L1()
> > {register object *base=vs_base;
> > register object *sup=base+VM1; VC1
> > vs_check;
> > vs_top=sup;
> > goto TTL;
> > TTL:;
> > base[0]=
> > CMPmake_fixnum((long)(((((object)VV[0])->s.s_dbind))->st.st_fillp)=((long)0));
> >
> > vs_top=(vs_base=base+0)+1;
> > return;
> > }
> >
> > This is the bad line:
> > CMPmake_fixnum((long)(((((object)VV[0])->s.s_dbind))->st.st_fillp)=((long)0));
> >
> >
> > Regards,
> > Tim Josling
>
>
>
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gcl-devel
>
>
>
--
Camm Maguire address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah
Re: [Gcl-devel] The package operation ... was in a bad place, Camm Maguire, 2007/12/18