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

Julien Fischer jfischer at opturion.com
Wed Nov 8 21:29:15 AEDT 2017


Hi,

On Mon, 6 Nov 2017, Zoltan Somogyi wrote:

> 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.

Tested and committed.

Julien.


More information about the reviews mailing list