harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Weldon Washburn" <weldon...@gmail.com>
Subject [jchevm] Harmony Class Lib does "Hello World" on a GNU Classpath JVM
Date Wed, 08 Mar 2006 23:49:36 GMT

I can now run the below multithread Hello.java on JCHEVM using Apache
Harmony Class Library.  The output toggles between clumps of "Hello
World" and clumps of "*" as WindowsXP schedules the two application
threads.  This is behavior I would expect. I use System.out.write()
because System.out.println() does not work yet.   A summary follows:

Mods to JCHEVM to get it to work
I was not able to find the _JC_LIB_ENTRY that is intended for
read/writing files.  I gave up and "borrowed"
JCNI_java_lang_VMThread_nativeSetPriority().  Instead of actually
changing thread priority, it now does a "fprintf(stdout, "%s",
&priority); fflush(stdout);"  Perhaps you can tell me what native
method I should be using.
I commented out some stuff in bootstrap.c that was dragging in
specific gnu classpath *.class files like "Lgnu/classpath/Pointer;" 
We should discuss the best solution for this item.

Harmony Class Lib that were modified to get it to work:
Runtime.java -- expected "wrapper" code. e.g., add VMRuntime.exit() to
Method.java, Field.java, Constructor.java -- minor mods
System.java -- added VMSystem.setOut, setErr... etc
ThreadGroup.java  -- wrappers
Class.java  -- wrappers
Object.java -- wrappers
String.java -- implemented a very simple intern()
Thread.java -- added a bunch of fields that JCHEVM accesses, added
code to start() to create ThreadGroup.root if it does not already
Throwable.java  -- wrappers
ClassLoader.java -- commented out "abstract" keyword on class
definition (too lazy to create a sub-class), added fields that JCHEVM
accesses, added code getSystemClassLoader to actually create an object
and stuff it in systemClassLoader if it does not already exist. added
a bunch of wrapper code.
OSMemory -- hacked out a bunch of stuff that was in the way
OSFileSystem -- add an ugly hack in writeImpl() to revector chars to

One last item.  I don't know which SVN repository to place this work
in.  Any suggestions?



class Hello extends Thread {

public static void main(String args[])

   byte [] ba = new byte[64];

   ba [0] = 'H'; ba [1] = 'e'; ba [2] = 'l'; ba [3] = 'l'; ba [4] = 'o';

   ba [5] = ' '; ba [6] = 'W'; ba [7] = 'o'; ba [8] = 'r'; ba [9] =
'l';  ba[10] = 'd'; ba[11] = ' ';

   Thread tr = new Hello();

   while (true) {
      for (int qq = 0; qq < 12; qq++) {


public void run() {
    while(true) {

Weldon Washburn
Intel Middleware Products Division

View raw message