[kaffe] porting & debugging

Dalibor Topic robilad@yahoo.com
Wed Apr 9 07:40:01 2003


Hi Gerlando,

--- Gerlando Falauto <iurly@writeme.com> wrote:
> 
> Hi folks,
> 
> I am trying to port kaffe-1.0.7 (eventually the jit
> engine too) to yet
> another platform (a weird, proprietary VLIW
> processor), and after several
> weeks of struggling because of the limitations of
> the compiler (no int64
> support, limited availability of system calls and so
> on...) I finally 
> got to the part where I am able to run
> HelloWorldApp. Yippie!

Congratulations! Seems like you've had to overcome
some really nasty obstackles. That's an impressive
achievement, really. I bet ports to other
'non-standard' platforms, like MINIX, could benefit
from some of your work, especially the int64
capsuling.
 
> Before I take a path that could lead to suicide,

Please make sure you send us your patches with
changelogs, before you take any terminal steps. ;) Or
even better, don't take that path at all ...

> which is trying to work
> on the JIT (and I know for sure suicide is where I
> am headed), I would

Others have looked at the JIT code, and haven't killed
themselves yet. Relax. Get out more, and you'll feel
much better about the JIT ;)

> like to get threads to work, but I can't figure any
> way out of this.
> 
> Here's what I have essentially done so far:
> 
> * Packaged a library of functions to operate on
> 64-bit types (struct of
> two 32-bit integers) and replaced every operation
> between jlong variables
> with the appropriate function call

That sounds quite useful for some other platforms as
well, so it's be nice if you could send in a patch.

> * Implemented sysDepCallMethod() using the target
> assembly
> * Defined COMPARE_AND_EXCHANGE in plain C (there is
> no support for 
> inline asm), using a mutex to protect the code
> (there is no atomic 
> exchange operation in the target assembly)

o.k., sounds nice as well. A patch would be welcome.

> * Enabled unix-pthreads as the thread system
> * Implemented sem_* using a condition variable and a
> mutex
> * Disabled any Garbage Collector or Finalizer
> whatsoever

Is there a particular reason why you're not using
unix-jthreads? I believe that the pthreads threading
only really works on linux [1]. so unless you're
running linux on your target platform, you *could*
have more luck using jthreads.
 
> I really have no idea what this could be, so please
> don't spare me any 
> suggestion even if it's the most obvious or stupid
> thing in the world. 

Unfortunately, I don't know enough about threads to be
able to help you, but I'd suggest trying out jthreads
and seeing if that gets you any further.
 
> Lastly, one direct question: if I were to execute
> 
> System.out.println("Hello World!");
> 
> from within a native method, how would I do that?
> I suppose I should get class System, then take
> static 
> field out, and then call method println on it...
> How?

See
http://java.sun.com/docs/books/tutorial/native1.1/implementing/method.html

cheers and best of luck for your thesis,
dalibor topic

[1]
http://www.kaffe.org/pipermail/kaffe/2000-July/006733.html


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com