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

Re: d2c on Macintosh (help!)



On Tue, Dec 21, 1999 17:00 Uhr, Rob Myers <mailto:robm@lostwax.com> wrote:
>Hi.
>
>I have a c-code version of d2c that quite happily compiles the
hello-world,
>streams-demo and craps demos from the Gwydion Dylan distribution.
>The only problem is that if I try to compile the dylan or base libraries
(in
>an attempt to bootstrap fully), it crashes. It crashes seemingly randomly,
>and so badly that I'm lucky if I can get a MACSbug log.
>
>The logs I have got indicate something is badly wrong with the memory
header
>block for the d2c application zone. The garbage collector demo works fine,
>and I'm using Patrick Beard's latest port of the Boehm GC so if it's a GC
>problem, it's 99.99% certain it's something I'm doing. The only other
>candidates are my text stream code hack, although I don't see how this
could
>be the problem, the amount of time d2c might go without calling SystemTask
>(or friends) and CodeWarrior Pro 5 itself(I don't own 4, although I'm
about
>to try the MrC plug-in).
>
>Anyone who can help, please get in touch. I need people who aren't afraid
of
>MACSBug. :-) I can bundle up source code if needed (c generated by a Mindy
>bytecode version of d2c), although advice and suggestions will be
gratefully
>received.
>
>- Rob.
>

Hi Rob,

I assume this is a PowerPC problem and that bootstrapping in 68k emulation
is too slow to be tried (it sometimes helps to switch architectures if
strange things happen). Also I think you use Macsbug 6.6.

Some things come to my mind.

1) I usually have such hard crashes if the stack expands into the heap. You
can guard against this if you put some ppc watchpoints in the area behind
the gd heap zone. Or you can write some patter here and check it for
integrity from a frequently invoked routine. If this is the cause then
SetApplLimit is your friend.

2) If you use trampolines with dynamically generated machine code
(shouldn't be necessary on ppc bacause of TVectors) then do not forget to
correctly invalidate the instruction cache for the block(s) the trampolines
will go into. Though, this does not usually corrupt the heap zone.

3) From CW or Macsbug set watchpoints onto the zone header. This may stop
your program just when the corruption occurs.

Hope this helps and thanks for your efforts bringing gd to the Mac!

	Gabor

PS: Do you directly feed the output of gd into the CW C compiler plugin? If
you plan to do so, drop me a note, I did this earlier with a toy project
(68k based plugin but ppc based should be similar) with nice results.





Follow-Ups: