[m-rev.] for review: Commit java as Error should not fill in stack trace

Zoltan Somogyi zoltan.somogyi at runbox.com
Mon Nov 6 12:35:44 AEDT 2017



On Fri, 3 Nov 2017 14:49:15 +0000, Maxime Van Assche <mvanassche at odaseontologies.com> wrote:

> As far as I can tell, using Throwable for Commit does not require the stack trace.
> However, the default constructor of Error constructs the stack trace, which is costly.

I agree that we should not fill in the stack trace in exceptions used to implement commits.

> java/runtime/Commit.java :
> 	Override fillInStackTrace to do nothing
> 
> diff --git a/java/runtime/Commit.java b/java/runtime/Commit.java
> index a5f875ba..8cd0b68 100644
> --- a/java/runtime/Commit.java
> +++ b/java/runtime/Commit.java
> @@ -9,6 +9,10 @@
>  package jmercury.runtime;
> 
>  public class Commit extends java.lang.Error {
> +    public Throwable fillInStackTrace() {
> +        // do nothing, for performance reasons.
> +        return this;
> +    }
> 
>  }

I don't know our Java binding well enough to check this diff. Someone who
uses the Java backend should try to bootcheck it, and commit the diff
if that succeeds.

Zoltan.




More information about the reviews mailing list