Only in jikes-original/rvm: .cvsignore
diff -ru --expand-tabs jikes-original/rvm/_timestamp/timestamp javana-0.1/jikes/source/rvm/_timestamp/timestamp
--- jikes-original/rvm/_timestamp/timestamp	2006-10-25 08:36:37.526322736 +0200
+++ javana-0.1/jikes/source/rvm/_timestamp/timestamp	2006-10-25 08:27:29.836584232 +0200
@@ -1 +1 @@
-2005/10/12 19:56:58 UTC
+2005/10/27 04:00:34 UTC
diff -ru --expand-tabs jikes-original/rvm/bin/runrvm javana-0.1/jikes/source/rvm/bin/runrvm
--- jikes-original/rvm/bin/runrvm	2006-10-25 08:36:42.846513944 +0200
+++ javana-0.1/jikes/source/rvm/bin/runrvm	2006-10-25 08:27:29.931569792 +0200
@@ -286,7 +286,8 @@
 shopt -s execfail
 
 (( ! dbg )) || echo LD_PRELOAD="${preload}" exec "$prog" "${sys_args[@]}" "${classpath_arg[@]}" "${user_args[@]}"
-LD_PRELOAD="${preload}" exec "$prog" "${sys_args[@]}" "${classpath_arg[@]}" "${user_args[@]}"
+# LD_PRELOAD="${preload}" exec "$prog" "${sys_args[@]}" "${classpath_arg[@]}" "${user_args[@]}"
+LD_PRELOAD="$LD_PRELOAD":"${preload}" exec "$prog" "${sys_args[@]}" "${classpath_arg[@]}" "${user_args[@]}"
 declare -r -i status=$?
 echo >&2  "$ME: Failed to execute $prog (command status $status); can't run Jikes RVM"
 exit $status
diff -ru --expand-tabs jikes-original/rvm/src/tools/bootImageRunner/sys.C javana-0.1/jikes/source/rvm/src/tools/bootImageRunner/sys.C
--- jikes-original/rvm/src/tools/bootImageRunner/sys.C	2006-10-25 08:36:38.120232448 +0200
+++ javana-0.1/jikes/source/rvm/src/tools/bootImageRunner/sys.C	2006-10-25 08:27:31.957261840 +0200
@@ -44,6 +44,7 @@
 #include <sys/stat.h>
 #include <sys/sysinfo.h>
 #include <netinet/in.h>
+//#include <linux/net.h>
 #include <signal.h>
 #include <sys/ioctl.h>
 #include <asm/ioctls.h>
@@ -133,6 +134,110 @@
 #define MANGLE16(x) x
 #endif
 
+static int threadswitches = 0;
+static int objects = 0;
+static int compilations = 0;
+
+extern "C" int
+sysStartThread(int tid, void * stack, int length) 
+{
+  // fprintf(stderr, "[ignore] start thread %d, %p, %d\n", tid, stack, length);
+  return 1;
+}
+
+extern "C" int
+sysNewStack(int tid, void * stack, int length) 
+{
+  // fprintf(stderr, "[stack] start thread %d, %p, %d\n", tid, stack, length);
+  return 1;
+}
+
+extern "C" int
+sysTerminateThread(int tid) 
+{
+  // fprintf(stderr, "[ignore] terminate thread %d\n", tid);
+  return 1;
+}
+extern "C" int
+sysThreadSwitch(int otid, int ntid) 
+{
+  // fprintf(stderr, "[ignore] thread switch to thread %d\n", tid);
+  threadswitches++; 
+  return 1;
+}
+
+extern "C" int
+sysIgnore(int mid, void * address, int size)
+{
+  //  fprintf(stderr, "[ignore] method %d, addresss %d, size %d\n", mid, address, size);
+  return 1;
+}
+
+extern "C" int
+sysMethod(int mid, char * name, int type)
+{
+  //  fprintf(stderr, "[method] id %d, name %s, type %d\n", mid, name, type);
+  return 1;
+}
+
+extern "C" int
+sysType(int tid, char * name)
+{
+  //  fprintf(stderr, "[type] id %d, %s\n", tid, name);
+  return 1;
+}
+
+// @TODO: add line info
+extern "C" int
+sysAllocateObject(int tid, void * address, int size)
+{
+  //  fprintf(stderr, "[allocate object] type %d, address %p, size %d\n", tid, address, size);
+  objects++;
+  return 1;
+}
+
+extern "C" int
+sysCopyObject(int tid, void * fromAddress, int fromSize, void *toAddress, int toSize)
+{
+  //  fprintf(stderr, "[copy object] type %d, from address %p, from size %d, to address %p, to size %d\n", tid, fromAddress, fromSize, toAddress, toSize);
+  return 1;
+}
+
+extern "C" int
+sysAllocateCode(int mid, int line, void * address, int size)
+{
+  compilations++;
+  //  fprintf(stderr, "[allocate code] method %d, line %d, address: %p, size %d\n", mid, line, address, size);
+  return 1;
+}
+
+extern "C" int
+sysRelocateCode(void * fromAddress, int fromSize, void *toAddress, int toSize)
+{
+  //  fprintf(stderr, "[move code] from address %p, from size %d, to address %p, to size %d\n", fromAddress, fromSize, toAddress, toSize);
+  return 1;
+}
+
+extern "C" int
+sysFreeMemory(void * address, int size) 
+{
+  //  fprintf(stderr, "[free] address %p, size %d\n", address, size);
+  return 1;
+}
+
+extern "C" int
+sysStartGC() 
+{
+  //  fprintf(stderr, "[start GC]\n");
+  return 1;
+}
+
+extern "C" int
+sysStopGC() 
+{
+  //  fprintf(stderr, "[stop GC]\n");
+  return 1;
+}
 
 //---------------------------//
 // Environmental operations. //
