harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arc...@apache.org
Subject svn commit: r417540 - in /incubator/harmony/enhanced/jchevm/libjc: derive.c derive2.c libjc.h
Date Tue, 27 Jun 2006 17:58:19 GMT
Author: archie
Date: Tue Jun 27 10:58:19 2006
New Revision: 417540

URL: http://svn.apache.org/viewvc?rev=417540&view=rev
Log:
Avoid parsing each loaded class' constant pool twice.

Modified:
    incubator/harmony/enhanced/jchevm/libjc/derive.c
    incubator/harmony/enhanced/jchevm/libjc/derive2.c
    incubator/harmony/enhanced/jchevm/libjc/libjc.h

Modified: incubator/harmony/enhanced/jchevm/libjc/derive.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/jchevm/libjc/derive.c?rev=417540&r1=417539&r2=417540&view=diff
==============================================================================
--- incubator/harmony/enhanced/jchevm/libjc/derive.c (original)
+++ incubator/harmony/enhanced/jchevm/libjc/derive.c Tue Jun 27 10:58:19 2006
@@ -58,7 +58,7 @@
 	int i;
 
 	/* Parse class file */
-	if ((cfile = _jc_parse_classfile(env, cbytes, 1)) == NULL) {
+	if ((cfile = _jc_parse_classfile(env, cbytes, 2)) == NULL) {
 		_jc_post_exception_info(env);
 		goto fail;
 	}
@@ -163,10 +163,11 @@
 	}
 
 	/* Derive type */
-	if ((type = _jc_derive_type_interp(env, loader, cbytes)) == NULL) {
+	if ((type = _jc_derive_type_interp(env, loader, cfile)) == NULL) {
 		_jc_post_exception_info(env);
 		goto fail;
 	}
+	cfile = NULL;
 	goto done;
 
 fail:

Modified: incubator/harmony/enhanced/jchevm/libjc/derive2.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/jchevm/libjc/derive2.c?rev=417540&r1=417539&r2=417540&view=diff
==============================================================================
--- incubator/harmony/enhanced/jchevm/libjc/derive2.c (original)
+++ incubator/harmony/enhanced/jchevm/libjc/derive2.c Tue Jun 27 10:58:19 2006
@@ -35,11 +35,13 @@
  * available, so we have to create the type structure at runtime and
  * interpret the class' bytecode for method execution.
  *
+ * If successful, we take responsibility for freeing "cfile".
+ *
  * If unsuccessful, an exception is stored.
  */
 _jc_type *
 _jc_derive_type_interp(_jc_env *env,
-	_jc_class_loader *loader, _jc_classbytes *cbytes)
+	_jc_class_loader *loader, _jc_classfile *cfile)
 {
 	_jc_jvm *const vm = env->vm;
 	int num_class_vmethods;
@@ -48,7 +50,6 @@
 	_jc_nonarray_type *ntype;
 	_jc_type **interfaces;
 	_jc_type *superclass;
-	_jc_classfile *cfile;
 	_jc_type_node node_key;
 	_jc_type_node *node;
 	size_t virtual_offset;
@@ -59,10 +60,6 @@
 	void *mark;
 	int i;
 
-	/* Parse class file */
-	if ((cfile = _jc_parse_classfile(env, cbytes, 2)) == NULL)
-		return NULL;
-
 	/* Lock loader */
 	_JC_MUTEX_LOCK(env, loader->mutex);
 
@@ -288,9 +285,6 @@
 fail:
 	/* Give back class loader memory */
 	_jc_uni_reset(&loader->uni, mark);
-
-	/* Free parsed class file */
-	_jc_destroy_classfile(&cfile);
 
 	/* Unlock loader */
 	_JC_MUTEX_UNLOCK(env, loader->mutex);

Modified: incubator/harmony/enhanced/jchevm/libjc/libjc.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/jchevm/libjc/libjc.h?rev=417540&r1=417539&r2=417540&view=diff
==============================================================================
--- incubator/harmony/enhanced/jchevm/libjc/libjc.h (original)
+++ incubator/harmony/enhanced/jchevm/libjc/libjc.h Tue Jun 27 10:58:19 2006
@@ -132,8 +132,7 @@
 
 /* derive2.c */
 extern _jc_type		*_jc_derive_type_interp(_jc_env *env,
-				_jc_class_loader *loader,
-				_jc_classbytes *cbytes);
+				_jc_class_loader *loader, _jc_classfile *cfile);
 
 /* exception.c */
 extern void		_jc_post_exception_object(_jc_env *env,



Mime
View raw message