bug-kawa
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-kawa] [bug #39150] AppendValue procedure compiler InternalError


From: Matthieu Vachon
Subject: [Bug-kawa] [bug #39150] AppendValue procedure compiler InternalError
Date: Mon, 03 Jun 2013 13:55:31 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?39150>

                 Summary: AppendValue procedure compiler InternalError
                 Project: Kawa
            Submitted by: maoueh
            Submitted on: Mon 03 Jun 2013 01:55:30 PM GMT
                Category: Code generation
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Assume the following test case:


(define-simple-class <Simple> (<Object>)
  (input type: <String> init-value: ""))

(define (main)
  (define (process)
    (make <Simple> input: "value")
    #t)

  (let loop ()
    (process)
    (loop)))


This does not compile, compiler shows  an `InternalError` where it was
compiling fine in version r6989. The bug was introduced in revision r6990.

The thing that happens in new version is that a tail call is process for the
`ApplyExp(loop)`, at which point an `emitGoto(label)` is made where the label
is the start of the scope of `LambdaExp(loop)`. In the `emitGoto(label)`, we
ensure that `code.SP` has same length of `stackTypes` when its not null. But
`code.SP` is 1 at point of crash but should be zero.

Removing the `input` field initializer for class <Simple> make compilation
works. I dig up further this bug by stepping through the execution path what I
found is that a type is pushed on the stack but not pop as it should. When
there is not field initializer, the target is `IgnoreTarget` which pop the
type if non-void. However, when `input` field initializer is present, the
target is a `CheckedTarget` and the type on the stack is not pop and `code.SP`
is left at 1. Since it is not 0 as expected, the compiler crash.

I attach the test case I used and also a subset of patch r6990 that can
reproduce the error. So the whole patch is not a problem, only a part of it.

Regards,
Matt

P.S Here the start of stack trace for the record:


   caught exception in inline-compiler for #<procedure
gnu.kawa.functions.AppendValues> - java.lang.InternalError
    gnu.bytecode.Label.setTypes(Label.java:103)
    gnu.bytecode.CodeAttr.emitGoto(CodeAttr.java:1585)
    gnu.bytecode.CodeAttr.emitTailCall(CodeAttr.java:2482)
    gnu.expr.ApplyExp.compile(ApplyExp.java:422)
    gnu.expr.ApplyExp.compile(ApplyExp.java:132)
    gnu.expr.Expression.compileNotePosition(Expression.java:156)
    gnu.expr.Expression.compileWithPosition(Expression.java:127)
    gnu.expr.BeginExp.compile(BeginExp.java:153)
    gnu.expr.Expression.compileNotePosition(Expression.java:156)
    gnu.expr.Expression.compileWithPosition(Expression.java:127)
    gnu.expr.ApplyExp.compile(ApplyExp.java:333)
    gnu.expr.ApplyExp.compile(ApplyExp.java:132)





    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 03 Jun 2013 01:55:30 PM GMT  Name: appendvalueserror.scm  Size: 2kB 
 By: maoueh
test case to reproduce problem &amp; offending changeset (git patch)
<http://savannah.gnu.org/bugs/download.php?file_id=28234>
-------------------------------------------------------
Date: Mon 03 Jun 2013 01:55:30 PM GMT  Name:
AppendValuesErrorsOffendingDiff.patch  Size: 4kB   By: maoueh
test case to reproduce problem &amp; offending changeset (git patch)
<http://savannah.gnu.org/bugs/download.php?file_id=28235>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?39150>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]