read/write calls inside kaffe

Stefan Burstroem f94sbu at efd.lth.se
Thu Apr 15 05:42:06 PDT 1999


Hi!
I have almost gotten kaffe1.0b4 running again under AmigaOS and there are a
few things I stumbled over when I tried to do this that I think might be of
interest:

The AWT calls fread fopen etc. on files without going the Kaffe system call
interface. Is that really thread safe on all thread systems?



Another maybe even more interesting thing is the JIT.
On m68k it was pointed out that the JIT doesn't work if the rest of the
code assumes that the callee saves its scratch registers. I have a few
things I'd like to add to that in general terms:

It seems as if right now, kaffe is always saving all its registers into the
temp and stack slots before doing a function call. Correct? If you could
rely on callee saved registers it would mean that the caller doesn't have
to save its registers to the temp/local/stack slots For short function
calls, this could speed up performance considerably. However this adds a
new problems: Exceptions. Since I guess the JVM specs requires you to have
the stack 'valid' when the stack is rewinded this requires you to retreive
the saved registers when you wind up the stack. (since the function that
finally catches the exception has to have all its registers correct.)
On m68k this would mean that while you are winding up the stack, you
execute the movem (fp),dx-dy/ar-as (and the equiv fp one for each stack
frame you wind up. As a side effect,you could actually execute the whole
epilogue of the function to include the unlink a6 insn too :)
Finally, the function catching the exception simply pushes the contents of
the registers into the temp/stack/local slots and executes the exception
handler. The good thing with this is that it doesn't increase any code
size. The code to push the values is already there, it is just moved to the
exception handler and the code to push values in a function without catch
doesn't have to push/reload any registers any longer.

Did this make sence to anyone?
Tim, is this something you have in the pipeline for the next version of the
JIT (the one you mentioned earlier) or is it something no one has worked on?


Anyone (but me ;) that is interested in looking more into this? M68k asm is
like my second language so it might be so that it is mostly m68k that would
benefit from this, but in general I think the idea should be applicable to
most platforms.


Comments?


regards, Stefan Burstroem

-----------------------------------------------------------------------
>> Irl: Stefan Burstroem <<  >> Omnipresence Intl. <<  >> Irc: Yabba <<
 >> Phone: +46 (0)46-211 40 84 << >> EMail: stefan at omnipresence.com <<
-----------------------------------------------------------------------



More information about the kaffe mailing list