Re: Git development
Wolfgang Jansen <[email protected]> Mon, 17 Aug 2009 16:01:48 +0200
| Newsgroups | gmane.comp.lang.eiffel.gobo.devel |
|---|---|
| Organization | University of Potsdam, Institute of Informatics |
| Message-ID | <[email protected]> |
Hi Howard,
> Hi Wolfgang,
>
> On Saturday 15 August 2009, you wrote:
>
> > May it help you to re-use my introspection code?
>
> > It sees all references on stack, all global references (i.e. values of
>
> > once functions)
>
> > and, starting on these references, all references on heap.
>
> Yes, it would be useful [necessary ...] to ensure that there is one
> way to make
>
> available, to both the GC and debugger, all relevant info.
>
> The specific code generation case that I was referring to is where C
> code is generated
>
> with two or more arguments to a routine [excluding Current], each of
> which is a memory-allocating
>
> funtion that returns a reference [where the return value is the only
> extant reference], and therefore
>
> the GC needs to have access to a value that is not a declared C variable.
>
> In C terms:
>
> void * f_allocate() {
>
> /* This routine allocates memory [create ...] and may instigate a GC
> collection */
>
> return(GC_alloc_memory(...));
>
> }
>
> void called_routine(void *a_Current, void *a1, void *a2) {
>
> /* do something [not relevant] with arguments */
>
> xxx = a1;
>
> yyy = a2;
>
> }
>
> If the routine call:
>
> called_routine(Current, f_allocate(), f_allocate());
>
> occurs in the generated C code then the GC, if invoked from the
> f_allocate call that occurs second, then
>
> the one and only reference to the memory returned by the first
> f_allocate call is only accessible via a
>
> C compiler unnamed temporary.
>
> Does your stack tracing code track, precisely, i.e. not
> conservatively, such compiler temporaries ?
>
No yet. Printing arguments and local variables does not need this
and checkpointing not either since the call to the debugger
happens, currently, always before an instruction, in particular
before the temporaries are set to new values. In other words, in case of
x := f(g(y))
there is one break at the beginning of the line but not before
the calls to functions `f' and `g'.
Things will be different if the debugger is called also before
function calls (planned in future). The function arguments are often
temporaries and need to be stored by checkpointing
(or checkpointing must be allowed in front of instructions only).
Anyway, I will think about the problem how to extract the information
about temporaries from the compiler classes (putting the information
to introspection classes and making it available during runtime is easy).
>
> Do you develop on Windows or Linux ?
>
On Sun Solaris, a Unix variant.
>
> If you want to look at [an earlier version of] my code, it is
> available at:
>
> www.ashford-ht.vm.bytemark.co.uk as a compressed tar download,
> admittedly more suitable for Linux developers ...
>
>
Thanks, I got the sources and the Linux version.
WJ
PS:
Below is the (slightly simplified) initial part of C code of STRING_8.append
as generated for debugging.
1 void T17f42(GE_ZS* ac, T0* C, T0* a1)
2 {
3 GE_ZS tc = {0,0,ac};
4 T1 t1;
5 T6 t2;
6 T0* t3;
7 T6 l1 = 0;
8 T6 l2 = 0;
9 T6 l3 = 0;
10 static T0* f = (T0*)0;
11 if (!f) {
12 T82f77(&tc, (T0*)GE_zrts, 17, 1)
13 T82f99(&tc, (T0*)GE_zrts, f, (size_t)&C-(size_t)&tc, 0)
14 T82f99(&tc, (T0*)GE_zrts, f, (size_t)&a1-(size_t)&tc, 1)
15 T82f99(&tc, (T0*)GE_zrts, f, (size_t)&l3-(size_t)&tc, 3)
16 T82f99(&tc, (T0*)GE_zrts, f, (size_t)&l2-(size_t)&tc, 4)
17 T82f99(&tc, (T0*)GE_zrts, f, (size_t)&l1-(size_t)&tc, 5)
18 }
19 tc.routine = f;
20 GE_zpos(&tc, 655, 0);
21 l2 = (((T17*)(GE_void(a1)))->a2);
22 ....
23 }
Line 1 : `ac' is the stack descriptor of the caller;
type GE_ZS is a C struct, not Eiffel
Line 3 : `tc' is the stack descriptor of the current routine
(`ac', `tc' are re-used from GOBO's code tracing)
Line 10: `f' is a pointer to an IN_ROUTINE object
Line 12: `f' is set by the object describing the current routine;
GE_zrts is the root introspection object (global variable)
Line 13 .. 17: offsets of the local variables relative to `tc' are set
in `f';
more lines are needed if temporary variables are of interest.
Line 19: set `f' in stack descriptor
Line 20: call debugger with stack descriptor, source line number 655
and reason of break
Other uses of routine descriptors (say by GC) will need the additional code
of lines 1, 3, 10, 12, 13 .. 17 (as many as needed), 19.
After that `tc' is ready and detailed information may be extracted
(as done by the debugger in line 20).
Instead of the additional argument `ac' a global pointer
to the top most stack descriptor might be used.
--
Dr. Wolfgang Jansen
University of Potsdam, Germany
Institute of Computer Science
Tel: +49 331 / 977 3047
mailto: [email protected]
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july