waba-commits Mailing List for Waba Virtual Machine (Page 7)
Status: Abandoned
Brought to you by:
bornet
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(34) |
Sep
(34) |
Oct
(86) |
Nov
(31) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(105) |
Feb
(23) |
Mar
(1) |
Apr
(6) |
May
(4) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2003 |
Jan
(14) |
Feb
(1) |
Mar
(10) |
Apr
(60) |
May
(82) |
Jun
(22) |
Jul
(2) |
Aug
(39) |
Sep
|
Oct
(32) |
Nov
|
Dec
|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(117) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(13) |
Update of /cvsroot/waba/waba/classes/cdc/java/lang In directory sc8-pr-cvs1:/tmp/cvs-serv10993 Removed Files: AbstractMethodError.java ArithmeticException.java ArrayIndexOutOfBoundsException.java ArrayStoreException.java Boolean.java Byte.java Character.java Class.java ClassCastException.java ClassLoader.java ClassNotFoundException.java CloneNotSupportedException.java Cloneable.java Comparable.java Double.java Exception.java Float.java IllegalAccessException.java IllegalArgumentException.java IllegalMonitorStateException.java IllegalStateException.java IllegalThreadStateException.java IndexOutOfBoundsException.java InheritableThreadLocal.java InstantiationException.java Integer.java InterruptedException.java Long.java Math.java NegativeArraySizeException.java NoSuchFieldException.java NoSuchMethodException.java NullPointerException.java Number.java NumberFormatException.java Object.java Package.java Process.java Runnable.java Runtime.java RuntimeException.java RuntimePermission.java SecurityException.java SecurityManager.java Short.java StrictMath.java String.java StringBuffer.java StringIndexOutOfBoundsException.java System.java Thread.java ThreadGroup.java ThreadLocal.java Throwable.java UnsupportedOperationException.java Void.java Log Message: Removed stale files --- AbstractMethodError.java DELETED --- --- ArithmeticException.java DELETED --- --- ArrayIndexOutOfBoundsException.java DELETED --- --- ArrayStoreException.java DELETED --- --- Boolean.java DELETED --- --- Byte.java DELETED --- --- Character.java DELETED --- --- Class.java DELETED --- --- ClassCastException.java DELETED --- --- ClassLoader.java DELETED --- --- ClassNotFoundException.java DELETED --- --- CloneNotSupportedException.java DELETED --- --- Cloneable.java DELETED --- --- Comparable.java DELETED --- --- Double.java DELETED --- --- Exception.java DELETED --- --- Float.java DELETED --- --- IllegalAccessException.java DELETED --- --- IllegalArgumentException.java DELETED --- --- IllegalMonitorStateException.java DELETED --- --- IllegalStateException.java DELETED --- --- IllegalThreadStateException.java DELETED --- --- IndexOutOfBoundsException.java DELETED --- --- InheritableThreadLocal.java DELETED --- --- InstantiationException.java DELETED --- --- Integer.java DELETED --- --- InterruptedException.java DELETED --- --- Long.java DELETED --- --- Math.java DELETED --- --- NegativeArraySizeException.java DELETED --- --- NoSuchFieldException.java DELETED --- --- NoSuchMethodException.java DELETED --- --- NullPointerException.java DELETED --- --- Number.java DELETED --- --- NumberFormatException.java DELETED --- --- Object.java DELETED --- --- Package.java DELETED --- --- Process.java DELETED --- --- Runnable.java DELETED --- --- Runtime.java DELETED --- --- RuntimeException.java DELETED --- --- RuntimePermission.java DELETED --- --- SecurityException.java DELETED --- --- SecurityManager.java DELETED --- --- Short.java DELETED --- --- StrictMath.java DELETED --- --- String.java DELETED --- --- StringBuffer.java DELETED --- --- StringIndexOutOfBoundsException.java DELETED --- --- System.java DELETED --- --- Thread.java DELETED --- --- ThreadGroup.java DELETED --- --- ThreadLocal.java DELETED --- --- Throwable.java DELETED --- --- UnsupportedOperationException.java DELETED --- --- Void.java DELETED --- |
From: Manfred R. <mr...@us...> - 2003-10-10 20:59:20
|
Update of /cvsroot/waba/waba/classes/cdc/java/io In directory sc8-pr-cvs1:/tmp/cvs-serv10912 Removed Files: FilterOutputStream.java OutputStream.java PrintStream.java Log Message: Removed stale files --- FilterOutputStream.java DELETED --- --- OutputStream.java DELETED --- --- PrintStream.java DELETED --- |
From: MURANAKA M. <mo...@us...> - 2003-10-05 07:01:57
|
Update of /cvsroot/waba/waba/vm In directory sc8-pr-cvs1:/tmp/cvs-serv14389/vm Modified Files: waba.h Log Message: Added struct for the exception attribute. Index: waba.h =================================================================== RCS file: /cvsroot/waba/waba/vm/waba.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** waba.h 9 Aug 2003 21:59:47 -0000 1.28 --- waba.h 5 Oct 2003 07:01:53 -0000 1.29 *************** *** 176,183 **** --- 176,189 ---- } Code; + typedef struct { + uint16 count; + uchar *table; + } ExceptionTable; + typedef struct WClassMethodStruct { uchar *header; Code code; + ExceptionTable exception_table; /* If the method has no exception, value is NULL */ uint16 numParams:14; uint16 returnsValue:1; |
From: MURANAKA M. <mo...@us...> - 2003-10-05 05:39:09
|
Update of /cvsroot/waba/waba/extension_classes/javaflavor/java/io In directory sc8-pr-cvs1:/tmp/cvs-serv5181/extension_classes/javaflavor/java/io Added Files: OutputStream.java ByteArrayOutputStream.java Log Message: Moved from waba.io to java.io. --- NEW FILE: OutputStream.java --- /* * Created on 2003/04/12 * * Copyright (C) Monami software, LP. * * All rights reserved. * * This code is GPLed. */ package java.io; /** * @author monaka */ public abstract class OutputStream { public void close(){ /* Do nothing. Required by Java API spec. */ } public void flush() { /* Do nothing. Required by Java API spec. */ } public void write(byte[] b) { write(b, 0, b.length); } /** * @param b * @param off * @param len */ public void write(byte[] b, int off, int len) { for(int i = 0; i < len; i++) { write(b[off +i]); } } public abstract void write(int b); } --- NEW FILE: ByteArrayOutputStream.java --- /* * Created on 2003/04/12 * * Copyright (C) Monami software, LP. * * All rights reserved. * * This code is GPLed. */ package java.io; /** * @author monaka * * Copyright (C) Monami software, LP. * All rights reserved. */ /** * @author monaka * */ public class ByteArrayOutputStream extends OutputStream { private int count; private byte[] array; public ByteArrayOutputStream() { this(1); } public ByteArrayOutputStream(int size) { count = 0; array = new byte[size]; } public void reset() { count = 0; } public int count() { return count; } public void close() { count = 0; array = new byte[1]; } public byte[] toByteArray() { if (count == 0) { return null; } byte[] ret = new byte[count]; for(int i = 0; i < count; i++) { ret[i] = array[i]; } return ret; } /** * @note There is no range check. Handle with care. * @param b * @param off * @param len */ public void write(byte[] b, int off, int len) { if (count + len > array.length) { stretch(count + len); } for(int i = 0; i < len; i++) { array[count++] = b[off +i]; } } /** * @param c */ public void write(int c) { if (count + 1 > array.length) { stretch(count + 1); } array[count++] = (byte)c; } private void stretch(int delta) { int nsize = array.length + delta; byte[] narray = new byte[nsize]; for(int i = 0; i < count; i++) { narray[i] = array[i]; } array = narray; } } |
From: MURANAKA M. <mo...@us...> - 2003-10-05 05:39:09
|
Update of /cvsroot/waba/waba/extension_classes/javaflavor/waba/io In directory sc8-pr-cvs1:/tmp/cvs-serv5181/extension_classes/javaflavor/waba/io Removed Files: OutputStream.java ByteArrayOutputStream.java Log Message: Moved from waba.io to java.io. --- OutputStream.java DELETED --- --- ByteArrayOutputStream.java DELETED --- |
From: MURANAKA M. <mo...@us...> - 2003-10-05 05:38:37
|
Update of /cvsroot/waba/waba/extension_classes/javaflavor/java/io In directory sc8-pr-cvs1:/tmp/cvs-serv5068/extension_classes/javaflavor/java/io Added Files: FileDescriptor.java Log Message: New file. --- NEW FILE: FileDescriptor.java --- /* * Created on 2003/10/05 * * Copyright (C) Monami software, LP. * * This file is GPLed. */ package java.io; /** * @author monaka * */ public class FileDescriptor { int fd; public FileDescriptor() { fd = -1; } public native void sync() /* throws SyncFailedException */; public native boolean valid(); } |
From: MURANAKA M. <mo...@us...> - 2003-10-05 05:38:33
|
Update of /cvsroot/waba/waba/extension_classes/javaflavor/java/io In directory sc8-pr-cvs1:/tmp/cvs-serv5033/extension_classes/javaflavor/java/io Log Message: Directory /cvsroot/waba/waba/extension_classes/javaflavor/java/io added to the repository |
From: MURANAKA M. <mo...@us...> - 2003-10-05 05:38:33
|
Update of /cvsroot/waba/waba/extension_classes/javaflavor/java In directory sc8-pr-cvs1:/tmp/cvs-serv5033/extension_classes/javaflavor/java Log Message: Directory /cvsroot/waba/waba/extension_classes/javaflavor/java added to the repository |
From: MURANAKA M. <mo...@us...> - 2003-10-05 04:09:32
|
Update of /cvsroot/waba/waba In directory sc8-pr-cvs1:/tmp/cvs-serv27383 Modified Files: .classpath Log Message: Index: .classpath =================================================================== RCS file: /cvsroot/waba/waba/.classpath,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** .classpath 12 Apr 2003 13:17:15 -0000 1.3 --- .classpath 5 Oct 2003 04:09:29 -0000 1.4 *************** *** 1,5 **** <?xml version="1.0" encoding="UTF-8"?> <classpath> ! <classpathentry kind="src" path="waba_classes"/> <classpathentry kind="src" path="examples"/> <classpathentry kind="src" path="extension_classes/reflection"/> --- 1,5 ---- <?xml version="1.0" encoding="UTF-8"?> <classpath> ! <classpathentry excluding="waba/doc/" kind="src" path="waba_classes"/> <classpathentry kind="src" path="examples"/> <classpathentry kind="src" path="extension_classes/reflection"/> |
From: MURANAKA M. <mo...@us...> - 2003-10-05 04:09:22
|
Update of /cvsroot/waba/waba/vm In directory sc8-pr-cvs1:/tmp/cvs-serv27370/vm Modified Files: waba.c Log Message: 1. Bug fixed : Added stack operation in case pushReturnedValue == 2. 2. Added : pushReturnValue == -1 means called athrow. In this version there is no implementation around athrow. Index: waba.c =================================================================== RCS file: /cvsroot/waba/waba/vm/waba.c,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** waba.c 10 Aug 2003 06:04:34 -0000 1.49 --- waba.c 5 Oct 2003 04:09:18 -0000 1.50 *************** *** 4266,4277 **** case OP_freturn: case OP_areturn: case OP_return: ! if (*pc != OP_return) ! { ! returnedValue = stack[-1]; ! pushReturnedValue = 1; ! } ! else ! pushReturnedValue = 0; goto methodreturn; case OP_getfield: --- 4266,4274 ---- case OP_freturn: case OP_areturn: + returnedValue = stack[-1]; + pushReturnedValue = 1; + goto methodreturn; case OP_return: ! pushReturnedValue = 0; goto methodreturn; case OP_getfield: *************** *** 5371,5375 **** case OP_lreturn: case OP_dreturn: ! #endif /* WITH_64BITS */ --- 5368,5373 ---- case OP_lreturn: case OP_dreturn: ! VmQuickError(ERR_BadOpcode); ! goto error; #endif /* WITH_64BITS */ *************** *** 5381,5384 **** --- 5379,5384 ---- case OP_athrow: + pushReturnedValue = -1; + goto methodreturn; default: VmQuickError(ERR_BadOpcode); *************** *** 5454,5462 **** #endif } stack = (Var *)vmStack[--vmStackPtr].refValue; ! if (pushReturnedValue) { stack[0] = returnedValue; stack++; } var = (Var *)vmStack[--vmStackPtr].refValue; --- 5454,5473 ---- #endif } + stack = (Var *)vmStack[--vmStackPtr].refValue; ! if (pushReturnedValue == -1) { ! VmQuickError(ERR_BadOpcode); ! goto error; ! } ! else if (pushReturnedValue == 1) { stack[0] = returnedValue; stack++; + } + else if (pushReturnedValue == 2) + { + stack[0] = returnedValue; + stack[1] = returnedValue2; + stack += 2; } var = (Var *)vmStack[--vmStackPtr].refValue; |
From: MURANAKA M. <mo...@us...> - 2003-10-05 02:58:22
|
Update of /cvsroot/waba/waba/extension_classes/javaflavor/waba/lang In directory sc8-pr-cvs1:/tmp/cvs-serv20109/extension_classes/javaflavor/waba/lang Added Files: Throwable.java Log Message: New file. --- NEW FILE: Throwable.java --- /* * Created on 2003/04/25 * * Copyright (C) Monami software, LP. * * All rights reserved. * This code is distributed as GPLed. * */ package waba.lang; /** * @author monaka * */ public class Throwable { public Throwable() { //TODO: not implemented. } public Throwable(String message) { //TODO: not implemented. } public waba.lang.Throwable fillInStackTrace () { //TODO: not implemented. return null; } // public String getLocalizedMessage () { // //TODO: not implemented. // } public String getMessage () { //TODO: not implemented. return ""; } public void printStackTrace () { //TODO: not implemented. } // public java.lang.String toString () { // //TODO: not implemented. // return null; // } } |
From: MURANAKA M. <mo...@us...> - 2003-10-05 02:58:18
|
Update of /cvsroot/waba/waba/extension_classes/javaflavor/waba/lang In directory sc8-pr-cvs1:/tmp/cvs-serv20065/extension_classes/javaflavor/waba/lang Log Message: Directory /cvsroot/waba/waba/extension_classes/javaflavor/waba/lang added to the repository |
From: Manfred R. <mr...@us...> - 2003-08-10 06:40:31
|
Update of /cvsroot/waba/waba/vm In directory sc8-pr-cvs1:/tmp/cvs-serv17831/vm Added Files: native.c native.h Log Message: Added native.c and native.h skeletons --- NEW FILE: native.c --- /* * $Id: native.c,v 1.1 2003/08/10 06:40:29 mriem Exp $ * * Copyright (c) 2001, 2002, 2003, Waba @ Sourceforge. * Copyright (c) 1998, 1999, 2000, Wabasoft. * All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "waba.h" #include "native.h" --- NEW FILE: native.h --- /* * $Id: native.h,v 1.1 2003/08/10 06:40:29 mriem Exp $ * * Copyright (c) 2001, 2002, 2003, Waba @ Sourceforge. * Copyright (c) 1998, 1999, 2000, Wabasoft. * All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __NATIVE_H__ #define __NATIVE_H__ #endif |
From: Manfred R. <mr...@us...> - 2003-08-10 06:04:38
|
Update of /cvsroot/waba/waba/vm In directory sc8-pr-cvs1:/tmp/cvs-serv14097/vm Modified Files: waba.c Added Files: memory.c memory.h Log Message: Split off the memory management to memory.h and memory.c --- NEW FILE: memory.c --- /* * $Id: memory.c,v 1.1 2003/08/10 06:04:34 mriem Exp $ * * Copyright (c) 2001, 2002, 2003, Waba @ Sourceforge. * Copyright (c) 1998, 1999, 2000, Wabasoft. * All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * ---------------------------------------------------------------------------- * * Memory Management * ----------------- * * Here's the garbage collector. I implemented the mark and sweep below after * testing out a few different ones and reading: * * Garbage Collection, Algorithms for Automatic Dynamic Memory Management * by Richard Jones and Rafael Lins * * which is an excellent book. Also, this collector has gone through a lot of * testing. It runs when the system is completely out of memory which can * happen at any time ... for example during class loading. * * To test it out, tests were run where 1000's of random objects were loaded, * constructed and random methods called on them over some period of days. * This found a couple subtle bugs that were fixed like when the garbage * collector ran in the middle of array allocation and moved pointers around * from under the array allocator code ( those have all been fixed ). * * The heap is comprised of Hos objects (an array) that grows from the * "right" of object memory and objects that take up the space on on the * "left" side. The Hos array keeps track of where the objects are on the * left. * * The Hos structure (strange, but aptly named) is used to keep track of * handles (pointers to memory locations), order (order of handles with * respect to memory) and temporary items (used during the scan phase). * * The 3 items in the Hos structure do not relate to each other. They are * each a part of 3 conceptually distinct arrays that grow from the right of * the heap while the objects grow from the left. So, when the Hos array is * indexed, it is always negative (first element is 0, next is -1, next * is -2, etc). * * ---------------------------------------------------------------------------- */ #include "waba.h" #include "memory.h" /* * The heap with objects. */ static ObjectHeap heap; #define VALID_OBJ(o) (o > FIRST_OBJ && o <= FIRST_OBJ + heap.numHandles) // mark bits in the handle order array since it is not used during // the mark object process (its used in the sweep phase) #define MARK(o) heap.hos[- (int32)(o - FIRST_OBJ - 1)].order |= 0x80000000 #define IS_MARKED(o) (heap.hos[- (int32)(o - FIRST_OBJ - 1)].order & 0x80000000) /* * NOTE: There are no waba methods that are called when objects are destroyed. * This is because if a method was called, the object would be on its * way to being GC'd and if we set another object (or static field) to * reference it, after the GC, the reference would be stale. */ void sweep() { WObject obj; WClass *wclass; uint32 i, h, objSize, prevObjectSize, numUsedHandles; uchar *src, *dst; prevObjectSize = heap.objectSize; heap.objectSize = 0; // move all the marks over into the scan array so we don't have // to do lots of bit shifting for (i = 0; i < heap.numHandles; i++) { if (heap.hos[- (int32)i].order & 0x80000000) { heap.hos[- (int32)i].order &= 0x7FFFFFFF; // clear mark bit heap.hos[- (int32)i].temp = 1; } else { heap.hos[- (int32)i].temp = 0; } } numUsedHandles = 0; for (i = 0; i < heap.numHandles; i++) { // we need to scan in memory order so we can compact things without // copying objects over each other h = heap.hos[- (int32)i].order; obj = h + FIRST_OBJ + 1; if (!heap.hos[- (int32)h].temp) { // handle is free - dereference object if (objectPtr(obj) != NULL) { wclass = WOBJ_class(obj); // for non-arrays, call objDestroy if present if (wclass != NULL && wclass->objDestroyFunc) wclass->objDestroyFunc(obj); heap.hos[- (int32)h].ptr = NULL; } continue; } wclass = WOBJ_class(obj); if (wclass == NULL) objSize = arraySize(WOBJ_arrayType(obj), WOBJ_arrayLen(obj)); else objSize = WCLASS_objectSize(wclass); // copy object to new heap src = (uchar *)heap.hos[- (int32)h].ptr; dst = &heap.mem[heap.objectSize]; if (src != dst) // NOTE: overlapping regions need to copy correctly xmemmove(dst, src, objSize); heap.hos[- (int32)h].ptr = (Var *)dst; heap.hos[- (int32)numUsedHandles].order = h; heap.objectSize += objSize; numUsedHandles++; } heap.numFreeHandles = heap.numHandles - numUsedHandles; for (i = 0; i < heap.numHandles; i++) if (!heap.hos[- (int32)i].temp) { // add free handle to free section of order array heap.hos[- (int32)numUsedHandles].order = i; numUsedHandles++; } // zero out the part of the heap that is now junk xmemzero(&heap.mem[heap.objectSize], prevObjectSize - heap.objectSize); } /* * NOTE: this method is only for printing the status of memory and can be * removed. Also note, there is no such thing as the "amount of free * memory" because of garbage collection. */ uint32 getUnusedMem() { return heap.memSize - (heap.objectSize + (heap.numHandles * sizeof(Hos))); } int initObjectHeap(uint32 heapSize) { // NOTE: we must intiailize all the variables since after // a freeObjectHeap() we get called again heap.numHandles = 0; heap.numFreeHandles = 0; heap.memSize = heapSize; #if FIXED_OBJECT_HEAP_SIZE > 0 // align to 4 byte boundry for correct alignment of the Hos array heap.memSize = sizeof(objectHeapArea); // allocate and zero out memory region heap.mem = &objectHeapArea[0]; #else // align to 4 byte boundry for correct alignment of the Hos array heap.memSize = (heap.memSize + 3) & ~3; // allocate and zero out memory region heap.mem = (uchar *)xmalloc(heap.memSize); if (heap.mem == NULL) return -1; #endif xmemzero(heap.mem, heap.memSize); heap.hos = (Hos *)(&heap.mem[heap.memSize - sizeof(Hos)]); heap.objectSize = 0; return 0; } void freeObjectHeap() { #ifdef FREE_ON_EXIT { WObject obj; uint32 h; WClass *wclass; // call any native object destroy methods to free system resources for (h = 0; h < heap.numHandles; h++) { obj = h + FIRST_OBJ + 1; if (objectPtr(obj) != NULL) { wclass = WOBJ_class(obj); if (wclass != NULL && wclass->objDestroyFunc) wclass->objDestroyFunc(obj); } } } #endif #if FIXED_OBJECT_HEAP_SIZE <= 0 if (heap.mem) xfree(heap.mem); #endif } // mark this object and all the objects this object refers to and all // objects those objects refer to, etc. void markObject(WObject obj) { WClass *wclass; WObject *arrayStart, o; uint32 i, len, type, numScan; if (!VALID_OBJ(obj) || objectPtr(obj) == NULL || IS_MARKED(obj)) return; MARK(obj); numScan = 0; markinterior: wclass = WOBJ_class(obj); if (wclass == NULL) { // array - see if it contains object references type = WOBJ_arrayType(obj); if (type == 1 || type == 2) { // for an array of arrays or object array arrayStart = (WObject *)WOBJ_arrayStart(obj); len = WOBJ_arrayLen(obj); for (i = 0; i < len; i++) { o = arrayStart[i]; if (VALID_OBJ(o) && objectPtr(o) != NULL && !IS_MARKED(o)) { MARK(o); heap.hos[- (int32)numScan].temp = o; numScan++; } } } } else { // object len = wclass->numVars; for (i = 0; i < len; i++) { o = WOBJ_var(obj, i).obj; if (VALID_OBJ(o) && objectPtr(o) != NULL && !IS_MARKED(o)) { MARK(o); heap.hos[- (int32)numScan].temp = o; numScan++; } } } if (numScan > 0) { // Note: we use goto since we want to avoid recursion here // since structures like linked links could create deep // stack calls --numScan; obj = heap.hos[- (int32)numScan].temp; goto markinterior; } } // NOTE: size passed must be 4 byte aligned (see arraySize()) WObject allocObject(int32 size) { uint32 i, sizeReq, hosSize; if (size <= 0) return 0; sizeReq = size; if (!heap.numFreeHandles) sizeReq += sizeof(Hos); hosSize = heap.numHandles * sizeof(Hos); if (sizeReq + hosSize + heap.objectSize > heap.memSize) { gc(); // heap.objectSize changed or we are out of memory if (sizeReq + hosSize + heap.objectSize > heap.memSize) { VmQuickError(ERR_OutOfObjectMem); return 0; } } if (heap.numFreeHandles) { i = heap.hos[- (int32)(heap.numHandles - heap.numFreeHandles)].order; heap.numFreeHandles--; } else { // no free handles, get a new one i = heap.numHandles; heap.hos[- (int32)i].order = i; heap.numHandles++; } heap.hos[- (int32)i].ptr = (Var *)&heap.mem[heap.objectSize]; heap.objectSize += size; return FIRST_OBJ + i + 1; } // NOTE: we made this function a #define and it showed no real performance // gain over having it a function on either PalmOS or Windows when // optimization was turned on. Var *objectPtr(WObject obj) { return heap.hos[- (int32)(obj - FIRST_OBJ - 1)].ptr; } void gc() { WClass *wclass; WObject obj; uint32 i, j; // mark objects on vm stack for (i = 0; i < vmStackPtr; i++) if (VALID_OBJ(vmStack[i].obj)) markObject(vmStack[i].obj); // mark objects on native stack for (i = 0; i < nmStackPtr; i++) if (VALID_OBJ(nmStack[i])) markObject(nmStack[i]); // mark all static class objects for (i = 0; i < CLASS_HASH_SIZE; i++) { wclass = classHashList[i]; while (wclass != NULL) { for (j = 0; j < wclass->numFields; j++) { WClassField *field; field = &wclass->fields[j]; if (!FIELD_isStatic(field)) continue; obj = field->var.staticVar.obj; if (VALID_OBJ(obj)) markObject(obj); } wclass = wclass->nextClass; } } sweep(); #ifdef DEBUGMEMSIZE debugMemSize(); #endif } --- NEW FILE: memory.h --- /* * $Id: memory.h,v 1.1 2003/08/10 06:04:34 mriem Exp $ * * Copyright (c) 2001, 2002, 2003, Waba @ Sourceforge. * Copyright (c) 1998, 1999, 2000, Wabasoft. * All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * ---------------------------------------------------------------------------- * * Defines support for memory management. * * ---------------------------------------------------------------------------- */ #ifndef __MEMORY_H__ #define __MEMORY_H__ #define FIRST_OBJ 2244 typedef struct { Var *ptr; uint32 order; uint32 temp; } Hos; /* * NOTE: The total amount of memory used up at any given time in the heap is: * objectSize + ( numHandles * sizeof( Hos ) ) */ typedef struct { Hos *hos; /* handle, order and scan arrays (interlaced) */ uint32 numHandles; /* */ uint32 numFreeHandles; /* */ uchar *mem; /* */ uint32 memSize; /* total size of memory (including free) */ uint32 objectSize; /* size of all objects in heap */ } ObjectHeap; #endif Index: waba.c =================================================================== RCS file: /cvsroot/waba/waba/vm/waba.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** waba.c 9 Aug 2003 20:37:34 -0000 1.48 --- waba.c 10 Aug 2003 06:04:34 -0000 1.49 *************** *** 50,53 **** --- 50,54 ---- /* all includes are made in waba.h */ #include "waba.h" + #include "memory.h" #if defined(NO_PLATFORM_DEFINED) *************** *** 2482,2846 **** } - // - // Memory Management - // - - // Here's the garbage collector. I implemented the mark and sweep below - // after testing out a few different ones and reading: - // - // Garbage Collection, Algorithms for Automatic Dynamic Memory Management - // by Richard Jones and Rafael Lins - // - // which is an excellent book. Also, this collector has gone through a - // lot of testing. It runs when the system is completely out of memory - // which can happen at any time.. for example during class loading. - // - // To test it out, tests were run where 1000's of random objects were - // loaded, constructed and random methods called on them over some - // period of days. This found a couple subtle bugs that were - // fixed like when the garbage collector ran in the middle of array - // allocation and moved pointers around from under the array allocator - // code (those have all been fixed). - // - // The heap is comprised of Hos objects (an array) that grows from - // the "right" of object memory and objects that take up the space on - // on the "left" side. The Hos array keeps track of where the objects - // are on the left. - // - // The Hos structure (strange, but aptly named) is used to keep - // track of handles (pointers to memory locations), order (order - // of handles with respect to memory) and temporary items (used - // during the scan phase). - // - // The 3 items in the Hos structure do not relate to each other. They - // are each a part of 3 conceptually distinct arrays that grow - // from the right of the heap while the objects grow from the left. - // So, when the Hos array is indexed, it is always negative (first - // element is 0, next is -1, next is -2, etc). - - typedef struct - { - Var *ptr; - uint32 order; - uint32 temp; - } Hos; - - // NOTE: The total amount of memory used up at any given - // time in the heap is: objectSize + (numHandles * sizeof(Hos)) - - typedef struct - { - Hos *hos; // handle, order and scan arrays (interlaced) - uint32 numHandles; - uint32 numFreeHandles; - uchar *mem; - uint32 memSize; // total size of memory (including free) - uint32 objectSize; // size of all objects in heap - } ObjectHeap; - - static ObjectHeap heap; - - #define FIRST_OBJ 2244 - - #define VALID_OBJ(o) (o > FIRST_OBJ && o <= FIRST_OBJ + heap.numHandles) - - // NOTE: this method is only for printing the status of memory - // and can be removed. Also note, there is no such thing as - // the "amount of free memory" because of garbage collection. - uint32 getUnusedMem() - { - return heap.memSize - (heap.objectSize + (heap.numHandles * sizeof(Hos))); - } - - int initObjectHeap(uint32 heapSize) - { - // NOTE: we must intiailize all the variables since after - // a freeObjectHeap() we get called again - heap.numHandles = 0; - heap.numFreeHandles = 0; - heap.memSize = heapSize; - - #if FIXED_OBJECT_HEAP_SIZE > 0 - // align to 4 byte boundry for correct alignment of the Hos array - heap.memSize = sizeof(objectHeapArea); - - // allocate and zero out memory region - heap.mem = &objectHeapArea[0]; - #else - // align to 4 byte boundry for correct alignment of the Hos array - heap.memSize = (heap.memSize + 3) & ~3; - - // allocate and zero out memory region - heap.mem = (uchar *)xmalloc(heap.memSize); - if (heap.mem == NULL) - return -1; - #endif - - xmemzero(heap.mem, heap.memSize); - heap.hos = (Hos *)(&heap.mem[heap.memSize - sizeof(Hos)]); - heap.objectSize = 0; - return 0; - } - - void freeObjectHeap() - { - #ifdef FREE_ON_EXIT - { - WObject obj; - uint32 h; - WClass *wclass; - - // call any native object destroy methods to free system resources - for (h = 0; h < heap.numHandles; h++) - { - obj = h + FIRST_OBJ + 1; - if (objectPtr(obj) != NULL) - { - wclass = WOBJ_class(obj); - if (wclass != NULL && wclass->objDestroyFunc) - wclass->objDestroyFunc(obj); - } - } - } - #endif - #if FIXED_OBJECT_HEAP_SIZE <= 0 - if (heap.mem) - xfree(heap.mem); - #endif - } - - // mark bits in the handle order array since it is not used during - // the mark object process (its used in the sweep phase) - - #define MARK(o) heap.hos[- (int32)(o - FIRST_OBJ - 1)].order |= 0x80000000 - #define IS_MARKED(o) (heap.hos[- (int32)(o - FIRST_OBJ - 1)].order & 0x80000000) - - // mark this object and all the objects this object refers to and all - // objects those objects refer to, etc. - void markObject(WObject obj) - { - WClass *wclass; - WObject *arrayStart, o; - uint32 i, len, type, numScan; - - if (!VALID_OBJ(obj) || objectPtr(obj) == NULL || IS_MARKED(obj)) - return; - MARK(obj); - numScan = 0; - - markinterior: - wclass = WOBJ_class(obj); - if (wclass == NULL) - { - // array - see if it contains object references - type = WOBJ_arrayType(obj); - if (type == 1 || type == 2) - { - // for an array of arrays or object array - arrayStart = (WObject *)WOBJ_arrayStart(obj); - len = WOBJ_arrayLen(obj); - for (i = 0; i < len; i++) - { - o = arrayStart[i]; - if (VALID_OBJ(o) && objectPtr(o) != NULL && !IS_MARKED(o)) - { - MARK(o); - heap.hos[- (int32)numScan].temp = o; - numScan++; - } - } - } - } - else - { - // object - len = wclass->numVars; - for (i = 0; i < len; i++) - { - o = WOBJ_var(obj, i).obj; - if (VALID_OBJ(o) && objectPtr(o) != NULL && !IS_MARKED(o)) - { - MARK(o); - heap.hos[- (int32)numScan].temp = o; - numScan++; - } - } - } - if (numScan > 0) - { - // Note: we use goto since we want to avoid recursion here - // since structures like linked links could create deep - // stack calls - --numScan; - obj = heap.hos[- (int32)numScan].temp; - goto markinterior; - } - } - - // NOTE: There are no waba methods that are called when objects are destroyed. - // This is because if a method was called, the object would be on its way to - // being GC'd and if we set another object (or static field) to reference it, - // after the GC, the reference would be stale. - - void sweep() - { - WObject obj; - WClass *wclass; - uint32 i, h, objSize, prevObjectSize, numUsedHandles; - uchar *src, *dst; - - prevObjectSize = heap.objectSize; - heap.objectSize = 0; - - // move all the marks over into the scan array so we don't have - // to do lots of bit shifting - for (i = 0; i < heap.numHandles; i++) - { - if (heap.hos[- (int32)i].order & 0x80000000) - { - heap.hos[- (int32)i].order &= 0x7FFFFFFF; // clear mark bit - heap.hos[- (int32)i].temp = 1; - } - else - { - heap.hos[- (int32)i].temp = 0; - } - } - numUsedHandles = 0; - for (i = 0; i < heap.numHandles; i++) - { - // we need to scan in memory order so we can compact things without - // copying objects over each other - h = heap.hos[- (int32)i].order; - obj = h + FIRST_OBJ + 1; - if (!heap.hos[- (int32)h].temp) - { - // handle is free - dereference object - if (objectPtr(obj) != NULL) - { - wclass = WOBJ_class(obj); - // for non-arrays, call objDestroy if present - if (wclass != NULL && wclass->objDestroyFunc) - wclass->objDestroyFunc(obj); - heap.hos[- (int32)h].ptr = NULL; - } - continue; - } - wclass = WOBJ_class(obj); - if (wclass == NULL) - objSize = arraySize(WOBJ_arrayType(obj), WOBJ_arrayLen(obj)); - else - objSize = WCLASS_objectSize(wclass); - - // copy object to new heap - src = (uchar *)heap.hos[- (int32)h].ptr; - dst = &heap.mem[heap.objectSize]; - if (src != dst) - // NOTE: overlapping regions need to copy correctly - xmemmove(dst, src, objSize); - heap.hos[- (int32)h].ptr = (Var *)dst; - heap.hos[- (int32)numUsedHandles].order = h; - heap.objectSize += objSize; - numUsedHandles++; - } - heap.numFreeHandles = heap.numHandles - numUsedHandles; - for (i = 0; i < heap.numHandles; i++) - if (!heap.hos[- (int32)i].temp) - { - // add free handle to free section of order array - heap.hos[- (int32)numUsedHandles].order = i; - numUsedHandles++; - } - // zero out the part of the heap that is now junk - xmemzero(&heap.mem[heap.objectSize], prevObjectSize - heap.objectSize); - } - - void gc() - { - WClass *wclass; - WObject obj; - uint32 i, j; - - // mark objects on vm stack - for (i = 0; i < vmStackPtr; i++) - if (VALID_OBJ(vmStack[i].obj)) - markObject(vmStack[i].obj); - // mark objects on native stack - for (i = 0; i < nmStackPtr; i++) - if (VALID_OBJ(nmStack[i])) - markObject(nmStack[i]); - // mark all static class objects - for (i = 0; i < CLASS_HASH_SIZE; i++) - { - wclass = classHashList[i]; - while (wclass != NULL) - { - for (j = 0; j < wclass->numFields; j++) - { - WClassField *field; - - field = &wclass->fields[j]; - if (!FIELD_isStatic(field)) - continue; - obj = field->var.staticVar.obj; - if (VALID_OBJ(obj)) - markObject(obj); - } - wclass = wclass->nextClass; - } - } - sweep(); - #ifdef DEBUGMEMSIZE - debugMemSize(); - #endif - } - - // NOTE: size passed must be 4 byte aligned (see arraySize()) - WObject allocObject(int32 size) - { - uint32 i, sizeReq, hosSize; - if (size <= 0) - return 0; - sizeReq = size; - if (!heap.numFreeHandles) - sizeReq += sizeof(Hos); - hosSize = heap.numHandles * sizeof(Hos); - if (sizeReq + hosSize + heap.objectSize > heap.memSize) - { - gc(); - // heap.objectSize changed or we are out of memory - if (sizeReq + hosSize + heap.objectSize > heap.memSize) - { - VmQuickError(ERR_OutOfObjectMem); - return 0; - } - } - if (heap.numFreeHandles) - { - i = heap.hos[- (int32)(heap.numHandles - heap.numFreeHandles)].order; - heap.numFreeHandles--; - } - else - { - // no free handles, get a new one - i = heap.numHandles; - heap.hos[- (int32)i].order = i; - heap.numHandles++; - } - - heap.hos[- (int32)i].ptr = (Var *)&heap.mem[heap.objectSize]; - heap.objectSize += size; - return FIRST_OBJ + i + 1; - } - // NOTE: we made this function a #define and it showed no real performance - // gain over having it a function on either PalmOS or Windows when - // optimization was turned on. - - Var *objectPtr(WObject obj) - { - return heap.hos[- (int32)(obj - FIRST_OBJ - 1)].ptr; - } // --- 2483,2488 ---- |
From: Manfred R. <mr...@us...> - 2003-08-09 21:59:50
|
Update of /cvsroot/waba/waba/vm In directory sc8-pr-cvs1:/tmp/cvs-serv22301/vm Modified Files: waba.h Log Message: Added exception include Index: waba.h =================================================================== RCS file: /cvsroot/waba/waba/vm/waba.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** waba.h 9 Aug 2003 21:04:26 -0000 1.27 --- waba.h 9 Aug 2003 21:59:47 -0000 1.28 *************** *** 42,45 **** --- 42,46 ---- #include "debug.h" #include "error.h" + #include "exception.h" #include "opcodes.h" #include "constants.h" |
From: Manfred R. <mr...@us...> - 2003-08-09 21:58:00
|
Update of /cvsroot/waba/waba/vm In directory sc8-pr-cvs1:/tmp/cvs-serv21994/vm Added Files: exception.h Log Message: Added header file for exceptions --- NEW FILE: exception.h --- /* * $Id: exception.h,v 1.1 2003/08/09 21:57:57 mriem Exp $ * * Copyright (c) 2001, 2002, 2003, Waba @ Sourceforge. * Copyright (c) 1998, 1999, 2000, Wabasoft. * All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * ---------------------------------------------------------------------------- * * Defines the exception support in the VM. * * ---------------------------------------------------------------------------- */ #ifndef __EXCEPTION_H__ #define __EXCEPTION_H__ #endif |
From: Manfred R. <mr...@us...> - 2003-08-09 21:13:45
|
Update of /cvsroot/waba/waba In directory sc8-pr-cvs1:/tmp/cvs-serv15735 Modified Files: build.xml Log Message: Changed daily build part (only have a date, no timestamp) Index: build.xml =================================================================== RCS file: /cvsroot/waba/waba/build.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** build.xml 19 May 2003 13:27:49 -0000 1.7 --- build.xml 9 Aug 2003 21:13:42 -0000 1.8 *************** *** 352,357 **** <target name="daily" depends="init" description="Prepares the distribution"> ! <mkdir dir="${dist.root}/${DSTAMP}-${TSTAMP}"/> ! <copy todir="${dist.root}/${DSTAMP}-${TSTAMP}"> <fileset dir="${package.root}" excludes="dist/**,build/**"/> --- 352,357 ---- <target name="daily" depends="init" description="Prepares the distribution"> ! <mkdir dir="${dist.root}/${DSTAMP}"/> ! <copy todir="${dist.root}/${DSTAMP}"> <fileset dir="${package.root}" excludes="dist/**,build/**"/> *************** *** 366,380 **** depends="daily" description="* Generate the distribution as a .tar.gz file"> ! <tar tarfile="${dist.root}/${dist.name}-${DSTAMP}-${TSTAMP}.tar" ! basedir="${dist.root}/${DSTAMP}-${TSTAMP}" includes="**"/> ! <gzip zipfile="${dist.root}/${dist.name}-${DSTAMP}-${TSTAMP}.tar.gz" ! src="${dist.root}/${dist.name}-${DSTAMP}-${TSTAMP}.tar"/> </target> <target name="daily-zip" depends="daily" description="* Generate the distribution as a .zip file"> ! <zip zipfile="${dist.root}/${dist.name}-${DSTAMP}-${TSTAMP}.zip" ! basedir="${dist.root}/${DSTAMP}-${TSTAMP}" includes="**"/> </target> --- 366,380 ---- depends="daily" description="* Generate the distribution as a .tar.gz file"> ! <tar tarfile="${dist.root}/${dist.name}-${DSTAMP}.tar" ! basedir="${dist.root}/${DSTAMP}" includes="**"/> ! <gzip zipfile="${dist.root}/${dist.name}-${DSTAMP}.tar.gz" ! src="${dist.root}/${dist.name}-${DSTAMP}.tar"/> </target> <target name="daily-zip" depends="daily" description="* Generate the distribution as a .zip file"> ! <zip zipfile="${dist.root}/${dist.name}-${DSTAMP}.zip" ! basedir="${dist.root}/${DSTAMP}" includes="**"/> </target> |
From: Manfred R. <mr...@us...> - 2003-08-09 21:04:28
|
Update of /cvsroot/waba/waba/vm In directory sc8-pr-cvs1:/tmp/cvs-serv14266/vm Modified Files: waba.h Added Files: thread.h Log Message: Added thread.h --- NEW FILE: thread.h --- /* * $Id: thread.h,v 1.1 2003/08/09 21:04:26 mriem Exp $ * * Copyright (c) 2001, 2002, 2003, Waba @ Sourceforge. * Copyright (c) 1998, 1999, 2000, Wabasoft. * All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * ---------------------------------------------------------------------------- * * Defines support for threads. * * ---------------------------------------------------------------------------- */ #ifndef __THREAD_H__ #define __THREAD_H__ #endif Index: waba.h =================================================================== RCS file: /cvsroot/waba/waba/vm/waba.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** waba.h 9 Aug 2003 20:37:34 -0000 1.26 --- waba.h 9 Aug 2003 21:04:26 -0000 1.27 *************** *** 44,47 **** --- 44,48 ---- #include "opcodes.h" #include "constants.h" + #include "thread.h" // |
From: Manfred R. <mr...@us...> - 2003-08-09 21:02:10
|
Update of /cvsroot/waba/waba/vm/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv13847/vm/win32 Modified Files: Makefile Log Message: Compile everything in VM directory Index: Makefile =================================================================== RCS file: /cvsroot/waba/waba/vm/win32/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 9 Aug 2003 19:32:33 -0000 1.3 --- Makefile 9 Aug 2003 21:02:07 -0000 1.4 *************** *** 35,38 **** waba.exe : ! cl $(PLATFORM) $(WITH) /I win32 waba.c win32\*.c gdi32.lib user32.lib mpr.lib \ ! ws2_32.lib winmm.lib /link /SUBSYSTEM:$(SUBSYSTEM) --- 35,38 ---- waba.exe : ! cl $(PLATFORM) $(WITH) /I win32 *.c win32\*.c gdi32.lib user32.lib mpr.lib \ ! ws2_32.lib winmm.lib /link /SUBSYSTEM:$(SUBSYSTEM) /out:waba.exe |
From: Manfred R. <mr...@us...> - 2003-08-09 20:44:31
|
Update of /cvsroot/waba/waba/vm In directory sc8-pr-cvs1:/tmp/cvs-serv10121/vm Modified Files: error.h Log Message: Disabled function prototypes to make sure compile still succeeds. Need to figure out how to do the proper sequence before I re-enable it again. Index: error.h =================================================================== RCS file: /cvsroot/waba/waba/vm/error.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** error.h 9 Aug 2003 20:15:09 -0000 1.3 --- error.h 9 Aug 2003 20:44:28 -0000 1.4 *************** *** 91,103 **** /* ! * Function prototypes. */ - - void VmError( uint16 errNum, - WClass *iclass, - UtfString *desc1, - UtfString *desc2); - - void VmQuickError( uint16 errNum ); #endif --- 91,107 ---- /* ! * Function prototypes ! * ------------------- ! * ! * NOTE: the function prototypes should be enabled here once we have finished ! * cleaning up interdepencies. ! * ! * void VmError( uint16 errNum, ! * WClass *iclass, ! * UtfString *desc1, ! * UtfString *desc2); ! * ! * void VmQuickError( uint16 errNum ); */ #endif |
From: Manfred R. <mr...@us...> - 2003-08-09 20:37:37
|
Update of /cvsroot/waba/waba/vm In directory sc8-pr-cvs1:/tmp/cvs-serv7972/vm Modified Files: waba.c waba.h Log Message: Moved error functions to separate C and H file Index: waba.c =================================================================== RCS file: /cvsroot/waba/waba/vm/waba.c,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** waba.c 9 Aug 2003 19:45:31 -0000 1.47 --- waba.c 9 Aug 2003 20:37:34 -0000 1.48 *************** *** 368,428 **** } - void VmError(uint16 errNum, WClass *iclass, UtfString *desc1, UtfString *desc2) - { - WClass *wclass; - WClassMethod *method; - UtfString className, iclassName, methodName, methodDesc; - - // NOTE: Don't overwrite an existing error since it may be the - // root cause of this error. - if (vmStatus.errNum != 0) - return; - vmStatus.errNum = errNum; - - // get current class and method off stack - if (vmStackPtr > 0) - { - wclass = (WClass *)vmStack[vmStackPtr - 1].refValue; - method = (WClassMethod *)vmStack[vmStackPtr - 2].refValue; - } - else - { - wclass = 0; - method = 0; - } - - // output class and method name - if (wclass) - { - className = getUtfString(wclass, wclass->classNameIndex); - printToBuf(vmStatus.className, 40, &className, NULL); - } - if (method) - { - methodName = getUtfString(wclass, METH_nameIndex(method)); - methodDesc = getUtfString(wclass, METH_descIndex(method)); - printToBuf(vmStatus.methodName, 40, &methodName, &methodDesc); - } - - // output additional error arguments (target class, desc, etc.) - if (iclass) - { - iclassName = getUtfString(iclass, iclass->classNameIndex); - printToBuf(vmStatus.arg1, 40, &iclassName, NULL); - } - printToBuf(vmStatus.arg2, 40, desc1, desc2); - - #ifdef WIN32 - #ifndef WINCE - dumpStackTrace(); - #endif - #endif - } - - void VmQuickError(uint16 errNum) - { - VmError(errNum, NULL, NULL, NULL); - } - void VmFree() { --- 368,371 ---- Index: waba.h =================================================================== RCS file: /cvsroot/waba/waba/vm/waba.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** waba.h 9 Aug 2003 19:51:27 -0000 1.25 --- waba.h 9 Aug 2003 20:37:34 -0000 1.26 *************** *** 367,372 **** void VmInit(uint32 vmStackSizeInBytes, uint32 nmStackSizeInBytes, uint32 classHeapSize, uint32 objectHeapSize); - void VmError(uint16 errNum, WClass *iclass, UtfString *desc1, UtfString *desc2); - void VmQuickError(uint16 errNum); WObject VmStartApp(char *className); int VmStartApplication(char *className, int argc, char** argv); //SD --- 367,370 ---- |
From: Manfred R. <mr...@us...> - 2003-08-09 20:15:11
|
Update of /cvsroot/waba/waba/vm In directory sc8-pr-cvs1:/tmp/cvs-serv3720/vm Modified Files: error.h Added Files: error.c Log Message: Added error functions to this implementation file. Added the function prototypes to the include file --- NEW FILE: error.c --- /* * $Id: error.c,v 1.1 2003/08/09 20:15:09 mriem Exp $ * * Copyright (c) 2001, 2002, 2003, Waba @ Sourceforge. * Copyright (c) 1998, 1999, 2000, Wabasoft. * All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * ---------------------------------------------------------------------------- * * Implements support for errors. * * ---------------------------------------------------------------------------- */ #include "waba.h" #include "error.h" void VmError( uint16 errNum, WClass *iclass, UtfString *desc1, UtfString *desc2 ) { WClass *wclass; WClassMethod *method; UtfString className, iclassName, methodName, methodDesc; // NOTE: Don't overwrite an existing error since it may be the // root cause of this error. if (vmStatus.errNum != 0) return; vmStatus.errNum = errNum; // get current class and method off stack if (vmStackPtr > 0) { wclass = (WClass *)vmStack[vmStackPtr - 1].refValue; method = (WClassMethod *)vmStack[vmStackPtr - 2].refValue; } else { wclass = 0; method = 0; } // output class and method name if (wclass) { className = getUtfString(wclass, wclass->classNameIndex); printToBuf(vmStatus.className, 40, &className, NULL); } if (method) { methodName = getUtfString(wclass, METH_nameIndex(method)); methodDesc = getUtfString(wclass, METH_descIndex(method)); printToBuf(vmStatus.methodName, 40, &methodName, &methodDesc); } // output additional error arguments (target class, desc, etc.) if (iclass) { iclassName = getUtfString(iclass, iclass->classNameIndex); printToBuf(vmStatus.arg1, 40, &iclassName, NULL); } printToBuf(vmStatus.arg2, 40, desc1, desc2); #ifdef WIN32 #ifndef WINCE dumpStackTrace(); #endif #endif } void VmQuickError(uint16 errNum) { VmError( errNum, NULL, NULL, NULL ); } Index: error.h =================================================================== RCS file: /cvsroot/waba/waba/vm/error.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** error.h 9 Aug 2003 18:09:03 -0000 1.2 --- error.h 9 Aug 2003 20:15:09 -0000 1.3 *************** *** 90,92 **** --- 90,103 ---- #define ERR_ClassTooLarge 21 + /* + * Function prototypes. + */ + + void VmError( uint16 errNum, + WClass *iclass, + UtfString *desc1, + UtfString *desc2); + + void VmQuickError( uint16 errNum ); + #endif |
From: Manfred R. <mr...@us...> - 2003-08-09 19:55:41
|
Update of /cvsroot/waba/waba/vm/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv889/vm/win32 Removed Files: config.h types.h waba.sln waba.vcproj Log Message: Removed old project files and some unnecessary include files --- config.h DELETED --- --- types.h DELETED --- --- waba.sln DELETED --- --- waba.vcproj DELETED --- |
From: Manfred R. <mr...@us...> - 2003-08-09 19:51:30
|
Update of /cvsroot/waba/waba/vm In directory sc8-pr-cvs1:/tmp/cvs-serv32554/vm Modified Files: waba.h Added Files: constants.h Log Message: Moved constants to constants.h --- NEW FILE: constants.h --- /* * $Id: constants.h,v 1.1 2003/08/09 19:51:27 mriem Exp $ * * Copyright (c) 2001, 2002, 2003, Waba @ Sourceforge. * Copyright (c) 1998, 1999, 2000, Wabasoft. * All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __CONSTANTS_H__ #define __CONSTANTS_H__ /* * Waba classic key constants. */ #define WABA_KEY_PAGE_UP 75000 #define WABA_KEY_PAGE_DOWN 75001 #define WABA_KEY_HOME 75002 #define WABA_KEY_END 75003 #define WABA_KEY_UP 75004 #define WABA_KEY_DOWN 75005 #define WABA_KEY_LEFT 75006 #define WABA_KEY_RIGHT 75007 #define WABA_KEY_INSERT 75008 #define WABA_KEY_ENTER 75009 #define WABA_KEY_TAB 75010 #define WABA_KEY_BACKSPACE 75011 #define WABA_KEY_ESCAPE 75012 #define WABA_KEY_DELETE 75013 #define WABA_KEY_MENU 75014 #define WABA_KEY_COMMAND 75015 /* * Waba classic event constants. */ #define WABA_EVENT_KEY_PRESS 100 #define WABA_EVENT_PEN_DOWN 200 #define WABA_EVENT_PEN_MOVE 201 #define WABA_EVENT_PEN_UP 202 #define WABA_EVENT_PEN_DRAG 203 #endif Index: waba.h =================================================================== RCS file: /cvsroot/waba/waba/vm/waba.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** waba.h 9 Aug 2003 19:45:32 -0000 1.24 --- waba.h 9 Aug 2003 19:51:27 -0000 1.25 *************** *** 43,70 **** #include "error.h" #include "opcodes.h" ! ! /* define the constants used in waba programs, like keys, events... */ ! #define WABA_KEY_PAGE_UP 75000 ! #define WABA_KEY_PAGE_DOWN 75001 ! #define WABA_KEY_HOME 75002 ! #define WABA_KEY_END 75003 ! #define WABA_KEY_UP 75004 ! #define WABA_KEY_DOWN 75005 ! #define WABA_KEY_LEFT 75006 ! #define WABA_KEY_RIGHT 75007 ! #define WABA_KEY_INSERT 75008 ! #define WABA_KEY_ENTER 75009 ! #define WABA_KEY_TAB 75010 ! #define WABA_KEY_BACKSPACE 75011 ! #define WABA_KEY_ESCAPE 75012 ! #define WABA_KEY_DELETE 75013 ! #define WABA_KEY_MENU 75014 ! #define WABA_KEY_COMMAND 75015 ! ! #define WABA_EVENT_KEY_PRESS 100 ! #define WABA_EVENT_PEN_DOWN 200 ! #define WABA_EVENT_PEN_MOVE 201 ! #define WABA_EVENT_PEN_UP 202 ! #define WABA_EVENT_PEN_DRAG 203 // --- 43,47 ---- #include "error.h" #include "opcodes.h" ! #include "constants.h" // |
From: Manfred R. <mr...@us...> - 2003-08-09 19:45:35
|
Update of /cvsroot/waba/waba/vm In directory sc8-pr-cvs1:/tmp/cvs-serv31408/vm Modified Files: waba.c waba.h Log Message: Renamed SEARCH_ constants to SEARCH_METHOD_ constants. Index: waba.c =================================================================== RCS file: /cvsroot/waba/waba/vm/waba.c,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** waba.c 9 Aug 2003 08:51:20 -0000 1.46 --- waba.c 9 Aug 2003 19:45:31 -0000 1.47 *************** *** 1141,1145 **** ; // found it from hash else ! overrideIndex = getMethodMapNum(wclass, name, desc, SEARCH_INHERITED); if (overrideIndex == -1) nLow++; --- 1141,1145 ---- ; // found it from hash else ! overrideIndex = getMethodMapNum(wclass, name, desc, SEARCH_METHOD_INHERITED); if (overrideIndex == -1) nLow++; *************** *** 2363,2377 **** vMap = &wclass->vMethodMap; ! if (searchType == SEARCH_ALL) { start = 0; end = vMap->mapSize + wclass->numMethods; } ! else if (searchType == SEARCH_INHERITED) { start = 0; end = vMap->mapSize; } ! else // SEARCH_THISCLASS { start = vMap->mapSize; --- 2363,2377 ---- vMap = &wclass->vMethodMap; ! if (searchType == SEARCH_METHOD_ALL) { start = 0; end = vMap->mapSize + wclass->numMethods; } ! else if (searchType == SEARCH_METHOD_INHERITED) { start = 0; end = vMap->mapSize; } ! else // SEARCH_METHOD_THISCLASS { start = vMap->mapSize; *************** *** 2422,2428 **** if (vclass != NULL) ! searchType = SEARCH_ALL; else ! searchType = SEARCH_THISCLASS; mapNum = getMethodMapNum(wclass, name, desc, searchType); if (mapNum < 0) --- 2422,2428 ---- if (vclass != NULL) ! searchType = SEARCH_METHOD_ALL; else ! searchType = SEARCH_METHOD_THISCLASS; mapNum = getMethodMapNum(wclass, name, desc, searchType); if (mapNum < 0) *************** *** 4862,4868 **** methodNameValid = 1; if (*pc == OP_invokevirtual) ! searchType = SEARCH_ALL; else ! searchType = SEARCH_THISCLASS; methodMapNum = getMethodMapNum(iclass, methodName, methodDesc, searchType); if (methodMapNum < 0) --- 4862,4868 ---- methodNameValid = 1; if (*pc == OP_invokevirtual) ! searchType = SEARCH_METHOD_ALL; else ! searchType = SEARCH_METHOD_THISCLASS; methodMapNum = getMethodMapNum(iclass, methodName, methodDesc, searchType); if (methodMapNum < 0) *************** *** 4935,4939 **** methodName = getUtfString(wclass, CONS_nameIndex(wclass, nameAndTypeIndex)); methodDesc = getUtfString(wclass, CONS_typeIndex(wclass, nameAndTypeIndex)); ! methodMapNum = getMethodMapNum(iclass, methodName, methodDesc, SEARCH_ALL); if (methodMapNum < 0) goto methoderror; --- 4935,4939 ---- methodName = getUtfString(wclass, CONS_nameIndex(wclass, nameAndTypeIndex)); methodDesc = getUtfString(wclass, CONS_typeIndex(wclass, nameAndTypeIndex)); ! methodMapNum = getMethodMapNum(iclass, methodName, methodDesc, SEARCH_METHOD_ALL); if (methodMapNum < 0) goto methoderror; Index: waba.h =================================================================== RCS file: /cvsroot/waba/waba/vm/waba.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** waba.h 9 Aug 2003 19:31:36 -0000 1.23 --- waba.h 9 Aug 2003 19:45:32 -0000 1.24 *************** *** 323,329 **** // search types for getMethodMapNum() ! #define SEARCH_ALL 0 ! #define SEARCH_INHERITED 1 ! #define SEARCH_THISCLASS 2 // keep this a prime number for best distribution --- 323,329 ---- // search types for getMethodMapNum() ! #define SEARCH_METHOD_ALL 0 ! #define SEARCH_METHOD_INHERITED 1 ! #define SEARCH_METHOD_THISCLASS 2 // keep this a prime number for best distribution |