You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ar...@apache.org on 2005/12/11 04:40:18 UTC

svn commit: r355889 [2/2] - in /incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm: include/ libjc/ libjc/arch/ libjc/arch/i386/ libjc/native/

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/misc.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/misc.c?rev=355889&r1=355888&r2=355889&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/misc.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/misc.c Sat Dec 10 19:40:08 2005
@@ -15,7 +15,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *
- * $Id: misc.c,v 1.9 2005/07/04 19:56:16 archiecobbs Exp $
+ * $Id$
  */
 
 #include "libjc.h"
@@ -79,61 +79,6 @@
 }
 
 /*
- * Comparator for _jc_class_node that sorts by name.
- */
-int
-_jc_classfile_tree_compare(const void *v1, const void *v2)
-{
-	const _jc_class_node *const node1 = v1;
-	const _jc_class_node *const node2 = v2;
-
-	return strcmp(node1->name, node2->name);
-}
-
-/*
- * Method comparison function that sorts by function address.
- *
- * This has a special case for function == function_end, which
- * is used for searching. In this case, the address is a return
- * address after a function call, so the beginning of the
- * other function is exclusive while its end is inclusive.
- */
-int
-_jc_method_tree_compare(const void *v1, const void *v2)
-{
-	const _jc_method *const method1 = v1;
-	const _jc_method *const method2 = v2;
-
-	/* Handle case where method1 is a search key */
-	if (method1->function == method1->u.exec.function_end) {
-		_JC_ASSERT(method2->function != method2->u.exec.function_end);
-		_JC_ASSERT(!_JC_ACC_TEST(method2, INTERP));
-		return (method1->function > method2->u.exec.function_end)
-		    - (method1->function <= method2->function);
-	}
-
-	/* Handle case where method2 is a search key */
-	if (method2->function == method2->u.exec.function_end) {
-		_JC_ASSERT(!_JC_ACC_TEST(method1, INTERP));
-		return (method2->function <= method1->function)
-		    - (method2->function > method1->u.exec.function_end);
-	}
-
-	/* Sanity check: we only do this for executable methods */
-	_JC_ASSERT(!_JC_ACC_TEST(method1, INTERP));
-	_JC_ASSERT(!_JC_ACC_TEST(method2, INTERP));
-
-	/* Sanity check: if they overlap, they must be the same method */
-	_JC_ASSERT(method1->u.exec.function_end <= method2->function
-	    || method2->u.exec.function_end <= method1->function
-	    || method1 == method2);
-
-	/* Both methods are normal */
-	return (method1->function > method2->function)
-	    - (method1->function < method2->function);
-}
-
-/*
  * Compare two class references.
  */
 int
@@ -318,46 +263,6 @@
 }
 
 /*
- * Parse object search path into _jc_parse_objpath structures.
- *
- * If unsuccessful an exception is stored.
- */
-int
-_jc_parse_objpath(_jc_env *env, const char *path, _jc_objpath_entry **listp)
-{
-	_jc_objpath_entry *list;
-	char **pathnames;
-	int len;
-	int i;
-
-	/* Chop up object path into components and count them */
-	if ((pathnames = _jc_parse_searchpath(env, path)) == NULL)
-		return -1;
-	for (len = 0; pathnames[len] != NULL; len++);
-
-	/* Allocate object path entry array */
-	if ((list = _jc_vm_zalloc(env, len * sizeof(*list))) == NULL) {
-		while (len > 0)
-			_jc_vm_free(&pathnames[--len]);
-		_jc_vm_free(&pathnames);
-		return -1;
-	}
-
-	/* Initialize entries */
-	for (i = 0; i < len; i++) {
-		_jc_objpath_entry *const ent = &list[i];
-
-		ent->type = _JC_OBJPATH_UNKNOWN;
-		ent->pathname = pathnames[i];
-	}
-
-	/* Done */
-	_jc_vm_free(&pathnames);
-	*listp = list;
-	return len;
-}
-
-/*
  * Parse a directory search path into component directories.
  *
  * If unsuccessful an exception is stored.
@@ -429,25 +334,6 @@
 	const _jc_type_node *const node2 = item2;
 
 	return strcmp(node1->type->name, node2->type->name);
-}
-
-/*
- * Compare two _jc_method_node's, sorting on the class and method name.
- */
-int
-_jc_method_node_compare(const void *v1, const void *v2)
-{
-	const _jc_method_node *const info1 = v1;
-	const _jc_method_node *const info2 = v2;
-	int diff;
-
-	if ((diff = info1->mlen - info2->mlen) != 0)
-		return diff;
-	if ((diff = info1->clen - info2->clen) != 0)
-		return diff;
-	if ((diff = strncmp(info1->mname, info2->mname, info1->mlen)) != 0)
-		return diff;
-	return strncmp(info1->cname, info2->cname, info1->clen);
 }
 
 /*

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/native/java_lang_VMThrowable.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/native/java_lang_VMThrowable.c?rev=355889&r1=355888&r2=355889&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/native/java_lang_VMThrowable.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/native/java_lang_VMThrowable.c Sat Dec 10 19:40:08 2005
@@ -15,7 +15,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *
- * $Id: java_lang_VMThrowable.c,v 1.3 2005/05/15 21:41:01 archiecobbs Exp $
+ * $Id$
  */
 
 #include "libjc.h"
@@ -139,9 +139,8 @@
 			goto fail;
 
 		/* Get Java line number, if known */
-		jline = _JC_ACC_TEST(method, INTERP) ?
-		    _jc_interp_pc_to_jline(method, frame->u.ipc) :
-		    _jc_exec_pc_to_jline(method, frame->u.pc);
+		jline = frame->ipc == -1 ?
+		    0 : _jc_interp_pc_to_jline(method, frame->ipc);
 
 		/* Create String for Class name, converting '/' -> '.' */
 		if ((cname = _jc_vm_strdup(env, class->name)) == NULL) {

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/properties.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/properties.c?rev=355889&r1=355888&r2=355889&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/properties.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/properties.c Sat Dec 10 19:40:08 2005
@@ -58,22 +58,6 @@
 { "jc.heap.size",			_JC_DEFAULT_HEAP_SIZE },
 { "jc.loader.size",			_JC_DEFAULT_LOADER_SIZE },
 { "jc.heap.granularity",		_JC_DEFAULT_HEAP_GRANULARITY },
-{ "jc.gnu.compiler",			_JC_GNU_COMPILER },
-{ "jc.include.dir",			_JC_INCLUDE_DIR },
-{ "jc.object.generator",	"org.dellroad.jc.cgen.JCObjectGenerator" },
-{ "jc.method.optimizer",	"org.dellroad.jc.cgen.DefaultMethodOptimizer" },
-{ "jc.gen.inline.max.expansion",	"2.5" },
-{ "jc.gen.inline.max.caller",		"5000" },
-{ "jc.gen.inline.max.callee",		"12" },
-{ "jc.gen.inline.min.caller",		"20" },
-{ "jc.gen.inline.min.callee",		"3" },
-{ "jc.gen.inline.verbose",		"false" },
-{ "jc.include.line.numbers",		"true" },
-{ "jc.object.generation.enabled",	/* "true" */ "false" },
-{ "jc.object.loader.enabled",		/* "true" */ "false" },
-{ "jc.without.classfiles",		"false" },
-{ "jc.ignore.resolution.failures",	"false" },
-{ "jc.resolve.native.directly",		"false" },
 { NULL,					NULL }
 };
 
