Post by j***@giantblob.comPost by Daniel FoeschPost by j***@giantblob.comHaving more registers would help.
Also, being able to map the entire 32bit target address space within the
64bit host application would simplify memory management enormously.
Emulating a 64 bit G5 would negate the address space advantage for
little gain in my opinion.
FWIW I had a look at trying to port the JITC to AMD64 on linux but I
didn't get far as it's almost impossible to debug the generated code.
Yeah, it's fun, ne? You shouldn't give up though, this is where I
learned some of my best debugging techniques. While everyone else is
running around with debuggers and using tools, I know solid
techniques, and can debug code just from reading it.
Fair enough, but you're reading the code at one level removed when
debugging the JIT! I'm used to debugging code generators where I can
read the assembler output side by side with the source and/or
intermediate code in order to spot discrepencies - when debugging the
JITed code from PearPC, I have no source to compare it with - just a
segfault thousands of instructions from the actual error :-(
Yeah, imagine how it was with me. Very few of my AltiVec changes ever
segfaulted anything. They just draw stuff weird. So I don't even
have any sort of baseline of where to look, or what functions to look
at.
Since establishing a good implementation, I've not had problems just
vectorizing it, because if I hit any graphical gliches, I was able to
always revert functions until it worked correctly, then eventually
narrow the code down to a single function.
Post by j***@giantblob.comDo you have any specific techniques for debugging the JITter? Do you
write specific PowerPC test cases etc. or you you rely on MacOS exposing
JIT bugs?
I generally rely on MacOS exposing the JITC bugs. It's a poor choice,
but it's about all that can be done. Actually, I also implemented an
AltiVec test suite that would generate C test cases that would allow
me to test AltiVec functions. It did help narrow down many of the
bugs that were in the generic code path.
Post by j***@giantblob.comPost by Daniel FoeschI very rarely have use for a debugging program anymore. People at
Microsoft sometimes tell me to break out the perl debugger to see what
the code is doing, and I'm like, "I know what the code is doing. It's
right there for me to read."
To be honest I seldom use a debugger either - people at work think I'm
some kind of Luddite - but I find using a debugger leads to a
potentially endless cycle of ill thought out alterations whereas a
rigorous re-reading of the code produces better results, plus improving
one's understanding of the code is always good.
I don't know if I have any notions like that, but I certainly don't
find much use for debuggers most of the time anymore. I've used them
occationally when I have a random segfault, and the program isn't
generating output, so where is the segfault? Gotta find it somehow.
So, I compile up the program with debugging support, start up the
debugger, start the program then when it segfaults, I know where it
segfaulted at.
This was done a couple times with PearPC, I believe, or maybe some
other emulator. But yeah, sometimes there's just a ridiculous amount
of codepath to cover, and you don't know where to start. In that
case, debuggers work for me.
At work, people keep telling me to "use the debugger and find out what
the problem is." I'm usually like, "uh, I already know where the
problem is. I read the code." Or something like that.
Back in my days of DOS programming, I had programs that couldn't be
attached to a debugger. Mainly because they took over the video
display, and the keyboard driver, and thus, there was no way to give
keyboard control back so that it could be debugged. I also installed
timer interrupts that got generated often, and had to be handled, and
breaking execution in order to look at these things would cause too
many interrupts per screen, and would screw things up.
Basically, I've programmed and debugged so long without one that
debuggers are mostly useless to me, as long as I can get deterministic
output from the program. If it's some closed source black-box, then
I'm stuck... which frustrates me about Windows itself to no end. ;)
Post by j***@giantblob.comPost by Daniel FoeschIf you get good at debugging a JITC compiler, then you'll be good at
debugging just about anything.
I can see that. Unfortunately I've not had the time to look at it
recently - in the middle of big project at work plus also have exams :-(
Hopefully I'll have another shot next month.
No problem man; just remember, working on PearPC got me my job at
Microsoft. It got me on the map (actually, it got Sebastian on the
map, who pointed them to me. It's like being the suburb of a big
city, heh)
So, don't let anyone tell you that contributing to Open Source doesn't
pay. It develops skills exposes your talents, and generally over all
is good for your teeth. (I made that last one up.)
--
Daniel Foesch