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 2006/06/01 06:07:11 UTC

svn commit: r410737 - /incubator/harmony/enhanced/jchevm/libjc/native/java_lang_VMThrowable.c

Author: archie
Date: Wed May 31 21:07:10 2006
New Revision: 410737

URL: http://svn.apache.org/viewvc?rev=410737&view=rev
Log:
Elide the bottom portions of the stack trace in VMThrowable.getStackTrace()
to eliminate [VM]Throwable.fillInStackTrace() and (super)class constructor
frames. This is consistent with the JDK and it makes Eclipse happy.

Modified:
    incubator/harmony/enhanced/jchevm/libjc/native/java_lang_VMThrowable.c

Modified: incubator/harmony/enhanced/jchevm/libjc/native/java_lang_VMThrowable.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/jchevm/libjc/native/java_lang_VMThrowable.c?rev=410737&r1=410736&r2=410737&view=diff
==============================================================================
--- incubator/harmony/enhanced/jchevm/libjc/native/java_lang_VMThrowable.c (original)
+++ incubator/harmony/enhanced/jchevm/libjc/native/java_lang_VMThrowable.c Wed May 31 21:07:10 2006
@@ -92,6 +92,34 @@
 		    (_jc_word)bytes->elems, _JC_FULL_ALIGNMENT);
 	}
 
+	/* Skip [VM]Throwable.fillInStackTrace(), initial constructor frames */
+	_JC_ASSERT(num_frames > 0);
+	for (i = 0; i < num_frames; i++) {
+		_jc_saved_frame *frame = &frames[i];
+		_jc_method *method;
+
+		/* Get method */
+		method = frame->method;
+		_JC_ASSERT(method != NULL && method->class != NULL);
+
+		/* Is it [VM]Throwable.fillInStackTrace()? */
+		if (strcmp(method->name, "fillInStackTrace") == 0
+		    && (method->class == vm->boot.types.Throwable
+		      || method->class == vm->boot.types.VMThrowable))
+		      	continue;
+
+		/* Is it a (super)class constructor? */
+		if (!_JC_ACC_TEST(method, STATIC)
+		    && *method->name == '<'
+		    && _jc_subclass_of(throwable->type, method->class))
+		    	continue;
+
+		/* No more skipping */
+		break;
+	}
+	frames += i;
+	num_frames -= i;
+
 	/* Create array */
 	if ((array_ref = _jc_new_local_native_ref(env,
 	    (_jc_object *)_jc_new_array(env,