@@ -95,7 +79,6 @@
 	struct utsname uts;
 	struct passwd *pw;
 	time_t now;
-	char *buf;
 	char *s;
 	int i;
 
@@ -147,20 +130,6 @@
 	    "user.timezone", localtime(&now)->tm_zone) != JNI_OK)
 		return JNI_ERR;
 
-	/* Set source and object directory paths */
-	if ((buf = _JC_FORMAT_STRING(env, "%s%s.jc_src%s%s",
-	    home_dir, _JC_FILE_SEPARATOR, _JC_PATH_SEPARATOR,
-	    _JC_BOOT_SOURCE_DIR)) == NULL)
-		return JNI_ERR;
-	if (_jc_set_property(env, "jc.source.path", buf) != JNI_OK)
-		return JNI_ERR;
-	if ((buf = _JC_FORMAT_STRING(env, "%s%s.jc_obj%s%s",
-	    home_dir, _JC_FILE_SEPARATOR, _JC_PATH_SEPARATOR,
-	    _JC_BOOT_OBJECT_DIR)) == NULL)
-		return JNI_ERR;
-	if (_jc_set_property(env, "jc.object.path", buf) != JNI_OK)
-		return JNI_ERR;
-
 	/* Set operating system info */
 	if (uname(&uts) == -1) {
 		_JC_EX_STORE(env, InternalError, "%s: %s",
@@ -264,23 +233,12 @@
 	_jc_jvm *const vm = env->vm;
 	_jc_property *prop;
 	size_t loader_size;
-	int len;
 	int i;
 
 	/* Sort properties for faster searching */
 	qsort(vm->system_properties.elems, vm->system_properties.length,
 	    sizeof(*vm->system_properties.elems), _jc_property_cmp);
 
-	/* Get whether object generation is enabled */
-	prop = _jc_property_get(vm, "jc.object.generation.enabled");
-	_JC_ASSERT(prop != NULL);
-	vm->generation_enabled = strcmp(prop->value, "true") == 0;
-
-	/* Get line number support */
-	prop = _jc_property_get(vm, "jc.include.line.numbers");
-	_JC_ASSERT(prop != NULL);
-	vm->line_numbers = strcmp(prop->value, "true") == 0;
-
 	/* Sanity check */
 	_JC_ASSERT(vm->boot.class_path == NULL);
 	_JC_ASSERT(vm->boot.class_path_len == 0);
@@ -304,25 +262,6 @@
 	    &vm->boot.class_path, &vm->boot.class_path_len) == JNI_ERR)
 		return JNI_ERR;
 
-	/* Get object file search path */
-	prop = _jc_property_get(vm, "jc.object.path");
-	_JC_ASSERT(prop != NULL);
-
-	/* Sanity check */
-	_JC_ASSERT(vm->object_path == NULL);
-	_JC_ASSERT(vm->object_path_len == 0);
-
-	/* Parse object path */
-	if ((len = _jc_parse_objpath(env, prop->value, &vm->object_path)) == -1)
-		return JNI_ERR;
-	vm->object_path_len = len;
-
-	/* Get source and object directory paths */
-	prop = _jc_property_get(vm, "jc.source.path");
-	_JC_ASSERT(prop != NULL);
-	if ((vm->source_path = _jc_parse_searchpath(env, prop->value)) == NULL)
-		return JNI_ERR;
-
 	/* Get thread stack minimum, maximum, and default */
 	prop = _jc_property_get(vm, "jc.stack.minimum");
 	_JC_ASSERT(prop != NULL);
@@ -352,30 +291,6 @@
 		return JNI_ERR;
 	vm->max_loader_pages = _JC_HOWMANY(loader_size, _JC_PAGE_SIZE);
 	vm->avail_loader_pages = vm->max_loader_pages;
-
-	/* Check for native resolution optimization */
-	prop = _jc_property_get(vm, "jc.resolve.native.directly");
-	_JC_ASSERT(prop != NULL);
-	vm->resolve_native_directly = strcmp(prop->value, "true") == 0;
-
-	/* Check whether we really need classfiles */
-	prop = _jc_property_get(vm, "jc.without.classfiles");
-	_JC_ASSERT(prop != NULL);
-	vm->without_classfiles = strcmp(prop->value, "true") == 0;
-
-	/* Check whether to enable the ELF loader */
-	prop = _jc_property_get(vm, "jc.object.loader.enabled");
-	_JC_ASSERT(prop != NULL);
-	vm->loader_enabled = strcmp(prop->value, "true") == 0;
-
-	/* Check whether we should ignore class resolution failures */
-	prop = _jc_property_get(vm, "jc.ignore.resolution.failures");
-	_JC_ASSERT(prop != NULL);
-	vm->ignore_resolution_failures = strcmp(prop->value, "true") == 0;
-
-	/* Without classfiles or loader implies no object generation */
-	if (vm->without_classfiles || !vm->loader_enabled)
-		vm->generation_enabled = JNI_FALSE;
 
 	/* Check stack parameters */
 	if (vm->threads.stack_minimum > vm->threads.stack_default

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve.c?rev=355889&r1=355888&r2=355889&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve.c Sat Dec 10 19:40:08 2005
@@ -91,17 +91,12 @@
 			goto fail;
 	}
 
-	/* Compute vtable and mtable for this class (as needed) */
-	if (!_JC_ACC_TEST(type, INTERFACE)) {
-		_jc_jvm *const vm = env->vm;
+	/* Compute vtable and mtable for this class */
+	if (!_JC_ACC_TEST(type, INTERFACE))
+		_jc_resolve_vtable(env->vm, type);
 
-		if (!vm->loader_enabled || !vm->generation_enabled)
-			_jc_resolve_vtable(vm, type);
-	}
-
-	/* Resolve interpreted types */
-	if (_JC_ACC_TEST(type, INTERP)
-	    && _jc_resolve_interp(env, type, &info) != JNI_OK)
+	/* Resolve type */
+	if (_jc_resolve_interp(env, type, &info) != JNI_OK)
 	    	goto fail;
 
 	/* Merge in type's implicit references into class loader's list */
@@ -141,7 +136,7 @@
 }
 
 /*
- * Resolve vtable and mtable (as needed).
+ * Resolve vtable and mtable.
  */
 static void
 _jc_resolve_vtable(_jc_jvm *vm, _jc_type *type)
@@ -150,8 +145,7 @@
 	int i;
 
 	/* Sanity check */
