STM versions
authorbdemsky <bdemsky>
Mon, 6 Apr 2009 07:00:30 +0000 (07:00 +0000)
committerbdemsky <bdemsky>
Mon, 6 Apr 2009 07:00:30 +0000 (07:00 +0000)
Robust/src/ClassLibrary/JavaSTM/Object.java [new file with mode: 0644]
Robust/src/ClassLibrary/JavaSTM/Thread.java [new file with mode: 0644]

diff --git a/Robust/src/ClassLibrary/JavaSTM/Object.java b/Robust/src/ClassLibrary/JavaSTM/Object.java
new file mode 100644 (file)
index 0000000..4968cfa
--- /dev/null
@@ -0,0 +1,28 @@
+public class Object {
+  public int cachedCode;   //first field has to be a primitive
+  public boolean cachedHash;
+
+  public native int nativehashCode();
+
+  public int hashCode() {
+    if (!cachedHash) {
+      cachedCode=nativehashCode();
+      cachedHash=true;
+    }
+    return cachedCode;
+  }
+
+  /* DON'T USE THIS METHOD UNLESS NECESSARY */
+  /* WE WILL DEPRECATE IT AS SOON AS INSTANCEOF WORKS */
+  public native int getType();
+
+  public String toString() {
+    return "Object"+hashCode();
+  }
+
+  public boolean equals(Object o) {
+    if (o==this)
+      return true;
+    return false;
+  }
+}
diff --git a/Robust/src/ClassLibrary/JavaSTM/Thread.java b/Robust/src/ClassLibrary/JavaSTM/Thread.java
new file mode 100644 (file)
index 0000000..50c5580
--- /dev/null
@@ -0,0 +1,27 @@
+public class Thread {
+  private boolean finished;
+
+  public void start() {
+    nativeCreate();
+  }
+
+  private static void staticStart(Thread t) {
+    t.run();
+  }
+
+  public static native void yield();
+
+  public void join() {
+    nativeJoin();
+  }
+
+  private native void nativeJoin();
+
+  public native static void sleep(long millis);
+
+  public void run() {
+  }
+
+  private native void nativeCreate();
+
+}