@@ -216,6 +321,10 @@
     if (value != 0)
         fprintf(SysErrorFile, "%s: exit %d\n", Me, value);
 
+    fprintf(SysErrorFile, "objects allocated: %d\n", objects);
+    fprintf(SysErrorFile, "thread switches: %d\n", threadswitches);
+    fprintf(SysErrorFile, "methods compiled: %d\n", compilations);
+    
     fflush(SysErrorFile);
     fflush(SysTraceFile);
     fflush(stdout);
@@ -808,6 +917,7 @@
 
         howLong.tv_sec = 0;
         howLong.tv_nsec = ns;
+
         errno = 0;
         int errorCode = nanosleep( &howLong, &remaining );
         if (errorCode) {
@@ -887,11 +997,15 @@
      * just appear to be hung. 
      */
 #if (!defined RVM_FOR_GCTRACE)
-    if (longest_stuck_ticks > 5001) {
+// !!!
+//    if (longest_stuck_ticks > 5001) {
+    if (longest_stuck_ticks > 50001) {
         fprintf(stderr, "%s: Exiting VM due to suspected deadlock\n", Me);
         sysExit(EXIT_STATUS_TIMER_TROUBLE); }
 #endif
-    if (longest_stuck_ticks >= 500 && (longest_stuck_ticks % 100) == 0) {
+    if (longest_stuck_ticks >= 500 && (longest_stuck_ticks % 10000) == 0) {
+// !!!
+//    if (longest_stuck_ticks >= 500 && (longest_stuck_ticks % 100) == 0) {
       /* When performing tracing, delays will often last more than 5
        * seconds and can take much, much longer (on a fairly fast
        * machine I've seen delays above 1 minute).  This is due to a
diff -ru --expand-tabs jikes-original/rvm/src/vm/VM.java javana-0.1/jikes/source/rvm/src/vm/VM.java
--- jikes-original/rvm/src/vm/VM.java	2006-10-25 08:36:41.326744984 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/VM.java	2006-10-25 08:27:32.882121240 +0200
@@ -365,6 +368,9 @@
     if (verboseBoot >= 1) VM.sysWriteln("Initializing socket factories");
     JikesRVMSocketImpl.boot();
 
+    // Process methods being booted.
+    VM_Method.boot();
+ 
     //-#if RVM_WITH_ADAPTIVE_SYSTEM
     if (verboseBoot >= 1) VM.sysWriteln("Initializing adaptive system");
     com.ibm.JikesRVM.adaptive.VM_Controller.boot();
@@ -472,8 +478,12 @@
       if (verboseBoot >= 2) {
         VM.sysWriteln(classObjects[i].toString()); 
       }
+    
       classObjects[i].getClassForType();
-    }
+      
+      // Communicate the type to DIOTA:
+      //classObjects[i].communicate();
+     }
   }
 
   /**
diff -ru --expand-tabs jikes-original/rvm/src/vm/arch/intel/assembler/VM_Assembler.in javana-0.1/jikes/source/rvm/src/vm/arch/intel/assembler/VM_Assembler.in
--- jikes-original/rvm/src/vm/arch/intel/assembler/VM_Assembler.in	2006-10-25 08:36:40.983797120 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/arch/intel/assembler/VM_Assembler.in	2006-10-25 08:27:32.277213200 +0200
@@ -191,7 +191,6 @@
    * expand its buffer if it becomes full. 
    *
    * @param bytecodeSize initial machine code buffer size.
-   * @param shouldPrint whether to dump generated machine code.
    */
   public VM_Assembler (int bytecodeSize) {
     this(bytecodeSize, false);
@@ -219,7 +218,7 @@
    *
    * @param bytecodeSize initial machine code buffer size.
    * @param shouldPrint whether to dump generated machine code.
-   * @param compiler VM_Compiler instance that this assembler is associated with;
+   * @param comp VM_Compiler instance that this assembler is associated with;
    *                 currently ignored on IA32.
    */
   public VM_Assembler (int bytecodeSize, boolean shouldPrint, VM_Compiler comp) {
@@ -556,7 +555,7 @@
    * @see #emitRegDispRegOperands
    *
    * @param reg1 the r/m operand
-   * @param the other register or extended opcode
+   * @param reg2 the other register or extended opcode
    */
   private void emitRegIndirectRegOperands(byte reg1, byte reg2) {
       if (reg1 == EBP) {
@@ -636,7 +635,7 @@
    *  Generate the smallest-byte-first IA32 encoding of 32 bit
    * immediates into the generated code.
    *
-   * @param imm the immediate to generate.
+   * @param disp the displacement to generate.
    */
   private void emitImm32(Offset disp) {
       if (VM.VerifyAssertions) VM._assert(fits(disp,32));
diff -ru --expand-tabs jikes-original/rvm/src/vm/classLoader/VM_Atom.java javana-0.1/jikes/source/rvm/src/vm/classLoader/VM_Atom.java
--- jikes-original/rvm/src/vm/classLoader/VM_Atom.java	2006-10-25 08:36:38.753136232 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/classLoader/VM_Atom.java	2006-10-25 08:27:33.326053752 +0200
@@ -528,7 +528,6 @@
     return findOrCreate(val, 1, val.length - 1);
   }
 
-
   private static final byte[][] bootstrapClassPrefixes 
     = { "Ljava/".getBytes(), 
         "Lcom/ibm/JikesRVM/".getBytes(),
@@ -537,6 +536,11 @@
         "Lorg/vmmagic/".getBytes(),
         "Lorg/mmtk/".getBytes()};
 
+  private static final byte[][] trueBootstrapClassPrefixes 
+    = { "Ljava/".getBytes(), 
+        "Lgnu/java/".getBytes(),
+        "Lgnu/classpath/".getBytes()};
+
   private static final byte[][] rvmClassPrefixes 
     = { "Lcom/ibm/JikesRVM/".getBytes(),
         "Lorg/vmmagic/".getBytes(),
@@ -559,7 +563,20 @@
     }
     return false;
   }
-    
+ 
+  public final boolean isTrueBootstrapClassDescriptor() {
+  outer:
+    for (int i = 0; i < trueBootstrapClassPrefixes.length; i++) {
+      byte[] test = trueBootstrapClassPrefixes[i];
+      if (test.length > val.length) continue outer;
+      for (int j = 0; j < test.length; j++) {
+        if (val[j] != test[j]) 
+          continue outer;
+      }
+      return true;
+    }
+    return false;
+  }
 
   /**
    * @return true if this is a class descriptor of a RVM core class.  This is
diff -ru --expand-tabs jikes-original/rvm/src/vm/classLoader/VM_Method.java javana-0.1/jikes/source/rvm/src/vm/classLoader/VM_Method.java
--- jikes-original/rvm/src/vm/classLoader/VM_Method.java	2006-10-25 08:36:38.806128176 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/classLoader/VM_Method.java	2006-10-25 08:27:33.311056032 +0200
@@ -7,7 +7,6 @@
 import com.ibm.JikesRVM.*;
 import java.io.DataInputStream;
 import java.io.IOException;
-
 import org.vmmagic.pragma.*;
 
 /**
@@ -30,6 +29,11 @@
   protected final VM_TypeReference[] exceptionTypes;      
 
   /**
+   * A boolean indicating whether the method name has been communicated to DIOTA.
+   */
+  private boolean communicated = false;
+  
+  /**
    * @param declaringClass the VM_Class object of the class that declared this field
    * @param memRef the canonical memberReference for this member.
    * @param modifiers modifiers associated with this member.
@@ -41,7 +45,45 @@
     memRef.asMethodReference().setResolvedMember(this);
     this.exceptionTypes = exceptionTypes;
   }
+
+  private static int VM_METHOD = 1;
+  private static int BOOTSTRAPCLASSPATH_METHOD = 2;
+  private static int APPLICATION_METHOD = 3;
+  
+  public final void communicate() throws NoOptCompilePragma {
+    if (VM.writingBootImage) {
+      return;
+    }
+ 
+    if (communicated) {
+      return;
+    }  
   
+    VM_Atom descriptor = getDeclaringClass().getDescriptor();
+    
+    if (!VM_Options.virtualMachineMethods && descriptor.isRVMDescriptor()) {
+      communicated = true;  // caching
+      return;
+    }
+      
+    if (!VM_Options.bootstrapClasspathMethods && descriptor.isTrueBootstrapClassDescriptor()) {
+      communicated = true;  // caching
+      return;
+    }
+    
+    if (descriptor.isRVMDescriptor()) {
+      VM_SysCall.sysMethod(getId(), toString().getBytes(), VM_METHOD);
+    }
+    else if (descriptor.isTrueBootstrapClassDescriptor()) {
+      VM_SysCall.sysMethod(getId(), toString().getBytes(), BOOTSTRAPCLASSPATH_METHOD);
+    }
+    else {
+      VM_SysCall.sysMethod(getId(), toString().getBytes(), APPLICATION_METHOD);
+    }
+    
+    communicated = true;  // caching
+  }
+
   /**
    * Called from {@link VM_Class#VM_Class(VM_TypeReference, DataInputStream)} to create an
    * instance of a VM_Method by reading the relevant data from the argument bytecode stream.
@@ -383,6 +425,34 @@
     }
   }
 
+  private static final void ignore(VM_Method method) {
+    // Resolve the method's code array:
+    VM_CodeArray code = method.getCurrentEntryCodeArray();
+    
+    // Resolve the method's start address:
+    org.vmmagic.unboxed.Address address = VM_Magic.objectAsAddress(code);
+   
+    // Tell DIOTA to ignore this method:
+    VM_SysCall.sysIgnore(method.getId(), address, code.length());
+  }
+  
+  public static final void boot() {
+    // Communicate the methods that DIOTA should ignore:
+    ignore((VM_Method)VM_Entrypoints.communicateObjectAllocation);
+    ignore((VM_Method)VM_Entrypoints.communicateObjectCopy);
+    ignore((VM_Method)VM_Entrypoints.communicateInstructions);
+    ignore((VM_Method)VM_Entrypoints.communicateMethod);
+    ignore((VM_Method)VM_Entrypoints.communicateType);
+
+    // Iterate over all methods in the boot image and print each method's instruction map.
+    VM_CompiledMethod[] compiledMethods = VM_CompiledMethods.getCompiledMethods();
+    for (int i = 0; i < VM_CompiledMethods.numCompiledMethods(); ++i) {
+      if (compiledMethods[i] != null) {
+        compiledMethods[i].communicate();
+      }
+    }
+  }
+  
   /**
    * Generate machine code for this method if valid
    * machine code doesn't already exist. 
diff -ru --expand-tabs jikes-original/rvm/src/vm/classLoader/VM_Type.java javana-0.1/jikes/source/rvm/src/vm/classLoader/VM_Type.java
--- jikes-original/rvm/src/vm/classLoader/VM_Type.java	2006-10-25 08:36:38.778132432 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/classLoader/VM_Type.java	2006-10-25 08:27:33.407041440 +0200
@@ -156,6 +156,10 @@
    */
   protected boolean acyclic;       
 
+  /**
+   * A boolean indicating whether the type has been communicated to DIOTA.
+   */
+  public boolean communicated;
 
   /**
    * Create an instance of a {@link VM_Type}
@@ -177,6 +181,24 @@
     VM_Statics.setSlotContents(getTibOffset(), tib);
   }
   
+  public final void communicate() throws NoOptCompilePragma {
+    if (VM.writingBootImage == true) {
+      return;
+    }
+
+    if (communicated == true) {
+      return;
+    }
+
+    VM_SysCall.sysType(getId(), getDescriptor().getBytes());
+    
+    communicated = true;  // caching
+  }
+
+  public final boolean isCommunicated() throws UninterruptiblePragma {
+    return communicated;
+  }
+  
   /**
    * Canonical type reference for this type.
    */
diff -ru --expand-tabs jikes-original/rvm/src/vm/compilers/compiledCode/VM_CompiledMethod.java javana-0.1/jikes/source/rvm/src/vm/compilers/compiledCode/VM_CompiledMethod.java
--- jikes-original/rvm/src/vm/compilers/compiledCode/VM_CompiledMethod.java	2006-10-25 08:36:38.966103856 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/compilers/compiledCode/VM_CompiledMethod.java	2006-10-25 08:27:33.519024416 +0200
@@ -62,6 +62,8 @@
    */
   protected VM_CodeArray instructions; 
 
+  private boolean communicated = false;
+
   //-#if RVM_WITH_OSR
   /**
    * Has the method sample data for this compiled method been reset?
@@ -236,7 +238,10 @@
    */
   public final void compileComplete(VM_CodeArray code) {
     instructions = code;
-    bitField1 |= COMPILED;
+    bitField1 |= COMPILED;      
+    
+    // Communicate the instruction map:
+    communicate();
   }
 
   /**
@@ -418,6 +423,65 @@
     return 0;
   }
 
+  public final void communicate() throws NoOptCompilePragma {
+    if (instructions == null) {
+      return;
+    }
+    
+    if (VM.writingBootImage == true) {
+      return;
+    }
+
+    if (communicated == true) {
+      return;
+    }
+
+    if (!VM_Options.virtualMachineMethods && getMethod().getDeclaringClass().getDescriptor().isRVMDescriptor()) {
+      communicated = true;  // caching
+      return;
+    }
+
+    if (!VM_Options.bootstrapClasspathMethods && getMethod().getDeclaringClass().getDescriptor().isTrueBootstrapClassDescriptor()) {
+      communicated = true;  // caching
+      return;
+    }
+
+    // Print the method:
+    method.communicate();
+
+    // Print the type:
+    //method.getDeclaringClass().communicate();
+    // This is now taken care of by VM_TypeReference.resolve()
+    
+    // Print the instructions:
+    Address base = VM_Magic.objectAsAddress(instructions);
+    Offset start = Offset.zero();
+    Offset current = Offset.zero();
+    int line = 0;
+    int last = 0;
+
+    for (int index = 0; index < instructions.length(); index++) {
+      current = Offset.fromIntSignExtend(index);
+      int ln = findLineNumberForInstruction(current);
+
+      // A hack to work around weird line number results from optimized code
+      if (ln > 0) { 
+        line = ln;
+      }
+
+      if (line != last) {
+        VM_SysCall.sysAllocateCode(method.getId(), last, base.add(start), current.sub(start).toInt());
+        start = current;
+        last = line;
+      }
+    }
+
+    // Communicate the last line and the instructions in the epilogue:
+    VM_SysCall.sysAllocateCode(method.getId(), line, base.add(start), current.sub(start).toInt() + 1);  // +1 because index is strictly smaller than instruction.length()
+
+    communicated = true;  // caching
+  }
+
   /**
    * Print this compiled method's portion of a stack trace 
    * @param instructionOffset offset of machine instruction from start of method
diff -ru --expand-tabs jikes-original/rvm/src/vm/memoryManagers/JMTk/vmInterface/MM_Interface.java javana-0.1/jikes/source/rvm/src/vm/memoryManagers/JMTk/vmInterface/MM_Interface.java
--- jikes-original/rvm/src/vm/memoryManagers/JMTk/vmInterface/MM_Interface.java	2006-10-25 08:36:38.680147328 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/memoryManagers/JMTk/vmInterface/MM_Interface.java	2006-10-25 08:27:34.936808880 +0200
@@ -41,6 +41,7 @@
 import com.ibm.JikesRVM.classloader.VM_Method;
 
 import com.ibm.JikesRVM.VM;
+import com.ibm.JikesRVM.VM_SysCall;
 import com.ibm.JikesRVM.VM_Magic;
 import org.vmmagic.unboxed.*;
 import org.vmmagic.pragma.*;
@@ -217,6 +218,60 @@
      } 
   }
 
+  //private static int depth;
+  
+  public static void communicateObjectAllocation(Object object) throws NoOptCompilePragma {
+    //depth++;
+    
+    //if (depth != 1) {
+    //  VM.sysWriteln("invalid depth!");
+    //  VM_Scheduler.dumpStack();
+    //}
+    
+    VM_Type type = VM_ObjectModel.getObjectType(object);
+    
+    // Communicate the type:
+    type.communicate(); 
+    
+    Address start = VM_ObjectModel.objectStartRef(ObjectReference.fromObject(object));
+    int size = VM_ObjectModel.bytesUsed(object);
+    
+    // Communicate the object's range:
+    int status = VM_SysCall.sysAllocateObject(type.getId(), start, size);
+    if (status != 1) {
+      VM.sysWriteln("failed communicating object");
+      VM_Scheduler.dumpStack();
+    }
+
+    //depth--;
+  }
+ 
+  public static void communicateObjectCopy(Object from, Object to) throws NoOptCompilePragma {
+    if (from instanceof VM_CodeArray) {
+      // NOTE: VM_CodeArray's are not used exclusively for code.  This means there will be false
+      //       possitives.
+      // NOTE: we calculate the start and length differently than we do for regular objects.  
+      //       This is because it needs to match the code in VM_CompiledMethod.java.
+      VM_CodeArray code = (VM_CodeArray)from;
+      
+      Address fromAddress = VM_Magic.objectAsAddress(from);
+      Address toAddress = VM_Magic.objectAsAddress(to);
+
+      VM_SysCall.sysRelocateCode(fromAddress, code.length(), toAddress, code.length());
+    }
+      
+    VM_Type type = VM_ObjectModel.getObjectType(from);
+    //type.communicate();
+    
+    Address fromAddress = VM_ObjectModel.objectStartRef(ObjectReference.fromObject(from));
+    int fromSize = VM_ObjectModel.bytesUsed(from);
+    
+    Address toAddress = VM_ObjectModel.objectStartRef(ObjectReference.fromObject(to));
+    //int toSize = VM_ObjectModel.bytesUsed(to);
+
+    VM_SysCall.sysCopyObject(type.getId(), fromAddress, fromSize, toAddress, fromSize);
+  }
+  
   /***********************************************************************
    *
    * Write barriers
@@ -567,6 +622,9 @@
     Object result = VM_ObjectModel.initializeScalar(region, tib, size);
     plan.postAlloc(ObjectReference.fromObject(result), 
                    ObjectReference.fromObject(tib), size, allocator);
+    
+    communicateObjectAllocation(result);
+    
     return result;
   }
 
@@ -603,6 +661,9 @@
                                                    size);
     plan.postAlloc(ObjectReference.fromObject(result), 
                    ObjectReference.fromObject(tib), size, allocator);
+    
+    communicateObjectAllocation(result);
+    
     return result;
   }
 
@@ -676,6 +737,7 @@
     }
     if (CHECK_MEMORY_IS_ZEROED) Memory.assertIsZeroed(region, bytes);
 
+    
     return region;
   }
 
diff -ru --expand-tabs jikes-original/rvm/src/vm/objectModel/default/VM_JavaHeader.java javana-0.1/jikes/source/rvm/src/vm/objectModel/default/VM_JavaHeader.java
--- jikes-original/rvm/src/vm/objectModel/default/VM_JavaHeader.java	2006-10-25 08:36:38.710142768 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/objectModel/default/VM_JavaHeader.java	2006-10-25 08:27:34.971803560 +0200
@@ -406,6 +406,8 @@
       if (VM_ObjectModel.HASH_STATS) VM_ObjectModel.hashTransition2++;
     }
 
+    MM_Interface.communicateObjectCopy(fromObj, toObj);
+    
     return toObj;
   }
   
diff -ru --expand-tabs jikes-original/rvm/src/vm/runtime/VM_BootRecord.java javana-0.1/jikes/source/rvm/src/vm/runtime/VM_BootRecord.java
--- jikes-original/rvm/src/vm/runtime/VM_BootRecord.java	2006-10-25 08:36:38.473178792 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/runtime/VM_BootRecord.java	2006-10-25 08:27:35.027795048 +0200
@@ -221,6 +221,22 @@
   Address sysIP;            
   //-#endif
 
+  // DIOTA instrumentation
+  public Address sysIgnoreIP;
+  public Address sysStartThreadIP;
+  public Address sysTerminateThreadIP;
+  public Address sysThreadSwitchIP;
+  public Address sysNewStackIP;
+  public Address sysMethodIP;
+  public Address sysTypeIP;
+  public Address sysAllocateObjectIP;
+  public Address sysCopyObjectIP;
+  public Address sysAllocateCodeIP;
+  public Address sysRelocateCodeIP;
+  public Address sysFreeMemoryIP;
+  public Address sysStartGCIP;
+  public Address sysStopGCIP;
+
   // lowlevel write to console
   public Address sysWriteCharIP;    
   public Address sysWriteIP;            
diff -ru --expand-tabs jikes-original/rvm/src/vm/runtime/VM_Entrypoints.java javana-0.1/jikes/source/rvm/src/vm/runtime/VM_Entrypoints.java
--- jikes-original/rvm/src/vm/runtime/VM_Entrypoints.java	2006-10-25 08:36:38.454181680 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/runtime/VM_Entrypoints.java	2006-10-25 08:27:35.045792312 +0200
@@ -34,6 +34,13 @@
   public static final VM_NormalMethod checkstoreMethod         = getMethod("Lcom/ibm/JikesRVM/VM_Runtime;", "checkstore", "(Ljava/lang/Object;Ljava/lang/Object;)V");
   public static final VM_NormalMethod athrowMethod             = getMethod("Lcom/ibm/JikesRVM/VM_Runtime;", "athrow", "(Ljava/lang/Throwable;)V");
 
+  // DIOTA-related entry points, DIOTA must ignore these calls:
+  public static final VM_NormalMethod communicateObjectAllocation = getMethod("Lcom/ibm/JikesRVM/memoryManagers.mmInterface/MM_Interface;", "communicateObjectAllocation", "(Ljava/lang/Object;)V");
+  public static final VM_NormalMethod communicateObjectCopy  = getMethod("Lcom/ibm/JikesRVM/memoryManagers.mmInterface/MM_Interface;", "communicateObjectCopy", "(Ljava/lang/Object;Ljava/lang/Object;)V");
+  public static final VM_NormalMethod communicateInstructions = getMethod("Lcom/ibm/JikesRVM/VM_CompiledMethod;", "communicate", "()V");
+  public static final VM_NormalMethod communicateMethod = getMethod("Lcom/ibm/JikesRVM/classloader/VM_Method;", "communicate", "()V");
+  public static final VM_NormalMethod communicateType = getMethod("Lcom/ibm/JikesRVM/classloader/VM_Type;", "communicate", "()V");
+
   // Allocation-related entry points
   //
   public static final VM_NormalMethod resolvedNewScalarMethod  = getMethod("Lcom/ibm/JikesRVM/VM_Runtime;", "resolvedNewScalar", "(I[Ljava/lang/Object;ZIII)Ljava/lang/Object;");
diff -ru --expand-tabs jikes-original/rvm/src/vm/runtime/VM_Memory.java javana-0.1/jikes/source/rvm/src/vm/runtime/VM_Memory.java
--- jikes-original/rvm/src/vm/runtime/VM_Memory.java	2006-10-25 08:36:38.487176664 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/runtime/VM_Memory.java	2006-10-25 08:27:35.071788360 +0200
@@ -408,6 +408,10 @@
     VM_SysCall.sysZeroPages(start, len);
   }
 
+  public static void free(Address start, int bytes) {
+    VM_SysCall.sysFreeMemory(start, bytes);
+  }
+
   ////////////////////////
   // (2) Cache management
   ////////////////////////
diff -ru --expand-tabs jikes-original/rvm/src/vm/runtime/VM_SysCall.java javana-0.1/jikes/source/rvm/src/vm/runtime/VM_SysCall.java
--- jikes-original/rvm/src/vm/runtime/VM_SysCall.java	2006-10-25 08:36:38.497175144 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/runtime/VM_SysCall.java	2006-10-25 08:27:35.103783496 +0200
@@ -47,6 +47,22 @@
     return -2;
   }
 
+  // DIOTA instrumentation
+  public static int sysIgnore(int mid, Address address, int size) { return 0; }
+  public static int sysStartThread(int threadID, Address stack, int length) { return 0; }
+  public static int sysNewStack(int threadID, Address stack, int length) { return 0; }
+  public static int sysThreadSwitch(int oTID, int nTID) { return 0; }
+  public static int sysTerminateThread(int threadID) { return 0; }
+  public static int sysMethod(int methodID, byte[] name, int type) { return 0; }
+  public static int sysType(int methodID, byte[] name) { return 0; }
+  public static int sysAllocateObject(int typeID, Address address, int size) { return 1; }
+  public static int sysCopyObject(int typeID, Address fromAddress, int fromSize, Address toAddress, int toSize) { return 0; }
+  public static int sysAllocateCode(int methodID, int line, Address address, int size) { return 0; }
+  public static int sysRelocateCode(Address fromAddress, int fromSize, Address toAddress, int toSize) { return 0; }
+  public static int sysFreeMemory(Address address, int size) { return 0; }
+  public static int sysStartGC() { return 0; }
+  public static int sysStopGC() { return 0; }
+
   // memory
   public static void sysCopy(Address dst, Address src, Extent cnt) {}
   public static void sysFill(Address dst, int pattern, Extent cnt) {}
diff -ru --expand-tabs jikes-original/rvm/src/vm/scheduler/VM_Processor.java javana-0.1/jikes/source/rvm/src/vm/scheduler/VM_Processor.java
--- jikes-original/rvm/src/vm/scheduler/VM_Processor.java	2006-10-25 08:36:41.286751064 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/scheduler/VM_Processor.java	2006-10-25 08:27:35.142777568 +0200
@@ -190,6 +190,10 @@
     previousThread = activeThread;
     activeThread   = newThread;
 
+    if (previousThread != newThread) {
+      VM_SysCall.sysThreadSwitch(previousThread.threadId, newThread.threadId);
+    }
+
     if (!previousThread.isDaemon && 
         idleProcessor != null && !readyQueue.isEmpty()) {
       // if we've got too much work, transfer some of it to another 
@@ -199,6 +203,7 @@
       VM_Thread t = readyQueue.dequeue();
       if (VM.TraceThreadScheduling > 0) VM_Scheduler.trace("VM_Processor", "dispatch: offload ", t.getIndex());
       scheduleThread(t);
+          
     }
 
     // Accumulate CPU time on a per thread basis.
diff -ru --expand-tabs jikes-original/rvm/src/vm/scheduler/VM_Thread.java javana-0.1/jikes/source/rvm/src/vm/scheduler/VM_Thread.java
--- jikes-original/rvm/src/vm/scheduler/VM_Thread.java	2006-10-25 08:36:41.252756232 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/scheduler/VM_Thread.java	2006-10-25 08:27:35.175772552 +0200
@@ -41,6 +41,9 @@
  */
 public class VM_Thread implements VM_Constants, Uninterruptible {
 
+  public static int maxThreadId = 0;
+  public int threadId = 0;
+  
   /**
    * debug flag
    */
@@ -405,6 +408,7 @@
         threadSwitch = true;
         VM_Processor.getCurrentProcessor().interruptQuantumCounter = 0;
 
+        VM_Thread t = null;
         // Check various scheduling requests/queues that need to be polled periodically
         if (VM_Scheduler.debugRequested && VM_Scheduler.allProcessorsInitialized) { 
           // service "debug request" generated by external signal
@@ -413,19 +417,20 @@
             // debugger already running
             VM_Scheduler.debuggerMutex.unlock();
           } else { // awaken debugger
-            VM_Thread t = VM_Scheduler.debuggerQueue.dequeue();
+            t = VM_Scheduler.debuggerQueue.dequeue();
             VM_Scheduler.debuggerMutex.unlock();
             t.schedule();
           }
         }
         if (VM_Scheduler.wakeupQueue.isReady()) {
           VM_Scheduler.wakeupMutex.lock();
-          VM_Thread t = VM_Scheduler.wakeupQueue.dequeue();
+          t = VM_Scheduler.wakeupQueue.dequeue();
           VM_Scheduler.wakeupMutex.unlock();
           if (t != null) {
             t.schedule();
           }
         }
+
       }
 
       //-#if RVM_WITH_HPM
@@ -782,6 +787,7 @@
     if (trace) VM.sysWriteln("VM_Thread.startoff(): finished ", 
                              currentThread.toString(), ".run()");
 
+   
     terminate();
     if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED);
   }
@@ -836,7 +842,11 @@
       VM.enableGC();
 
     }
-
+   
+    VM_Thread t = getCurrentThread();
+    // Communicate the termination to DIOTA:
+    VM_SysCall.sysTerminateThread(t.threadId); 
+ 
     //-#if RVM_WITH_HPM
     // sample HPM counter values at every interrupt or a thread switch.
     if (VM.BuildForHPM && VM_HardwarePerformanceMonitors.safe && 
@@ -1048,6 +1058,8 @@
     VM_Processor.getCurrentProcessor().activeThreadStackLimit =
       myThread.stackLimit;
     
+    VM_SysCall.sysNewStack(myThread.threadId, VM_Magic.objectAsAddress(newStack), myStack.length);
+    
     // return to caller, resuming execution on new stack 
     // (original stack now abandoned)
     //
@@ -1300,6 +1312,12 @@
     VM_Scheduler.threadCreationMutex.lock();
     assignThreadSlot();
 
+    // Set the thread id and communcate the id and name to DIOTA:
+    maxThreadId++;
+    threadId = maxThreadId;
+    
+    VM_SysCall.sysStartThread(threadId, VM_Magic.objectAsAddress(stack), stack.length);
+    
     //-#if RVM_WITH_HPM
     if (VM_HardwarePerformanceMonitors.booted()) {
       if (hpm_counters == null) hpm_counters = new HPM_counters();
@@ -1312,7 +1330,7 @@
       VM_HardwarePerformanceMonitors.putThreadName(name, global_tid);
     }
     //-#endif
-
+    
     VM_Scheduler.threadCreationMutex.unlock();
 
     VM.enableGC();
diff -ru --expand-tabs jikes-original/rvm/src/vm/utility/BooleanOptions.dat javana-0.1/jikes/source/rvm/src/vm/utility/BooleanOptions.dat
--- jikes-original/rvm/src/vm/utility/BooleanOptions.dat	2006-10-25 08:36:40.626851384 +0200
+++ javana-0.1/jikes/source/rvm/src/vm/utility/BooleanOptions.dat	2006-10-25 08:27:35.216766320 +0200
@@ -5,6 +5,12 @@
 # Structure of DECL FULL_NAME DEFAULT_VALUE {SHORT_NAME}
 DESCRIP
 
+virtualMachineMethods false
+Whether to communicate methods of the virtual machine to DIOTA
+
+bootstrapClasspathMethods false
+Whether to communicate methods of the standard class libraries to DIOTA
+
 MeasureCompilation false measureCompilation
 Time all compilations and report on exit
 