-	_JC_ASSERT(!_JC_ACC_TEST(type, INTERFACE)
-	    && (!vm->loader_enabled || !vm->generation_enabled));
+	_JC_ASSERT(!_JC_ACC_TEST(type, INTERFACE));
 
 	/*
 	 * Copy superclass' vtable and mtable. At this point these tables
@@ -161,14 +155,9 @@
 		_jc_type *const stype = type->superclass;
 		_jc_nonarray_type *const sntype = &stype->u.nonarray;
 
-		/*
-		 * For interpreted types, copy superclass vtable.
-		 * For ELF types, the vtable should already be correct.
-		 */
-		if (_JC_ACC_TEST(type, INTERP)) {
-			memcpy(type->vtable, stype->vtable,
-			    sntype->num_vmethods * sizeof(*type->vtable));
-		}
+		/* Copy superclass vtable */
+		memcpy(type->vtable, stype->vtable,
+		    sntype->num_vmethods * sizeof(*type->vtable));
 
 		/* Copy superclass mtable (if needed) */
 		memcpy(ntype->mtable, sntype->mtable,
@@ -227,12 +216,8 @@
 
 	/* Search for field in superinterfaces */
 	for (i = 0; i < type->num_interfaces; i++) {
-		_jc_type *itype;
+		_jc_type *const itype = type->interfaces[i];
 
-		itype = (!_JC_FLG_TEST(type, RESOLVED)
-		      && !_JC_ACC_TEST(type, INTERP)) ?
-		    type->u.nonarray.supers->interfaces[i] :
-		    type->interfaces[i];
 		if ((field = _jc_resolve_field(env,
 		    itype, name, sig, is_static)) != NULL)
 			return field;
@@ -240,10 +225,7 @@
 
 	/* Search for field in superclasses */
 	while (JNI_TRUE) {
-		type = (!_JC_FLG_TEST(type, RESOLVED)
-		      && !_JC_ACC_TEST(type, INTERP)) ?
-		    type->u.nonarray.supers->superclass : type->superclass;
-		if (type == NULL)
+		if ((type = type->superclass) == NULL)
 			break;
 		if ((field = _jc_get_declared_field(env,
 		    type, name, sig, is_static)) != NULL)
@@ -279,19 +261,13 @@
 			return method;
 		if (clinit)
 			return NULL;
-		stype = (!_JC_FLG_TEST(stype, RESOLVED)
-		      && !_JC_ACC_TEST(stype, INTERP)) ?
-		    stype->u.nonarray.supers->superclass : stype->superclass;
+		stype = stype->superclass;
 	}
 
 	/* Search for method in superinterfaces */
 	for (i = 0; i < type->num_interfaces; i++) {
-		_jc_type *itype;
+		_jc_type *const itype = type->interfaces[i];
 
-		itype = (!_JC_FLG_TEST(type, RESOLVED)
-		      && !_JC_ACC_TEST(type, INTERP)) ?
-		    type->u.nonarray.supers->interfaces[i] :
-		    type->interfaces[i];
 		if ((method = _jc_resolve_method(env,
 		    itype, name, sig)) != NULL)
 			return method;

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve2.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve2.c?rev=355889&r1=355888&r2=355889&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve2.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve2.c Sat Dec 10 19:40:08 2005
@@ -15,7 +15,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *
- * $Id: resolve2.c,v 1.4 2005/07/10 21:03:54 archiecobbs Exp $
+ * $Id$
  */
 
 #include "libjc.h"
@@ -49,10 +49,9 @@
 {
 	_jc_jvm *const vm = env->vm;
 	_jc_nonarray_type *const ntype = &type->u.nonarray;
-	_jc_classfile *const cfile = ntype->u.cfile;
+	_jc_classfile *const cfile = ntype->cfile;
 
 	/* Sanity check */
-	_JC_ASSERT(_JC_ACC_TEST(type, INTERP));
 	_JC_ASSERT(!_JC_FLG_TEST(type, ARRAY));
 
 	/* Verbosity */
@@ -101,7 +100,7 @@
 		goto fail;
 
 	/* We don't need the class file anymore */
-	_jc_destroy_classfile(&type->u.nonarray.u.cfile);
+	_jc_destroy_classfile(&type->u.nonarray.cfile);
 
 	/* Done */
 	return JNI_OK;
@@ -125,15 +124,12 @@
 {
 	_jc_jvm *const vm = env->vm;
 	_jc_nonarray_type *const ntype = &type->u.nonarray;
-	_jc_classfile *const cfile = ntype->u.cfile;
+	_jc_classfile *const cfile = ntype->cfile;
 	size_t initial_values_size;
 	void *initial_values;
 	char *ptr;
 	int i;
 
-	/* Sanity check */
-	_JC_ASSERT(_JC_ACC_TEST(type, INTERP));
-
 	/* Resolve each field's type and count static initializers */
 	initial_values_size = 0;
 	for (i = 0; i < ntype->num_fields; i++) {
@@ -141,9 +137,6 @@
 		const u_char ptype = _jc_sig_types[(u_char)*cfield->descriptor];
 		_jc_field *const field = ntype->fields[i];
 
-		/* Sanity check */
-		_JC_ASSERT(_JC_ACC_TEST(field, INTERP));
-
 		/* Resolve type and add up initializer sizes */
 		switch (ptype) {
 		case _JC_TYPE_BOOLEAN:
@@ -295,12 +288,9 @@
 {
 	_jc_nonarray_type *const ntype = &type->u.nonarray;
 	_jc_class_loader *const loader = type->loader;
-	_jc_classfile *const cfile = ntype->u.cfile;
+	_jc_classfile *const cfile = ntype->cfile;
 	int i;
 
-	/* Sanity check */
-	_JC_ASSERT(_JC_ACC_TEST(type, INTERP));
-
 	/* Resolve method signature info */
 	for (i = 0; i < ntype->num_methods; i++) {
 		_jc_cf_method *const cmethod = &cfile->methods[i];
@@ -309,9 +299,6 @@
 		MD5_CTX ctx;
 		int j;
 
-		/* Sanity check */
-		_JC_ASSERT(_JC_ACC_TEST(method, INTERP));
-
 		/* Compute method's signature hash */
 		MD5_Init(&ctx);
 		MD5_Update(&ctx, method->name, strlen(method->name));
@@ -497,15 +484,14 @@
 {
 	_jc_jvm *const vm = env->vm;
 	_jc_class_loader *const loader = method->class->loader;
-	_jc_classfile *const cfile = method->class->u.nonarray.u.cfile;
-	_jc_method_code *const interp = &method->u.code;
+	_jc_classfile *const cfile = method->class->u.nonarray.cfile;
+	_jc_method_code *const interp = &method->code;
 	_jc_cf_code code_mem;
 	_jc_cf_code *const code = &code_mem;
 	jboolean mutex_locked;
 	int i;
 
 	/* Sanity check */
-	_JC_ASSERT(_JC_ACC_TEST(method, INTERP));
 	_JC_ASSERT(!_JC_FLG_TEST(method->class, RESOLVED));
 
 	/* Parse bytecode */
@@ -1298,8 +1284,7 @@
 	memset(&heads, ~0, sizeof(heads));
 	for (i = 0; i < num_types; i++) {
 		_jc_type *const type = types[i];
-		const int bucket = (int)type->u.nonarray.hash
-		    & (_JC_INSTANCEOF_HASHSIZE - 1);
+		const int bucket = _JC_INSTANCEOF_HASH(type);
 
 		/* Keep track of the number of nonempty buckets */
 		if (heads[bucket] == -1)
@@ -1360,7 +1345,7 @@
 _jc_resolve_inner_classes(_jc_env *env, _jc_type *type, _jc_resolve_info *info)
 {
 	_jc_nonarray_type *const ntype = &type->u.nonarray;
-	_jc_classfile *const cfile = ntype->u.cfile;
+	_jc_classfile *const cfile = ntype->cfile;
 	_jc_cf_inner_classes *const cinners = cfile->inner_classes;
 	int count;
 	int i;

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/signals.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/signals.c?rev=355889&r1=355888&r2=355889&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/signals.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/signals.c Sat Dec 10 19:40:08 2005
@@ -15,7 +15,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *
- * $Id: signals.c,v 1.9 2005/02/23 22:48:16 archiecobbs Exp $
+ * $Id$
  */
 
 #include "libjc.h"
@@ -176,7 +176,7 @@
 	 * If the signal occurred while the Java stack was clipped,
 	 * then it didn't occur in Java code and so was unexpected.
 	 */
-	if (estack->pc != NULL)
+	if (estack->jstack.clipped)
 		goto unexpected;
 
 #if !HAVE_GETCONTEXT
@@ -195,89 +195,13 @@
 	 */
 	_jc_stack_clip_ctx(env, &uctx->uc_mcontext);
 
-	/*
-	 * Adjust PC to be consistent with our 'frame' semantics.
-	 * Signals leave the PC pointing to the triggering instruction
-	 * rather than the 'return address' instruction.
-	 */
-	estack->pc = (const char *)estack->pc + 1;
-
-#ifndef NDEBUG
-	/*
-	 * For signals used to generate Java exceptions, verify that the signal
-	 * happened within a Java method and not some internal libjc function.
-	 */
-	switch (sig_index) {
-	case _JC_SIGNAL_SEGV:
-	case _JC_SIGNAL_BUS:
-	case _JC_SIGNAL_FPE:
-	    {
-		_jc_method *method;
-		_jc_method key;
-
-		key.function = key.u.exec.function_end = estack->pc;
-		_JC_MUTEX_LOCK(env, vm->mutex);
-		method = _jc_splay_find(&vm->method_tree, &key);
-		_JC_MUTEX_UNLOCK(env, vm->mutex);
-		if (method == NULL)
-			goto unexpected;
-		break;
-	    }
-	default:
-		break;
-	}
-#endif
-
 	/* Take the appropriate action */
 	switch (sig_index) {
-
-	/*
-	 * For SEGV/BUS, there are three cases:
-	 *
-	 * 1. null object dereference (generate NullPointerException)
-	 * 2. touched stack guard page (generate StackOverflowError)
-	 * 3. doing periodic thread check (call _jc_thread_check())
-	 */
 	case _JC_SIGNAL_SEGV:
 	case _JC_SIGNAL_BUS:
 	    {
-		jboolean stack_overflow;
-		const void *fault_addr;
-		unsigned int diff;
-
-		/* Get the fault address */
-		fault_addr = _jc_signal_fault_address(sig_num, info, uctx);
-
-		/* Test for thread check address */
-		if ((char *)fault_addr >= vm->check_address
-		    && (char *)fault_addr < vm->check_address + _JC_PAGE_SIZE) {
-			env->handling_signal = JNI_FALSE;
-			if (_jc_thread_check(env) != JNI_OK)
-				_jc_throw_exception(env);
-			_jc_stack_unclip(env);
-			return;
-		}
-
-		/*
-		 * Test for stack overflow. The signal happens when the
-		 * _JC_STACK_OVERFLOW_CHECK() macro probes past the top
-		 * of the stack and hits the guard page.  If the fault
-		 * address is "above" (stack relative) but "close to"
-		 * (within the stack overflow margin) the current stack
-		 * address then that must be what happened; otherwise, it
-		 * must just be a normal NullPointerException.
-		 */
-#if _JC_DOWNWARD_STACK
-		diff = (char *)&sig_num - (char *)fault_addr;
-#else
-		diff = (char *)fault_addr - (char *)&sig_num;
-#endif
-		stack_overflow = (diff <= _JC_STACK_OVERFLOW_MARGIN);
-
-		/* Throw the appropriate exception */
 		env->handling_signal = JNI_FALSE;
-		_jc_post_exception(env, stack_overflow ?
-		    _JC_StackOverflowError : _JC_NullPointerException);
+		_jc_post_exception(env, _JC_NullPointerException);
 		_jc_throw_exception(env);
 	    }
 

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/stack.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/stack.c?rev=355889&r1=355888&r2=355889&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/stack.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/stack.c Sat Dec 10 19:40:08 2005
@@ -15,7 +15,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *
- * $Id: stack.c,v 1.19 2005/04/04 14:04:05 archiecobbs Exp $
+ * $Id$
  */
 
 #include "libjc.h"
@@ -50,26 +50,17 @@
 	if (stack == NULL)
 		return JNI_FALSE;
 
-	/* If interpreting, just set the flag */
-	if (stack->interp) {
-		_jc_interp_stack *const istack = (_jc_interp_stack *)stack;
-
-		if (!istack->clipped) {
-			istack->clipped = JNI_TRUE;
-			return JNI_TRUE;
-		}
+	/* If already clipped, do nothing */
+	if (stack->clipped)
 		return JNI_FALSE;
-	}
+
+	/* If interpreting, just set the flag */
+	if (stack->interp)
+		goto done;
 
 	/* We are running executable Java */
 	estack = (_jc_exec_stack *)stack;
 
-	/* Is the Java stack already clipped? */
-	if (estack->pc != NULL) {
-		_JC_ASSERT(_jc_stack_frame_valid(estack->frame));
-		return JNI_FALSE;
-	}
-
 	/* Grab the current context and clip the Java stack with it */
 #if HAVE_GETCONTEXT
     {
@@ -111,11 +102,9 @@
     }
 #endif
 
-	/* Roll back two frames to calling function's calling function */
-	_jc_stack_frame_next(&estack->frame, &estack->pc);
-	_jc_stack_frame_next(&estack->frame, &estack->pc);
-
+done:
 	/* Done */
+	stack->clipped = JNI_TRUE;
 	return JNI_TRUE;
 }
 
@@ -146,17 +135,9 @@
 	_JC_ASSERT(!stack->interp);
 	estack = (_jc_exec_stack *)stack;
 
-	/* Sanity check */
-	_JC_ASSERT(estack->pc == NULL);
-	_JC_ASSERT(!_jc_stack_frame_valid(estack->frame));
-
 	/* Save machine registers */
 	estack->regs = *ctx;
 
-	/* Extract frame info from saved context */
-	estack->frame = _jc_mcontext_frame(&estack->regs);
-	estack->pc = _jc_mcontext_pc(&estack->regs);
-
 	/* Done */
 	return JNI_TRUE;
 }
@@ -168,35 +149,15 @@
 _jc_stack_unclip(_jc_env *env)
 {
 	_jc_java_stack *const stack = env->java_stack;
-	_jc_exec_stack *estack;
 
 	/* Sanity check */
 	_JC_ASSERT(stack != NULL);
 	_JC_ASSERT(env == _jc_get_current_env());
+	_JC_ASSERT(stack->clipped);
 
-	/* If interpreting, just unset the flag */
-	if (stack->interp) {
-		_jc_interp_stack *const istack = (_jc_interp_stack *)stack;
-
-		/* Sanity check: the stack is clipped */
-		_JC_ASSERT(istack->clipped);
-
-		/* Mark it unclipped */
-		istack->clipped = JNI_FALSE;
-		return;
-	}
-
-	/* We are running executable Java */
-	estack = (_jc_exec_stack *)stack;
-
-	/* Sanity check: the stack is clipped */
-	_JC_ASSERT(estack->pc != NULL);
-
-	/* Invalidate Java stack top, allowing it to "float" again */
-	estack->pc = NULL;
-#ifndef NDEBUG
-	_jc_stack_frame_init(&estack->frame);
-#endif
+	/* Mark it unclipped */
+	stack->clipped = JNI_FALSE;
+	return;
 }
 
 /*
@@ -289,11 +250,12 @@
 			    class->u.nonarray.source_file);
 
 			/* Print Java line number if known */
-			jline = _JC_ACC_TEST(method, INTERP) ?
-			    _jc_interp_pc_to_jline(method, frame->u.ipc) :
-			    _jc_exec_pc_to_jline(method, frame->u.pc);
-			if (jline != 0)
-				_jc_fprintf(vm, fp, ":%d", jline);
+			if (frame->ipc != -1) {
+				jline = _jc_interp_pc_to_jline(method,
+				    frame->ipc);
+				if (jline != 0)
+					_jc_fprintf(vm, fp, ":%d", jline);
+			}
 		}
 		_jc_fprintf(vm, fp, ")\n");
 	}
@@ -327,20 +289,19 @@
 	    crawl.method != NULL; _jc_stack_crawl_next(vm, &crawl)) {
 		_jc_saved_frame *const frame = &frames[i];
 
-		/* Skip non-Java functions */
-		if (crawl.method->class == NULL)
-			continue;
+		/* Sanity check */
+		_JC_ASSERT(crawl.method->class != NULL);
 
 		/* Save this one */
 		if (i < max) {
 			frame->method = crawl.method;
-			if (_JC_ACC_TEST(crawl.method, INTERP)) {
+			if (crawl.stack->interp) {
 				_jc_interp_stack *const istack
 				    = (_jc_interp_stack *)crawl.stack;
 
-				frame->u.ipc = *istack->pcp;
+				frame->ipc = *istack->pcp;
 			} else
-				frame->u.pc = crawl.pc;
+				frame->ipc = -1;
 		}
 		i++;
 	}
@@ -365,8 +326,6 @@
 _jc_stack_crawl_first(_jc_env *thread, _jc_stack_crawl *crawl)
 {
 	_jc_java_stack *const stack = thread->java_stack;
-	_jc_exec_stack *const estack = (_jc_exec_stack *)stack;
-	_jc_interp_stack *const istack = (_jc_interp_stack *)stack;
 
 	/* Initialize */
 	memset(crawl, 0, sizeof(*crawl));
@@ -377,36 +336,13 @@
 
 	/* Sanity check */
 	_JC_ASSERT(thread == _jc_get_current_env()
-	    || (((!stack->interp && estack->pc != NULL)
-	       || (stack->interp && istack->clipped))
+	    || (stack->clipped
 	      && (thread->status == _JC_THRDSTAT_HALTING_NONJAVA
 	       || thread->status == _JC_THRDSTAT_HALTED)));
 
 	/* Start with top of stack */
 	crawl->stack = stack;
-
-	/* Interpreted case is easy */
-	if (stack->interp) {
-		crawl->method = istack->method;
-		return;
-	}
-
-	/*
-	 * Executable case.
-	 *
-	 * If the stack top already clipped, use it; otherwise start here.
-	 * In the latter case, this must be the current thread.
-	 */
-	if ((crawl->pc = estack->pc) != NULL)
-		crawl->frame = estack->frame;
-	else {
-		_JC_ASSERT(!_jc_stack_frame_valid(estack->frame));
-		_jc_stack_frame_current(&crawl->frame);
-		_jc_stack_frame_next(&crawl->frame, &crawl->pc);
-	}
-
-	/* Skip over non-Java C stack frames */
-	_jc_stack_crawl_skip(thread->vm, crawl);
+	crawl->method = stack->method;
 }
 
 /*
@@ -420,21 +356,9 @@
 void
 _jc_stack_crawl_next(_jc_jvm *vm, _jc_stack_crawl *crawl)
 {
-	_jc_java_stack *stack = crawl->stack;
-
 	/* Sanity check */
 	_JC_ASSERT(crawl->method != NULL);
 
-	/*
-	 * For executable stack, just scan C stack frames until we
-	 * reach _jc_invoke_jcni_a() (we always will eventually).
-	 */
-	if (!stack->interp && crawl->method != &vm->invoke_method) {
-		_jc_stack_frame_next(&crawl->frame, &crawl->pc);
-		_jc_stack_crawl_skip(vm, crawl);
-		return;
-	}
-
 	/* Advance to the next deeper stack chunk */
 	crawl->stack = crawl->stack->next;
 
@@ -444,43 +368,7 @@
 		return;
 	}
 
-	/* Initialize new stack chunk */
-	if (crawl->stack->interp) {
-		_jc_interp_stack *const istack
-		    = (_jc_interp_stack *)crawl->stack;
-
-		crawl->method = istack->method;
-	} else {
-		_jc_exec_stack *const estack = (_jc_exec_stack *)crawl->stack;
-
-		crawl->pc = estack->pc;
-		crawl->frame = estack->frame;
-		_JC_ASSERT(_jc_stack_frame_valid(crawl->frame));
-		_jc_stack_crawl_skip(vm, crawl);
-	}
-}
-
-/*
- * March backwards through consecutive stack frames
- * until we hit one that matches a registered method.
- */
-void
-_jc_stack_crawl_skip(_jc_jvm *vm, _jc_stack_crawl *crawl)
-{
-	/* Look for a Java function (or _jc_invoke_jcni_a()) */
-	while (JNI_TRUE) {
-		_jc_method key;
-
-		/* See if stack frame function is a registered method */
-		key.function = key.u.exec.function_end = (void *)crawl->pc;
-		if ((crawl->method = _jc_splay_find(
-		    &vm->method_tree, &key)) != NULL) {
-			_JC_ASSERT(!_JC_ACC_TEST(crawl->method, INTERP));
-			break;
-		}
-
-		/* Advance to next C stack frame */
-		_jc_stack_frame_next(&crawl->frame, &crawl->pc);
-	}
+	/* Set method and return */
+	crawl->method = crawl->stack->method;
 }
 

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/structures.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/structures.h?rev=355889&r1=355888&r2=355889&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/structures.h (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/structures.h Sat Dec 10 19:40:08 2005
@@ -34,15 +34,9 @@
 typedef struct _jc_boot_methods _jc_boot_methods;
 typedef struct _jc_boot_objects _jc_boot_objects;
 typedef struct _jc_boot_types _jc_boot_types;
-typedef struct _jc_class_node _jc_class_node;
 typedef struct _jc_class_ref _jc_class_ref;
-typedef struct _jc_class_save _jc_class_save;
 typedef struct _jc_classbytes _jc_classbytes;
 typedef struct _jc_cpath_entry _jc_cpath_entry;
-typedef struct _jc_dwarf2_line_hdr _jc_dwarf2_line_hdr;
-typedef struct _jc_elf_debug_lines _jc_elf_debug_lines;
-typedef struct _jc_elf_info _jc_elf_info;
-typedef struct _jc_elf_loadable _jc_elf_loadable;
 typedef struct _jc_ex_info _jc_ex_info;
 typedef struct _jc_exec_stack _jc_exec_stack;
 typedef struct _jc_fat_lock _jc_fat_lock;
@@ -54,12 +48,9 @@
 typedef struct _jc_interp_stack _jc_interp_stack;
 typedef struct _jc_java_stack _jc_java_stack;
 typedef struct _jc_jvm _jc_jvm;
-typedef struct _jc_map_state _jc_map_state;
-typedef struct _jc_method_node _jc_method_node;
 typedef struct _jc_native_frame _jc_native_frame;
 typedef struct _jc_native_frame_list _jc_native_frame_list;
 typedef struct _jc_native_lib _jc_native_lib;
-typedef struct _jc_objpath_entry _jc_objpath_entry;
 typedef struct _jc_properties _jc_properties;
 typedef struct _jc_property _jc_property;
 typedef struct _jc_resolve_info _jc_resolve_info;
@@ -95,26 +86,9 @@
 };
 
 /************************************************************************
- *			ELF file structures				*
+ *			    Resolution info				*
  ************************************************************************/
 
-/* One entry in the object file search path */
-struct _jc_objpath_entry {
-	int			type;		/* _JC_OBJPATH_* */
-	char			*pathname;
-};
-
-/* Information about a method function during ELF file processing */
-struct _jc_method_node {
-	const char		*cname;		/* encoded class name */
-	int			clen;		/* length of 'cname' */
-	const char		*mname;		/* encoded method name */
-	int			mlen;		/* length of 'mname' */
-	size_t			size;		/* size of function body */
-	_jc_method		*method;	/* associated _jc_method */
-	_jc_splay_node		node;		/* node in temporary tree */
-};
-
 /* Information maintained when resolving classes */
 struct _jc_resolve_info {
 	_jc_type		*type;
@@ -140,54 +114,13 @@
 	uint16_t	jline;
 };
 
-/* Transient state used when building a PC map */
-struct _jc_map_state {
-	int			map_alloc;
-	int			last_linenum;
-	int			last_map;
-	_jc_linenum_info	linenum;
-	_jc_pc_map_info		pc_map;
-};
-
-/* DWARF line program header */
-struct _jc_dwarf2_line_hdr {
-	unsigned char	minimum_instruction_length;
-	unsigned char	default_is_stmt;
-	signed char	line_base;
-	unsigned char	line_range;
-	unsigned char	opcode_base;
-	unsigned char	standard_opcode_lengths[0];
-};
-
 /* Class bytes: in-memory copy of a class file byte[] array */
 struct _jc_classbytes {
 	u_char			*bytes;
 	size_t			length;
-	jlong			hash;
-	volatile _jc_word	refs;
 	void			(*freer)(_jc_classbytes *);
 };
 
-/*
- * VM meta-information about a class file, stored in the vm->classfiles tree.
- *
- * The 'bytes' field is non-NULL only if (a) the class was first loaded by
- * a non-bootstrap class loader, and (b) object file generation is enabled.
- *
- * Otherwise, we don't need it (not (b)) or we can get it by searching the
- * boot loader classpath (not (a)).
- *
- * Each loaded type holds one reference for its own class and one for
- * each class listed in its dependency list.
- */
-struct _jc_class_node {
-	const char	*name;			/* name of class */
-	jint		refs;			/* number of references */
-	jlong		hash;			/* hash of class file bytes */
-	_jc_classbytes	*bytes;			/* saved bytes for code gen */
-	_jc_splay_node	node;			/* in vm->classfiles */
-};
-
 /* A reference to one class from another class */
 struct _jc_class_ref {
 	const char	*name;			/* NOTE: not nul-terminated */
@@ -236,31 +169,27 @@
 /*
  * Common information that lives at the beginning of
  * _jc_exec_stack and _jc_interp_stack.
+ *
+ * The "next" field is needed is so we can "skip over" stack frames
+ * associated with native code, signal frames, etc. This is because
+ * we can't reliabily follow the chain of frame pointers through
+ * those frames (especially signal frames).
  */
 struct _jc_java_stack {
 	jboolean			interp;
+	jboolean			clipped;
+	_jc_method			*method;
 	_jc_java_stack			*next;
 };
 
 /*
- * Structure representing a contiguous portion of the C call stack
- * (some functions within which may be Java method C functions).
- * The "frame" and "pc" fields define the top of a C stack fragment
- * (or, in the case of the current thread, they may be NULL to indicate
- * that the top of the stack is the top of the real C stack and has not
- * yet been "marked"). The bottom of the fragment is always a stack
- * frame for _jc_invoke_jcni_a(). The next deeper contiguous stack frame
- * fragment is pointed to by the "next" field.
- *
- * The "next" field is needed is so we can "skip over" stack frames
- * associated with native code, signal frames, etc. This is because
- * we can't reliabily follow the chain of frame pointers through
- * those frames (especially signal frames).
+ * Represents one native method stack frame. "regs" hold a copy
+ * of all machine registers, so that all references are captured
+ * and don't leak into unscanned regions of the C call stack.
  */
 struct _jc_exec_stack {
 	_jc_java_stack			jstack;
-	_jc_stack_frame			frame;
-	const void			*pc;
+	void				*start_sp;
 	mcontext_t			regs;
 };
 
@@ -269,10 +198,8 @@
  */
 struct _jc_interp_stack {
 	_jc_java_stack			jstack;
-	_jc_method			*method;
 	_jc_word			*locals;
 	const int			*pcp;
-	jboolean			clipped;
 };
 
 /*
@@ -283,15 +210,11 @@
  * If/when Throwable.getStackTrace() is called later, this
  * information gets converted into a StackTraceElement[] array.
  *
- * For exec methods, 'pc' is the actual CPU program counter.
- * For interp methods, 'pc' points to the (int) instruction index.
+ * 'ipc' is the (int) instruction index.
  */
 struct _jc_saved_frame {
 	_jc_method			*method;
-	union {
-		const void			*pc;	/* executable */
-		int				ipc;	/* interpreted */
-	}				u;
+	int				ipc;
 };
 
 /*
@@ -301,18 +224,6 @@
 struct _jc_stack_crawl {
 	_jc_method			*method;	/* current method */
 	_jc_java_stack			*stack;		/* current chunk */
-	_jc_stack_frame			frame;		/* exec only */
-	const void			*pc;		/* exec only */
-};
-
-/*
- * Thread-private structure used when trying to find class files.
- * See _jc_get_class_node().
- */
-struct _jc_class_save {
-	const char	*name;			/* name of class */
-	_jc_classbytes	*bytes;			/* class file bytes */
-	_jc_class_save	*next;			/* next in list */
 };
 
 /*
@@ -387,7 +298,6 @@
 #endif
 
 	/* Thread flags */
-	const char			*generating;
 	jboolean			out_of_memory;
 	jboolean			handling_signal;
 
@@ -401,9 +311,6 @@
 	volatile _jc_word		interrupt_status;
 	_jc_fat_lock			*interruptible_lock;
 
-	/* Used by _jc_get_class_node() */
-	_jc_class_save			*class_save;
-
 	/* Support for threads throwing exceptions in other threads */
 	_jc_object			*volatile cross_exception;
 
@@ -454,7 +361,6 @@
 	_jc_splay_tree			defined_types;	/* _jc_type's */
 	int				num_implicit_refs;
 	_jc_object			**implicit_refs;
-	jboolean			*objects_loaded;
 	jboolean			gc_mark;
 	jboolean			waiters;
 	STAILQ_HEAD(, _jc_native_lib)	native_libs;
@@ -480,7 +386,6 @@
 	_jc_type	*ReadWrite;
 	_jc_type	*Error;
 	_jc_type	*Field;
-	_jc_type	*Generate;
 	_jc_type	*Method;
 	_jc_type	*Object;
 	_jc_type	*PhantomReference;
@@ -540,10 +445,6 @@
 		_jc_method	*init;
 	}			Field;
 	struct {
-		_jc_method	*v;
-		_jc_method	*generateObject;
-	}			Generate;
-	struct {
 		_jc_method	*init;
 		_jc_method	*invoke;
 	}			Method;
@@ -898,16 +799,6 @@
 	 * Properties and variables derived from them.
 	 */
 	_jc_properties			system_properties;
-	jboolean			generation_enabled;
-	jboolean			line_numbers;
-	jboolean			resolve_native_directly;
-	jboolean			without_classfiles;
-	jboolean			loader_enabled;
-	jboolean			ignore_resolution_failures;
-	jboolean			compiler_disabled;
-	char				**source_path;
-	_jc_objpath_entry		*object_path;
-	int				object_path_len;
 	int				max_loader_pages;
 
 	/*
@@ -937,17 +828,6 @@
 	LIST_HEAD(, _jc_class_loader)	class_loaders;
 
 	/*
-	 * Tree of known class files and their hash values.
-	 */
-	_jc_splay_tree			classfiles;	/* _jc_cfile_node's */
-
-	/*
-	 * Tree mapping stack PC values to Java methods (or C functions).
-	 */
-	_jc_splay_tree			method_tree;	/* _jc_method's */
-	_jc_method			invoke_method;	/* _jc_invoke_jcni_a()*/
-
-	/*
 	 * Used for 'stop the world' operations, suspend/resume, shutdown
 	 */
 	int				pending_halt_count;
@@ -956,7 +836,6 @@
 	pthread_cond_t			all_halted;
 	pthread_cond_t			world_restarted;
 	pthread_cond_t			vm_destruction;
-	char				*check_address;
 
 	/*
 	 * VM internal threads
@@ -971,7 +850,6 @@
 	jint				gc_cycles;
 	volatile _jc_word		avail_loader_pages;
 	_jc_word			gc_stack_visited;
-	FILE				*object_list;
 };
 
 #endif	/* _STRUCTURES_H_ */

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/tables.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/tables.c?rev=355889&r1=355888&r2=355889&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/tables.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/tables.c Sat Dec 10 19:40:08 2005
@@ -15,7 +15,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *
- * $Id: tables.c,v 1.11 2005/07/10 21:03:54 archiecobbs Exp $
+ * $Id$
  */
 
 #include "libjc.h"
@@ -261,9 +261,7 @@
 	[_JC_VERBOSE_EXCEPTIONS]=	"exceptions",
 	[_JC_VERBOSE_RESOLUTION]=	"resolution",
 	[_JC_VERBOSE_INIT]=		"init",
-	[_JC_VERBOSE_GEN]=		"gen",
 	[_JC_VERBOSE_JNI_INVOKE]=	"jni-invoke",
-	[_JC_VERBOSE_OBJ]=		"obj",
 };
 
 /*

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/thread.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/thread.c?rev=355889&r1=355888&r2=355889&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/thread.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/thread.c Sat Dec 10 19:40:08 2005
@@ -15,7 +15,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *
- * $Id: thread.c,v 1.15 2005/11/09 18:14:22 archiecobbs Exp $
+ * $Id$
  */
 
 #include "libjc.h"
@@ -351,22 +351,10 @@
 		}
 	}
 
-	/*
-	 * Unmap the check address page so all threads executing Java code
-	 * will receive a SEGV signal, which will cause them to invoke
-	 * _jc_thread_check() and notice that they need to halt.
-	 */
-	if (mprotect(vm->check_address, _JC_PAGE_SIZE, PROT_NONE) == -1)
-		_jc_fatal_error(vm, "mprotect: %s", strerror(errno));
-
 	/* Now wait for the threads running in Java mode to actually halt */
 	while (vm->pending_halt_count > 0)
 		_JC_COND_WAIT(env, vm->all_halted, vm->mutex);
 
-	/* Re-map the check address page */
-	if (mprotect(vm->check_address, _JC_PAGE_SIZE, PROT_READ) == -1)
-		_jc_fatal_error(vm, "mprotect: %s", strerror(errno));
-
 	/* Update flags */
 	vm->world_stopped = JNI_TRUE;
 }
@@ -435,11 +423,7 @@
 	/* Sanity check */
 	_JC_ASSERT(env->status == _JC_THRDSTAT_RUNNING_NORMAL
 	    || env->status == _JC_THRDSTAT_HALTING_NORMAL);
-	_JC_ASSERT(env->java_stack == NULL
-	    || ((!env->java_stack->interp
-	       && ((_jc_exec_stack *)env->java_stack)->pc != NULL)
-	      || (env->java_stack->interp
-	       && ((_jc_interp_stack *)env->java_stack)->clipped)));
+	_JC_ASSERT(env->java_stack == NULL || env->java_stack->clipped);
 
 	/* Update debug status */
 	if (fmt == NULL) {
@@ -489,11 +473,7 @@
 	/* Sanity check */
 	_JC_ASSERT(env->status == _JC_THRDSTAT_RUNNING_NONJAVA
 	    || env->status == _JC_THRDSTAT_HALTING_NONJAVA);
-	_JC_ASSERT(env->java_stack == NULL
-	    || ((!env->java_stack->interp
-	       && ((_jc_exec_stack *)env->java_stack)->pc != NULL)
-	      || (env->java_stack->interp
-	       && ((_jc_interp_stack *)env->java_stack)->clipped)));
+	_JC_ASSERT(env->java_stack == NULL || env->java_stack->clipped);
 
 	/* Change this thread's status, but first halt if requested */
 	if (!_jc_compare_and_swap(&env->status,

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/vm.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/vm.c?rev=355889&r1=355888&r2=355889&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/vm.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/vm.c Sat Dec 10 19:40:08 2005
@@ -15,14 +15,13 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *
- * $Id: vm.c,v 1.17 2005/05/15 02:05:07 archiecobbs Exp $
+ * $Id$
  */
 
 #include "libjc.h"
 #include "java_lang_Thread.h"
 
 /* Internal functions */
-static void	_jc_length_detect(_jc_env *env) _JC_JCNI_ATTR;
 static int	_jc_parse_vm_options(_jc_env *env, const JavaVMInitArgs *args);
 
 /*
@@ -37,9 +36,7 @@
 	_jc_env *env = &temp_env;
 	_jc_jvm temp_vm;
 	_jc_jvm *vm = &temp_vm;
-	_jc_method method;
 	jobject sref = NULL;
-	u_char rtype;
 	int i;
 
 	/* Static checks */
@@ -95,15 +92,6 @@
 		goto fail_info;
 	}
 
-	/* Map in thread check page */
-	if ((vm->check_address = mmap(NULL, _JC_PAGE_SIZE,
-	    PROT_READ, MAP_PRIVATE|MAP_ANON, -1, 0)) == MAP_FAILED) {
-		vm->check_address = NULL;
-		_JC_EX_STORE(env, InternalError, "%s: %s",
-		    "mmap", strerror(errno));
-		goto fail;
-	}
-
 	/* Allocate threads.by_id array */
 	if ((vm->threads.by_id = _jc_vm_alloc(env,
 	    _JC_MAX_THREADS * sizeof(*vm->threads.by_id))) == NULL)
@@ -129,14 +117,6 @@
 	}
 	_JC_MUTEX_UNLOCK(env, vm->mutex);
 
-	/* Initialize classfiles tree */
-	_jc_splay_init(&vm->classfiles, _jc_classfile_tree_compare,
-	    _JC_OFFSETOF(_jc_class_node, node));
-
-	/* Initialize PC -> method tree */
-	_jc_splay_init(&vm->method_tree, _jc_method_tree_compare,
-	    _JC_OFFSETOF(_jc_method, u.exec.node));
-
 	/* Initialize default system properties */
 	if (_jc_set_system_properties(env) != JNI_OK)
 		goto fail_info;
@@ -170,30 +150,6 @@
 	    vm->boot.loader, _JC_INTERNAL_NATIVE_LIBRARY) != JNI_OK)
 		goto fail_info;
 
-	/* Copy _jc_invoke_jcni_a() method descriptor */
-	vm->invoke_method = _jc_invoke_jcni_a$method_info;
-
-	/* Compute high/low PC limits of _jc_invoke_jcni_a() function */
-	memset(&method, 0, sizeof(method));
-	method.access_flags |= _JC_ACC_STATIC;
-	method.num_parameters = 0;
-	method.param_ptypes = &rtype;
-	for (rtype = _JC_TYPE_BOOLEAN; rtype < _JC_TYPE_MAX; rtype++)
-		_jc_invoke_jcni_a(env, &method, _jc_length_detect, NULL, NULL);
-
-	/* Sanity check _jc_invoke_jcni_a() length */
-	_JC_ASSERT((char *)vm->invoke_method.u.exec.function_end
-	    - (char *)vm->invoke_method.function < 8192);
-#if 0
-	printf("_jc_invoke_jcni_a(): %p - %p length=%d\n",
-	    vm->invoke_method.function, vm->invoke_method.u.exec.function_end,
-	    (char *)vm->invoke_method.u.exec.function_end
-	      - (char *)vm->invoke_method.function);
-#endif
-
-	/* Add _jc_invoke_jcni_a() to PC -> method tree */
-	_jc_splay_insert(&vm->method_tree, &vm->invoke_method);
-
 	/* Load bootstrap Java classes, methods, etc. */
 	if (_jc_bootstrap_classes(env) != JNI_OK)
 		goto fail;
@@ -302,29 +258,6 @@
 }
 
 /*
- * Part of the hack to compute the length of _jc_invoke_jcni_a().
- */
-static void _JC_JCNI_ATTR
-_jc_length_detect(_jc_env *env)
-{
-	_jc_jvm *const vm = env->vm;
-	_jc_stack_frame frame;
-	const void *pc;
-
-	/* Get PC return address */
-	_jc_stack_frame_current(&frame);
-	_jc_stack_frame_next(&frame, &pc);
-
-	/* Update high/low bound of _jc_invoke_jcni_a() */
-	if (vm->invoke_method.function == NULL
-	    || pc < vm->invoke_method.function)
-		vm->invoke_method.function = (const char *)pc - 1;
-	if (vm->invoke_method.u.exec.function_end == NULL
-	    || pc >= vm->invoke_method.u.exec.function_end)
-		vm->invoke_method.u.exec.function_end = (const char *)pc + 1;
-}
-
-/*
  * Free a Java VM structure.
  *
  * This assumes there are no threads remaining alive.
@@ -356,27 +289,6 @@
 		}
 		_jc_vm_free(&vm->boot.class_path);
 	}
-	if (vm->object_path != NULL) {
-		for (i = 0; i < vm->object_path_len; i++) {
-			_jc_objpath_entry *const ent = &vm->object_path[i];
-
-			_jc_vm_free(&ent->pathname);
-		}
-		_jc_vm_free(&vm->object_path);
-	}
-	if (vm->source_path != NULL) {
-		for (i = 0; vm->source_path[i] != NULL; i++)
-			_jc_vm_free(&vm->source_path[i]);
-		_jc_vm_free(&vm->source_path);
-	}
-	if (vm->object_path != NULL) {
-		for (i = 0; i < vm->object_path_len; i++) {
-			_jc_objpath_entry *const ent = &vm->object_path[i];
-
-			_jc_vm_free(&ent->pathname);
-		}
-		_jc_vm_free(&vm->object_path);
-	}
 
 	/* Free fat locks XXX need to recover fat locks alive in the heap */
 	while (!SLIST_EMPTY(&vm->fat_locks.free_list)) {
@@ -404,7 +316,6 @@
 
 		_jc_destroy_loader(vm, &loader);
 	}
-	_JC_ASSERT(vm->method_tree.size <= 1);	/* vm->invoke_method ok */
 	_JC_ASSERT(vm->avail_loader_pages == vm->max_loader_pages);
 
 	/* Free native globals */
@@ -415,10 +326,6 @@
 	_jc_cond_destroy(&vm->all_halted);
 	_jc_cond_destroy(&vm->world_restarted);
 
-	/* Free thread check page */
-	if (vm->check_address != NULL)
-		munmap(vm->check_address, _JC_PAGE_SIZE);
-
 	/* Free the heap */
 	_jc_heap_destroy(vm);
 
@@ -529,12 +436,6 @@
 				if (*s != '\0' && *s++ != ',')
 					goto option_fail;
 			}
-			continue;
-		}
-
-		/* FILE * for outputting list of loaded object files */
-		if (strcmp(opt->optionString, "-Xloadlist") == 0) {
-			vm->object_list = opt->extraInfo;
 			continue;
 		}