|
Message
From: cvs at opencores.org<cvs@o...>
Date: Mon May 28 20:10:47 CEST 2007
Subject: [cvs-checkins] MODIFIED: jop ...
Date: 00/07/05 28:20:10 Modified: jop/java/target/src/common/com/jopdesign/sys GC.java JVM.java JVMHelp.java Log: putstatic and putfield in JVM.java for reference fields Revision Changes Path 1.30 jop/java/target/src/common/com/jopdesign/sys/GC.java http://www.opencores.org/cvsweb.shtml/jop/java/target/src/common/com/jopdesign/sys/GC.java.diff?r1=1.29&r2=1.30 (In the diff below, changes in quantity of whitespace are not shown.) Index: GC.java =================================================================== RCS file: /cvsroot/martin/jop/java/target/src/common/com/jopdesign/sys/GC.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -b -r1.29 -r1.30 --- GC.java 30 Dec 2006 17:56:08 -0000 1.29 +++ GC.java 28 May 2007 18:10:47 -0000 1.30 @@ -134,6 +134,7 @@ addrStaticRefs = addr; mem_start = Native.rdMem(0); +//mem_size = mem_start + 2000; full_heap_size = mem_size-mem_start; handle_cnt = full_heap_size/2/(TYPICAL_OBJ_SIZE+HANDLE_SIZE); semi_size = (full_heap_size-handle_cnt*HANDLE_SIZE)/2; @@ -255,7 +256,6 @@ static void getRoots() { - synchronized (mutex) { int i, j; @@ -265,6 +265,8 @@ for (i=0; i<cnt; ++i) { push(Native.rdMem(addr+i)); } + // only pushing stack roots need to be atomic + synchronized (mutex) { // add complete stack of the current thread to the root list // roots = GCStkWalk.swk(RtThreadImpl.getActive(),true,false); i = Native.getSP(); @@ -375,10 +377,10 @@ ref = next; } } - System.out.print("used handles="); - System.out.println(use); - System.out.print("free handles="); - System.out.println(free); +// System.out.print("used handles="); +// System.out.println(use); +// System.out.print("free handles="); +// System.out.println(free); } /** * switch from-space and to-space @@ -404,8 +406,6 @@ */ static void compact() { - flip(); - int ref = useList; while (ref!=0) { // log("move", ref); @@ -429,9 +429,9 @@ Native.wrMem(0, i); } // for tests clean also the remainig memory in the to-space?? -// for (int i=heapPtr; i<allocPtr; ++i) { -// Native.wrMem(0, i); -// } + for (int i=heapPtr; i<allocPtr; ++i) { + Native.wrMem(0, i); + } } public static void setConcurrent() { @@ -442,7 +442,7 @@ log("GC allocation triggered"); if (concurrentGc) { log("meaning out of memory for RT-GC"); - dump(); +// dump(); System.exit(1); } else { gc(); @@ -450,13 +450,14 @@ } public static void gc() { - log("GC called - free memory:", freeMemory()); +// log("GC called - free memory:", freeMemory()); + flip(); mark();
sweep();
compact();
- log("GC end - free memory:",freeMemory());
+// log("GC end - free memory:",freeMemory());
}
@@ -501,6 +502,8 @@
int ref;
// TODO: shouldn't be the whole newObject synchronized?
// Than we can remove the synchronized from JVM.java
+ // BTW: when we create mutex we synchrnize on the not yet
+ // created Object!
synchronized (mutex) {
ref = getHandle(allocPtr, size);
// ref. flags used for array marker
1.24 jop/java/target/src/common/com/jopdesign/sys/JVM.java
http://www.opencores.org/cvsweb.shtml/jop/java/target/src/common/com/jopdesign/sys/JVM.java.diff?r1=1.23&r2=1.24
(In the diff below, changes in quantity of whitespace are not shown.)
Index: JVM.java
===================================================================
RCS file: /cvsroot/martin/jop/java/target/src/common/com/jopdesign/sys/JVM.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- JVM.java 28 May 2007 16:10:56 -0000 1.23
+++ JVM.java 28 May 2007 18:10:47 -0000 1.24
@@ -620,7 +620,7 @@
}
JVMHelp.wr(" thrown\n");
JVMHelp.wr("catch not implemented!");
- Startup.exit();
+ System.exit(1);
return t;
}
@@ -785,9 +785,19 @@
private static void f_resDE() { JVMHelp.noim();}
private static void f_resDF() { JVMHelp.noim();}
private static void f_resE0() { JVMHelp.noim();}
- private static void f_resE1() { JVMHelp.noim();}
+ private static void f_putstatic_ref(int val, int addr) {
+
+ Native.wrMem(val, addr);
+ }
private static void f_resE2() { JVMHelp.noim();}
- private static void f_resE3() { JVMHelp.noim();}
+ private static void f_putfield_ref(int ref, int val, int index) {
+
+ if (ref==0) {
+ throw new NullPointerException();
+ }
+ ref = Native.rdMem(ref);
+ Native.wrMem(val, ref+index);
+ }
private static void f_resE4() { JVMHelp.noim();}
private static void f_resE5() { JVMHelp.noim();}
private static void f_resE6() { JVMHelp.noim();}
1.18 jop/java/target/src/common/com/jopdesign/sys/JVMHelp.java
http://www.opencores.org/cvsweb.shtml/jop/java/target/src/common/com/jopdesign/sys/JVMHelp.java.diff?r1=1.17&r2=1.18
(In the diff below, changes in quantity of whitespace are not shown.)
Index: JVMHelp.java
===================================================================
RCS file: /cvsroot/martin/jop/java/target/src/common/com/jopdesign/sys/JVMHelp.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- JVMHelp.java 14 Apr 2007 18:38:10 -0000 1.17
+++ JVMHelp.java 28 May 2007 18:10:47 -0000 1.18
@@ -156,22 +156,23 @@
// while does not work anymore as sp and vp are
// wrapping around (only 7 bits)
// while (fp>128+5) { // stop befor 'fist' method
- for (int cnt=0; cnt<5; ++cnt) {
- mp = Native.rdIntMem(fp+4);
- vp = Native.rdIntMem(fp+2);
- pc = Native.rdIntMem(fp+1);
+ for (int cnt=0; cnt<10; ++cnt) {
+ mp = Native.rdIntMem(((fp+4)&0x7f)|0x80);
+ vp = Native.rdIntMem(((fp+2)&0x7f)|0x80);
+ pc = Native.rdIntMem(((fp+1)&0x7f)|0x80);
val = Native.rdMem(mp);
addr = val>>>10; // address of callee
wrSmall(mp);
wrSmall(addr);
wrSmall(pc);
+ wrSmall(fp);
wr('\n');
val = Native.rdMem(mp+1); // cp, locals, args
args = val & 0x1f;
loc = (val>>>5) & 0x1f;
- fp = vp+args+loc; // new fp can be calc. with vp and count of local vars
+ fp = ((vp+args+loc)&0x7f)|0x80; // new fp can be calc. with vp and count of local vars
}
wr('\n');
/*
|
 |