Re: [PATCH 4/4] vm: use Throwable.stackTraceString() for exception printing.

2009-07-26 Thread Pekka Enberg
On Sun, 2009-07-26 at 13:22 +0200, Tomek Grabiec wrote:
> Please hold on with merging this one because I noticed that for some
> reason "Caused by:" parts are not printed after this patch, which
> seems to be a bug in JIT.

OK, I reverted the commit from master now.


--
___
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel


Re: [PATCH 4/4] vm: use Throwable.stackTraceString() for exception printing.

2009-07-26 Thread Tomek Grabiec
2009/7/26 Tomek Grabiec :
> As java/lang/String.substring() is now working so is
> java/lang/Throwable.stackTraceString(). It allows us to get the full
> exception descripton with just one method call.
>
> Signed-off-by: Tomek Grabiec 
> ---
>  include/vm/preload.h   |    8 +--
>  test/vm/preload-stub.c |    8 +--
>  vm/preload.c           |   48 +--
>  vm/stack-trace.c       |  156 
> +++-
>  4 files changed, 13 insertions(+), 207 deletions(-)
>
> diff --git a/include/vm/preload.h b/include/vm/preload.h
> index 233c0e6..867f9fc 100644
> --- a/include/vm/preload.h
> +++ b/include/vm/preload.h
> @@ -43,16 +43,10 @@ extern struct vm_field *vm_java_lang_VMThrowable_vmdata;
>  extern struct vm_method *vm_java_util_Properties_setProperty;
>  extern struct vm_method *vm_java_lang_Throwable_initCause;
>  extern struct vm_method *vm_java_lang_Throwable_getCause;
> -extern struct vm_method *vm_java_lang_Throwable_toString;
> +extern struct vm_method *vm_java_lang_Throwable_stackTraceString;
>  extern struct vm_method *vm_java_lang_Throwable_getStackTrace;
>  extern struct vm_method *vm_java_lang_Throwable_setStackTrace;
>  extern struct vm_method *vm_java_lang_StackTraceElement_init;
> -extern struct vm_method *vm_java_lang_StackTraceElement_getFileName;
> -extern struct vm_method *vm_java_lang_StackTraceElement_getClassName;
> -extern struct vm_method *vm_java_lang_StackTraceElement_getMethodName;
> -extern struct vm_method *vm_java_lang_StackTraceElement_getLineNumber;
> -extern struct vm_method *vm_java_lang_StackTraceElement_isNativeMethod;
> -extern struct vm_method *vm_java_lang_StackTraceElement_equals;
>
>  int preload_vm_classes(void);
>
> diff --git a/test/vm/preload-stub.c b/test/vm/preload-stub.c
> index 25c5b2b..7d871c1 100644
> --- a/test/vm/preload-stub.c
> +++ b/test/vm/preload-stub.c
> @@ -34,13 +34,7 @@ struct vm_class *vm_java_lang_StackOverflowError;
>
>  struct vm_method *vm_java_lang_Throwable_initCause;
>  struct vm_method *vm_java_lang_Throwable_getCause;
> -struct vm_method *vm_java_lang_Throwable_toString;
> +struct vm_method *vm_java_lang_Throwable_stackTraceString;
>  struct vm_method *vm_java_lang_Throwable_getStackTrace;
>  struct vm_method *vm_java_lang_Throwable_setStackTrace;
>  struct vm_method *vm_java_lang_StackTraceElement_init;
> -struct vm_method *vm_java_lang_StackTraceElement_getFileName;
> -struct vm_method *vm_java_lang_StackTraceElement_getClassName;
> -struct vm_method *vm_java_lang_StackTraceElement_getMethodName;
> -struct vm_method *vm_java_lang_StackTraceElement_getLineNumber;
> -struct vm_method *vm_java_lang_StackTraceElement_isNativeMethod;
> -struct vm_method *vm_java_lang_StackTraceElement_equals;
> diff --git a/vm/preload.c b/vm/preload.c
> index 4bfb9df..54e749c 100644
> --- a/vm/preload.c
> +++ b/vm/preload.c
> @@ -139,16 +139,10 @@ struct method_preload_entry {
>  struct vm_method *vm_java_util_Properties_setProperty;
>  struct vm_method *vm_java_lang_Throwable_initCause;
>  struct vm_method *vm_java_lang_Throwable_getCause;
> -struct vm_method *vm_java_lang_Throwable_toString;
> +struct vm_method *vm_java_lang_Throwable_stackTraceString;
>  struct vm_method *vm_java_lang_Throwable_getStackTrace;
>  struct vm_method *vm_java_lang_Throwable_setStackTrace;
>  struct vm_method *vm_java_lang_StackTraceElement_init;
> -struct vm_method *vm_java_lang_StackTraceElement_getFileName;
> -struct vm_method *vm_java_lang_StackTraceElement_getClassName;
> -struct vm_method *vm_java_lang_StackTraceElement_getMethodName;
> -struct vm_method *vm_java_lang_StackTraceElement_getLineNumber;
> -struct vm_method *vm_java_lang_StackTraceElement_isNativeMethod;
> -struct vm_method *vm_java_lang_StackTraceElement_equals;
>
>  static const struct method_preload_entry method_preload_entries[] = {
>        {
> @@ -183,45 +177,9 @@ static const struct method_preload_entry 
> method_preload_entries[] = {
>        },
>        {
>                &vm_java_lang_Throwable,
> -               "toString",
> +               "stackTraceString",
>                "()Ljava/lang/String;",
> -               &vm_java_lang_Throwable_toString,
> -       },
> -       {
> -               &vm_java_lang_StackTraceElement,
> -               "getFileName",
> -               "()Ljava/lang/String;",
> -               &vm_java_lang_StackTraceElement_getFileName,
> -       },
> -       {
> -               &vm_java_lang_StackTraceElement,
> -               "getClassName",
> -               "()Ljava/lang/String;",
> -               &vm_java_lang_StackTraceElement_getClassName,
> -       },
> -       {
> -               &vm_java_lang_StackTraceElement,
> -               "getMethodName",
> -               "()Ljava/lang/String;",
> -               &vm_java_lang_StackTraceElement_getMethodName,
> -       },
> -       {
> -               &vm_java_lang_StackTraceElement,
> -               "getLineNumber",
> -               "()I",
> -               &vm_java_lang_StackT

[PATCH 4/4] vm: use Throwable.stackTraceString() for exception printing.

2009-07-26 Thread Tomek Grabiec
As java/lang/String.substring() is now working so is
java/lang/Throwable.stackTraceString(). It allows us to get the full
exception descripton with just one method call.

Signed-off-by: Tomek Grabiec 
---
 include/vm/preload.h   |8 +--
 test/vm/preload-stub.c |8 +--
 vm/preload.c   |   48 +--
 vm/stack-trace.c   |  156 +++-
 4 files changed, 13 insertions(+), 207 deletions(-)

diff --git a/include/vm/preload.h b/include/vm/preload.h
index 233c0e6..867f9fc 100644
--- a/include/vm/preload.h
+++ b/include/vm/preload.h
@@ -43,16 +43,10 @@ extern struct vm_field *vm_java_lang_VMThrowable_vmdata;
 extern struct vm_method *vm_java_util_Properties_setProperty;
 extern struct vm_method *vm_java_lang_Throwable_initCause;
 extern struct vm_method *vm_java_lang_Throwable_getCause;
-extern struct vm_method *vm_java_lang_Throwable_toString;
+extern struct vm_method *vm_java_lang_Throwable_stackTraceString;
 extern struct vm_method *vm_java_lang_Throwable_getStackTrace;
 extern struct vm_method *vm_java_lang_Throwable_setStackTrace;
 extern struct vm_method *vm_java_lang_StackTraceElement_init;
-extern struct vm_method *vm_java_lang_StackTraceElement_getFileName;
-extern struct vm_method *vm_java_lang_StackTraceElement_getClassName;
-extern struct vm_method *vm_java_lang_StackTraceElement_getMethodName;
-extern struct vm_method *vm_java_lang_StackTraceElement_getLineNumber;
-extern struct vm_method *vm_java_lang_StackTraceElement_isNativeMethod;
-extern struct vm_method *vm_java_lang_StackTraceElement_equals;
 
 int preload_vm_classes(void);
 
diff --git a/test/vm/preload-stub.c b/test/vm/preload-stub.c
index 25c5b2b..7d871c1 100644
--- a/test/vm/preload-stub.c
+++ b/test/vm/preload-stub.c
@@ -34,13 +34,7 @@ struct vm_class *vm_java_lang_StackOverflowError;
 
 struct vm_method *vm_java_lang_Throwable_initCause;
 struct vm_method *vm_java_lang_Throwable_getCause;
-struct vm_method *vm_java_lang_Throwable_toString;
+struct vm_method *vm_java_lang_Throwable_stackTraceString;
 struct vm_method *vm_java_lang_Throwable_getStackTrace;
 struct vm_method *vm_java_lang_Throwable_setStackTrace;
 struct vm_method *vm_java_lang_StackTraceElement_init;
-struct vm_method *vm_java_lang_StackTraceElement_getFileName;
-struct vm_method *vm_java_lang_StackTraceElement_getClassName;
-struct vm_method *vm_java_lang_StackTraceElement_getMethodName;
-struct vm_method *vm_java_lang_StackTraceElement_getLineNumber;
-struct vm_method *vm_java_lang_StackTraceElement_isNativeMethod;
-struct vm_method *vm_java_lang_StackTraceElement_equals;
diff --git a/vm/preload.c b/vm/preload.c
index 4bfb9df..54e749c 100644
--- a/vm/preload.c
+++ b/vm/preload.c
@@ -139,16 +139,10 @@ struct method_preload_entry {
 struct vm_method *vm_java_util_Properties_setProperty;
 struct vm_method *vm_java_lang_Throwable_initCause;
 struct vm_method *vm_java_lang_Throwable_getCause;
-struct vm_method *vm_java_lang_Throwable_toString;
+struct vm_method *vm_java_lang_Throwable_stackTraceString;
 struct vm_method *vm_java_lang_Throwable_getStackTrace;
 struct vm_method *vm_java_lang_Throwable_setStackTrace;
 struct vm_method *vm_java_lang_StackTraceElement_init;
-struct vm_method *vm_java_lang_StackTraceElement_getFileName;
-struct vm_method *vm_java_lang_StackTraceElement_getClassName;
-struct vm_method *vm_java_lang_StackTraceElement_getMethodName;
-struct vm_method *vm_java_lang_StackTraceElement_getLineNumber;
-struct vm_method *vm_java_lang_StackTraceElement_isNativeMethod;
-struct vm_method *vm_java_lang_StackTraceElement_equals;
 
 static const struct method_preload_entry method_preload_entries[] = {
{
@@ -183,45 +177,9 @@ static const struct method_preload_entry 
method_preload_entries[] = {
},
{
&vm_java_lang_Throwable,
-   "toString",
+   "stackTraceString",
"()Ljava/lang/String;",
-   &vm_java_lang_Throwable_toString,
-   },
-   {
-   &vm_java_lang_StackTraceElement,
-   "getFileName",
-   "()Ljava/lang/String;",
-   &vm_java_lang_StackTraceElement_getFileName,
-   },
-   {
-   &vm_java_lang_StackTraceElement,
-   "getClassName",
-   "()Ljava/lang/String;",
-   &vm_java_lang_StackTraceElement_getClassName,
-   },
-   {
-   &vm_java_lang_StackTraceElement,
-   "getMethodName",
-   "()Ljava/lang/String;",
-   &vm_java_lang_StackTraceElement_getMethodName,
-   },
-   {
-   &vm_java_lang_StackTraceElement,
-   "getLineNumber",
-   "()I",
-   &vm_java_lang_StackTraceElement_getLineNumber,
-   },
-   {
-   &vm_java_lang_StackTraceElement,
-   "isNativeMethod",
-   "()Z",
-   &vm_java_lang_StackTraceElement_isNativeMethod,
-   },
-