[vmkit-commits] [vmkit] r199547 - Only print the relevant stack trace (aka, ignore the constructor of the exception

Gael Thomas gael.thomas at lip6.fr
Sat Jan 18 05:24:24 PST 2014


Author: gthomas
Date: Sat Jan 18 07:24:24 2014
New Revision: 199547

URL: http://llvm.org/viewvc/llvm-project?rev=199547&view=rev
Log:
Only print the relevant stack trace (aka, ignore the constructor of the exception

Modified:
    vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc

Modified: vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc?rev=199547&r1=199546&r2=199547&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc (original)
+++ vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc Sat Jan 18 07:24:24 2014
@@ -382,16 +382,28 @@ jint JNICALL JVM_GetStackTraceDepth(JNIE
 	J3ObjectHandle* backtrace = throwable->getObject(vm->throwableClassBacktrace);
 
 	bool simplify = 1;
+	bool ignore = 1;
 
 	if(simplify) {
 		uint32_t max = backtrace->arrayLength();
 		int64_t buf[max];
 
-		for(uint32_t i=0; i<max; i++) {
-			uint64_t cur = backtrace->getLongAt(i);
+		while(!res) {
+			for(uint32_t i=0; i<max; i++) {
+				uint64_t cur = backtrace->getLongAt(i);
+				vmkit::Safepoint* sf = vm->getSafepoint((void*)cur);
 
-			if(vm->getSafepoint((void*)cur))
-				buf[res++] = cur;
+				if(sf) {
+					J3Method* m = ((J3MethodCode*)sf->unit()->getSymbol(sf->functionName()))->self;
+					if(ignore) {
+						if(m->name() == vm->initName && m->cl() == throwable->vt()->type()) {
+							ignore = 0;
+						}
+					} else
+						buf[res++] = cur;
+				}
+			}
+			ignore = 0;
 		}
 
 		jobject newBt = J3ObjectHandle::doNewArray(backtrace->vt()->type()->asArrayClass(), res);





More information about the vmkit-commits mailing list