You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by mc...@apache.org on 2008/05/04 08:40:04 UTC
svn commit: r653183 - in /harmony/enhanced/drlvm/trunk/vm/vmcore: include/
src/class_support/ src/verifier-3363/base/ src/verifier-3363/x_verifier/
Author: mcfirst
Date: Sat May 3 23:40:04 2008
New Revision: 653183
URL: http://svn.apache.org/viewvc?rev=653183&view=rev
Log:
Applying the patch for HARMONY-5381 [buildtest][vts] arbitrary tests intermittently exit with code 0 instead of 104 (SUCCESS). Fixed static error message buffer to be dynamically allocated and freed.
Modified:
harmony/enhanced/drlvm/trunk/vm/vmcore/include/verifier.h
harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h
harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/ver.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/ver_utils.h
harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/recompute.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/write_attr.cpp
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/verifier.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/verifier.h?rev=653183&r1=653182&r2=653183&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/verifier.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/verifier.h Sat May 3 23:40:04 2008
@@ -75,7 +75,7 @@
char** error);
/**
- * Function provides final constraint checks for a given class.
+ * Function releases error message previously allocated to report an error.
* @param error - error message of verifier
* @note Assertion is raised if error_message is equal to null.
*/
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp?rev=653183&r1=653182&r2=653183&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Verifier_stub.cpp Sat May 3 23:40:04 2008
@@ -66,6 +66,7 @@
aulock.ForceUnlock();
REPORT_FAILED_CLASS_CLASS(m_class_loader, this,
"java/lang/VerifyError", error);
+ vf_release_error_message(error);
return false;
}
}
@@ -136,6 +137,7 @@
} else {
REPORT_FAILED_CLASS_CLASS(m_class_loader, this,
"java/lang/VerifyError", error);
+ vf_release_error_message(error);
}
return false;
}
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h?rev=653183&r1=653182&r2=653183&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h Sat May 3 23:40:04 2008
@@ -281,8 +281,7 @@
};
-
-//check conatraints stored in the classloader data. force loading if necessary
+//check constraints stored in the classloader data. force loading if necessary
vf_Result vf_force_check_constraint(Class_Handle klass,
vf_TypeConstraint *constraint);
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/ver.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/ver.cpp?rev=653183&r1=653182&r2=653183&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/ver.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/ver.cpp Sat May 3 23:40:04 2008
@@ -16,6 +16,7 @@
*/
#include <stdio.h>
#include "verifier.h"
+#include "ver_utils.h"
#include "../java5/context_5.h"
#include "../java6/context_6.h"
#include "time.h"
@@ -24,9 +25,6 @@
#include "open/vm_method_access.h"
#include "open/vm_class_loading.h"
-static char err_message[5000];
-
-
/**
* Provides initial java-5 verification of class.
*
@@ -49,10 +47,7 @@
result = context.verify_method(class_get_method( klass, index ));
if (result != VF_OK) {
- *error = &(err_message[0]);
- Method_Handle method = class_get_method(klass, index);
- sprintf(*error, "%s/%s%s, pass: %d, instr: %d, reason: %s", class_get_name(klass), method_get_name(method),
- method_get_descriptor(method), context.pass, context.processed_instruction, context.error_message);
+ vf_create_error_message(class_get_method(klass, index), context, error);
break;
}
}
@@ -99,9 +94,7 @@
skip_java6_verification_attempt = true;
if (result == VF_ErrorStackmap) {
//corrupted StackMapTable ==> throw an Error?
- *error = &(err_message[0]);
- sprintf(*error, "%s/%s%s, reason: %s", class_get_name( klass ), method_get_name( method ),
- method_get_descriptor( method ), context6.error_message );
+ vf_create_error_message(method, context6, error);
return result;
}
}
@@ -111,10 +104,7 @@
//try Java5 verifying
result = context5.verify_method(method);
if (result != VF_OK) {
- //can't verify
- *error = &(err_message[0]);
- sprintf(*error, "%s/%s%s, pass: %d, instr: %d, reason: %s", class_get_name( klass ), method_get_name( method ),
- method_get_descriptor( method ), context5.pass, context5.processed_instruction, context5.error_message );
+ vf_create_error_message(method, context5, error);
return result;
}
}
@@ -179,8 +169,7 @@
{
vf_Result result = vf_force_check_constraint( klass, constraint );
if( result != VF_OK ) {
- *error = &(err_message[0]);
- sprintf(*error, "constraint check failed, class: %s, source: %s, target: %s", class_get_name( klass ), constraint->source, constraint->target);
+ vf_create_error_message(klass, constraint, error);
return result;
}
}
@@ -189,6 +178,11 @@
} // vf_verify_method_constraints
+void vf_release_error_message(void* error)
+{
+ tc_free(error);
+}
+
/**
* Function releases verify data in class loader (used to store constraints)
*/
@@ -201,3 +195,34 @@
delete cl_data->hash;
delete cl_data->pool;
} // vf_release_verify_data
+
+/**
+ * Creates error message to be reported with verify error
+ */
+void vf_create_error_message(Method_Handle method, vf_Context_Base context, char** error_msg)
+{
+ char pass[12], instr[12];
+ sprintf(pass, "%d", context.pass);
+ sprintf(instr, "%d", context.processed_instruction);
+ const char* cname = class_get_name(method_get_class(method));
+ const char* mname = method_get_name(method);
+ const char* mdesc = method_get_descriptor(method);
+ unsigned msg_len = strlen(cname) + strlen(mname) + strlen(mdesc)
+ + strlen(pass) + strlen(instr) + strlen(context.error_message) + 1;
+ *error_msg = (char*)tc_malloc(msg_len);
+ if(*error_msg != NULL) {
+ sprintf(*error_msg, "%s.%s%s, pass: %s, instr: %s, reason: %s",
+ cname, mname, mdesc, pass, instr, context.error_message);
+ }
+}
+
+void vf_create_error_message(Class_Handle klass, vf_TypeConstraint* constraint, char** error_msg)
+{
+ const char* cname = class_get_name(klass);
+ unsigned msg_len = strlen(cname) +
+ + strlen(constraint->source)
+ + strlen(constraint->target) + 1;
+ *error_msg = (char*)tc_malloc(msg_len);
+ sprintf(*error_msg, "constraint check failed, class: %s, source: %s, target: %s",
+ cname, constraint->source, constraint->target);
+}
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/ver_utils.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/ver_utils.h?rev=653183&r1=653182&r2=653183&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/ver_utils.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/ver_utils.h Sat May 3 23:40:04 2008
@@ -18,6 +18,8 @@
#define __VER_UTILS_H_
#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
#include "open/types.h"
// convenience types
@@ -435,4 +437,11 @@
}; // struct vf_Hash
+// external declarations for error reporting functions
+class vf_Context_Base;
+struct vf_TypeConstraint;
+
+void vf_create_error_message(Method_Handle method, vf_Context_Base context, char** msg);
+void vf_create_error_message(Class_Handle klass, vf_TypeConstraint* constraint, char** msg);
+
#endif
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/recompute.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/recompute.cpp?rev=653183&r1=653182&r2=653183&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/recompute.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/recompute.cpp Sat May 3 23:40:04 2008
@@ -19,8 +19,6 @@
#include "../java5/stackmap_5.h"
#include "time.h"
-static char err_message[5000];
-
/**
* Recomputes StackMapTable attribute.
*/
@@ -39,9 +37,7 @@
result = context.recompute_stackmaptable(method);
if (result != VF_OK) {
- *error = &(err_message[0]);
- sprintf(*error, "%s/%s%s, pass: %d, instr: %d, reason: %s", class_get_name( klass ), method_get_name( method ),
- method_get_descriptor( method ), context.pass, context.processed_instruction, context.error_message );
+ vf_create_error_message(method, context, error);
}
*attrBytes = context.written_stackmap;
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/write_attr.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/write_attr.cpp?rev=653183&r1=653182&r2=653183&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/write_attr.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/write_attr.cpp Sat May 3 23:40:04 2008
@@ -18,9 +18,6 @@
#include "../java6/stackmap_6.h"
#include "time.h"
-static char err_message[5000];
-
-
void vf_Context_5e::writeStackMapFrame( Address instr )
{
assert(instr < m_code_length || 1 + lastInstr < instr );