gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gcl-devel] Re: gcl/maxima on hppa


From: Camm Maguire
Subject: Re: [Gcl-devel] Re: gcl/maxima on hppa
Date: 01 Aug 2002 14:44:12 -0400

Greetings, and thanks for your reply!

address@hidden (LaMont Jones) writes:

> On Wed, Jul 31, 2002 at 11:50:20PM +0100, Matthew Wilcox wrote:
> > On Wed, Jul 31, 2002 at 06:42:47PM -0400, Camm Maguire wrote:
> > > Looking over the boehm-gc code, the only unusual item appears to be a
> > > requirement to align malloc results on 8 byte boundaries even when
> > > running in 32bit mode.  
> > surely 16 byte boundaries?  some structs are allocated on the stack,
> > which we need to do atomic ops on.  and we can't guarantee atomic ops
> > work unless they're 16-byte aligned.
> 
> If I let my hp-ux history out a bit, malloc on hp-ux always returns 8-byte
> aligned data.  This is because the 32 bit hardware supports 64 bit floats.
> 
> 16 byte alignment is certainly nicer, and may be required on hppa-linux,
> but I don't know.

What are the atomic issues with 16 byte alignment?

> 
> > > 2) Is there anything unusual about the C stack on hppa?
> > it grows upwards instead of downwards?
> 
> That would be the most significant difference  sp (gr30) + 0 and beyond
> is off the end of the stack....
> 

Does this refer to the start of the heap, ~ 0x20000 on hppa-linux?

> > > 3) When looking at the situation in a debugger, certain local
> > >    variables on the stack cannot report their address, apparently
> > >    indicating they are stored in registers.  Is there a way to flush
> > >    these reliably to memory before collecting garbage?
> > umm.  no idea.
> 
> No.  If the variables are in registers, they may get spilled when you
> call a function, or may not (depending on how many registers each of
> the two routines is using.)
> 
> With a little assembly, you can capture all of the registers as they exist
> at the time of that call, but that should not be confused with the register
> state in the code that called you...   (If that made _ANY_ sense, please
> let me know... :-)
> 

Yes, this assembly is likely what I need.  I don't really care if I
get the state before or after the function call, as long as I can find
the addresses of all local variables normally intended for the stack
in some definiable region of memory.  Consider the following gdb
session.  Certain local variables cannot report their addresses under
gdb.  I assume this means that these addresses are also not to be
found on the stack, causing my garbage collector to overlook them in
the mark stage, and erroneously sweep them away.  (On ia64, there was
a special __builtin_flushrs() function which would copy these
registers to a defined stack area.  Adding this command and the new
stack area to the garbage collector completed the gcl/maxima port to
ia64.  I think I need something analogous here.)


=============================================================================
>
Compiling comm2.lisp.

Breakpoint 3, GBC (t=t_cons) at gbc.c:977
977       int in_sgc = sgc_enabled;
(gdb) bt
bt
#0  GBC (t=t_cons) at gbc.c:977
#1  0x0002f158 in make_cons (a=0x2e1f98, d=0x2e1f98) at alloc.c:338
#2  0x00081cb8 in append (x=0x540d70, y=0x2e1f98) at list.d:377
#3  0x00198900 in LI2 (V9=0x5398d0, V10=0x539650) at cmpinline.c:59
#4  0x001e545c in LI1 (V2=0x2e1f98) at cmplet.c:147
#5  0x000396bc in call_sfun_no_check (fun=0x372af8) at eval.c:118
#6  0x0003b254 in funcall_no_event (fun=0x372af8) at eval.c:360
#7  0x0003cf78 in super_funcall_no_event (fun=0x372af8) at eval.c:758
#8  0x001ba0d8 in L12 () at cmpeval.c:654
#9  0x001b89d4 in LI2 (V7=0x2f4320) at cmpeval.c:104
#10 0x001ba3f0 in L12 () at cmpeval.c:722
#11 0x001b89d4 in LI2 (V7=0x2f4320) at cmpeval.c:104
#12 0x001bc838 in LI20 (V168=0x539f30) at cmpeval.c:1298
#13 0x001a6470 in LI2 (V10=0x539c00) at cmpblock.c:71
#14 0x000396bc in call_sfun_no_check (fun=0x36dea0) at eval.c:118
#15 0x0003b254 in funcall_no_event (fun=0x36dea0) at eval.c:360
#16 0x0003cf78 in super_funcall_no_event (fun=0x36dea0) at eval.c:758
#17 0x001ba0d8 in L12 () at cmpeval.c:654
#18 0x001b89d4 in LI2 (V7=0x2f4320) at cmpeval.c:104
#19 0x001bc838 in LI20 (V168=0x539bf0) at cmpeval.c:1298
#20 0x001b581c in LI23 (V187=0x2e1f98, V188=0x539bf0) at cmpenv.c:1549
#21 0x001dc2b0 in LI9 (V36=0x539b60) at cmplam.c:755
#22 0x001fe294 in LI7 (V81=0x539e40) at cmptop.c:812
---Type <return> to continue, or q <return> to quit---
q
q
Quit
(gdb) frame 3
frame 3
#3  0x00198900 in LI2 (V9=0x5398d0, V10=0x539650) at cmpinline.c:59
59              V16= append(/* INLINE-ARGS */V14,/* INLINE-ARGS */V15);
(gdb) l 
l 
54              V12= structure_ref((V9),VV[0],0);
55              V13= append(/* INLINE-ARGS */V11,/* INLINE-ARGS */V12);
56              (void)(structure_set((V9),VV[0],0,/* INLINE-ARGS */V13));
57              V14= structure_ref((V10),VV[0],1);
58              V15= structure_ref((V9),VV[0],1);
59              V16= append(/* INLINE-ARGS */V14,/* INLINE-ARGS */V15);
60              (void)(structure_set((V9),VV[0],1,/* INLINE-ARGS */V16));
61              if((structure_ref((V10),VV[0],3))==Cnil){
62              goto T11;}
63              {object V17 = structure_set((V9),VV[0],3,Ct);
(gdb) l 1
l 1
1       
2       #include "cmpinclude.h"
3       #include "cmpinline.h"
4       void init_cmpinline(){do_init(VV);}
5       /*      local entry for function MAKE-INFO      */
6       
7       static object LI1(va_alist)
8               va_dcl 
9       {       
10              va_list ap;
(gdb) 

11              int narg = VFUN_NARGS; VMB1 VMS1 VMV1
12              {object V1;
13              object V2;
14              object V3;
15              object V4;
16              object V5;
17              Vcs[0]=Vcs[0];
18              va_start(ap);
19              narg= narg - 0;
20              {
(gdb) 

21              parse_key_new(narg,Vcs +0,(struct key *)&LI1key,ap);
22              V1=(Vcs[0]);
23              V2=(Vcs[1]);
24              if(Vcs[2]==0){
25              V3= Ct;
26              }else{
27              V3=(Vcs[2]);}
28              V4=(Vcs[3]);
29              V5=(Vcs[4]);
30              base[0]= VV[0];
(gdb) 

31              base[1]= (V1);
32              base[2]= (V2);
33              base[3]= (V3);
34              base[4]= (V4);
35              base[5]= (V5);
36              vs_top=(vs_base=base+0)+6;
37              siLmake_structure();
38              vs_top=sup;
39              {object V6 = vs_base[0];
40              VMR1(V6)}
(gdb) 

41              va_end(ap);
42              base[0]=base[0];
43              return Cnil;}
44              }}
45      /*      local entry for function ADD-INFO       */
46      
47      static object LI2(V9,V10)
48      
49      register object V9;object V10;
50      {        VMB2 VMS2 VMV2

[ in header file...
#define VMB2 object  V16 ,V15 ,V14 ,V13 ,V12 ,V11;
#define VMS2
#define VMV2
]


(gdb) 

51      goto TTL;
52      TTL:;
53              V11= structure_ref((V10),VV[0],0);
54              V12= structure_ref((V9),VV[0],0);
55              V13= append(/* INLINE-ARGS */V11,/* INLINE-ARGS */V12);
56              (void)(structure_set((V9),VV[0],0,/* INLINE-ARGS */V13));
57              V14= structure_ref((V10),VV[0],1);
58              V15= structure_ref((V9),VV[0],1);
59              V16= append(/* INLINE-ARGS */V14,/* INLINE-ARGS */V15);
60              (void)(structure_set((V9),VV[0],1,/* INLINE-ARGS */V16));
(gdb) 

61              if((structure_ref((V10),VV[0],3))==Cnil){
62              goto T11;}
63              {object V17 = structure_set((V9),VV[0],3,Ct);
64              VMR2(V17)}
65      goto T11;
66      T11:;
67              {object V18 = Cnil;
68              VMR2(V18)}
69              return Cnil;
70      }
(gdb) 

71      /*      local entry for function ARGS-INFO-CHANGED-VARS */
72      
73      static object LI3(V21,V22)
74      
75      register object V21;object V22;
76      {        VMB3 VMS3 VMV3
77      goto TTL;
78      TTL:;
79              V24= structure_ref((V21),VV[1],1);
80              {object V23= /* INLINE-ARGS */V24;
(gdb) 
p V11
p V11
$1 = (union lispunion *) 0x546510
(gdb) 
p &V11
p &V11
Can't take address of "V11" which isn't an lvalue.
(gdb) 
p V12
p V12
$2 = (union lispunion *) 0x28a24c
(gdb) p &V12
p &V12
Address requested for identifier "V12" which is in register $r25
(gdb) 
p V13
p V13
$3 = (union lispunion *) 0x28a24c
(gdb) p &V13
p &V13
Address requested for identifier "V13" which is in register $r23
(gdb) p V14
p V14
$4 = (union lispunion *) 0x546510
(gdb) 
p &V14
p &V14
Can't take address of "V14" which isn't an lvalue.
(gdb) p V15
p V15
$5 = (union lispunion *) 0x28a24c
(gdb) p &V15
p &V15
Address requested for identifier "V15" which is in register $r25
(gdb) p V16
p V16
$6 = (union lispunion *) 0x28a24c
(gdb) p &V16
p &V16
Address requested for identifier "V16" which is in register $r23
(gdb) 
bt
bt
#0  GBC (t=t_cons) at gbc.c:977
#1  0x0002f158 in make_cons (a=0x2e1f98, d=0x2e1f98) at alloc.c:338
#2  0x00081cb8 in append (x=0x540d70, y=0x2e1f98) at list.d:377
#3  0x00198900 in LI2 (V9=0x5398d0, V10=0x539650) at cmpinline.c:59
#4  0x001e545c in LI1 (V2=0x2e1f98) at cmplet.c:147
#5  0x000396bc in call_sfun_no_check (fun=0x372af8) at eval.c:118
#6  0x0003b254 in funcall_no_event (fun=0x372af8) at eval.c:360
#7  0x0003cf78 in super_funcall_no_event (fun=0x372af8) at eval.c:758
#8  0x001ba0d8 in L12 () at cmpeval.c:654
#9  0x001b89d4 in LI2 (V7=0x2f4320) at cmpeval.c:104
#10 0x001ba3f0 in L12 () at cmpeval.c:722
#11 0x001b89d4 in LI2 (V7=0x2f4320) at cmpeval.c:104
#12 0x001bc838 in LI20 (V168=0x539f30) at cmpeval.c:1298
#13 0x001a6470 in LI2 (V10=0x539c00) at cmpblock.c:71
#14 0x000396bc in call_sfun_no_check (fun=0x36dea0) at eval.c:118
#15 0x0003b254 in funcall_no_event (fun=0x36dea0) at eval.c:360
#16 0x0003cf78 in super_funcall_no_event (fun=0x36dea0) at eval.c:758
#17 0x001ba0d8 in L12 () at cmpeval.c:654
#18 0x001b89d4 in LI2 (V7=0x2f4320) at cmpeval.c:104
#19 0x001bc838 in LI20 (V168=0x539bf0) at cmpeval.c:1298
#20 0x001b581c in LI23 (V187=0x2e1f98, V188=0x539bf0) at cmpenv.c:1549
#21 0x001dc2b0 in LI9 (V36=0x539b60) at cmplam.c:755
#22 0x001fe294 in LI7 (V81=0x539e40) at cmptop.c:812
---Type <return> to continue, or q <return> to quit---q
q
Quit
(gdb) frame 14
frame 14
#14 0x000396bc in call_sfun_no_check (fun=0x36dea0) at eval.c:118
118       SET_TO_APPLY(base[0],(object (*)())fun->sfn.sfn_self,n,base);
(gdb) 
l 100
l 100
95        else
96          {int j;
97           x=temp_ar;
98           for (j=0; j<n ; j++)
99             {enum ftype typ=SFUN_NEXT_TYPE(i);
100             x[j]=COERCE_ARG(vs_base[j],typ);}}
101       SET_TO_APPLY(res,(object (*)())fun->sfn.sfn_self,n,x);
102       base[0]=
103         (restype==f_object ?  res :
104          restype==f_fixnum ? make_fixnum((long)res)
(gdb) l 60
l 60
55      #define SET_TO_APPLY(res,f,n,x) \
56       switch(n) {\
57       case 0:   res=(*f)(); break;\
58        case 1:  res=(*f)(x[0]); break; \
59        case 2:  res=(*f)(x[0],x[1]);break; \
60        case 3:  res=(*f)(x[0],x[1],x[2]);break; \
61        case 4:  res=(*f)(x[0],x[1],x[2],x[3]);break; \
62        case 5:  res=(*f)(x[0],x[1],x[2],x[3],x[4]);break; \
63        case 6:  res=(*f)(x[0],x[1],x[2],x[3],x[4],x[5]);  break;\
64        case 7:  res=(*f)(x[0],x[1],x[2],x[3],x[4],x[5], x[6]); break;\
(gdb) 


65        case 8:  res=(*f)(x[0],x[1],x[2],x[3],x[4],x[5], x[6],x[7]); break;\
66        case 9:  
res=(*f)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8]);break;\
67        case 10: 
res=(*f)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9]);break;\
68         default: res=c_apply_n(*f,n,x); break;}
69      
70      /*
71      #undef SET_TO_APPLY
72      #define SET_TO_APPLY(res,f,n,x)  res=c_apply_n(f,n,x);
73      */
74      
(gdb) 

75      /* for t_sfun,t_gfun with args on vs stack */
76      
77      void
78      quick_call_sfun(object fun)
79      { DEBUG_AVMA
80        int i,n;
81        enum ftype restype;
82        object *x,res,*base;
83        object temp_ar[10];
84        i=fun->sfn.sfn_argd;
(gdb) p i
p i
No symbol "i" in current context.
(gdb) l
l
85        n=SFUN_NARGS(i);
86        base = vs_base;
87        if (n != vs_top - base)
88          {check_arg_failed(n);}
89        restype = SFUN_RETURN_TYPE(i);
90        SFUN_START_ARG_TYPES(i);
91        /* for moment just support object and int */
92      #define COERCE_ARG(a,type)  (type==f_object ? a : (object)(fix(a)))
93        if (i==0)
94          x=vs_base;
(gdb) 
p n
p n
$7 = 1
(gdb) p &n
p &n
$8 = (int *) 0xbff04088
(gdb) 

=============================================================================

> lamont
> 
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gcl-devel
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah



reply via email to

[Prev in Thread] Current Thread [Next in Thread]