bugKawa - Bugs: bug #39150, AppendValue procedure compiler...

 
 

bug #39150: AppendValue procedure compiler InternalError

Submitted by:  Matthieu Vachon <maoueh>
Submitted on:  Mon 03 Jun 2013 01:55:30 PM UTC  
 
Category: Code generationSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Closed

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 18 Jul 2013 09:13:52 PM UTC, comment #3:

Checked in fix and test-case. Thanks.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Thu 18 Jul 2013 07:20:30 AM UTC, comment #2:

I've verified this with a slightly simpler test-case:

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

(define (main)

(let loop ()
(make <Simple> input: "value")
(loop)))

The problem appears to be related to the ALLOCATE_ON_STACK optimization. It's time for bed - I'll try to look at it tomorrow.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Thu 18 Jul 2013 01:39:39 AM UTC, comment #1:

I saw that you made some inline optimization changes recently. I thought that those changes could have fixed this issue at the same time.

So, I fetched latest version (r7526) and tried it with the snippet below. An improvement has been made since I no longer see the exception when compiling the snippet.

However, the problem now arise when the class is loaded. It's a VerifyError saying the stack trace is inconsistent.

Matthieu Vachon <maoueh>
Mon 03 Jun 2013 01:55:30 PM UTC, original submission:

Assume the following test case:

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:

Matthieu Vachon <maoueh>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #28234:  appendvalueserror.scm added by maoueh (2kB - application/octet-stream - test case to reproduce problem & offending changeset (git patch))
file #28235:  AppendValuesErrorsOffendingDiff.patch added by maoueh (4kB - application/octet-stream - test case to reproduce problem & offending changeset (git patch))

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bothner (Posted a comment)
  • -unavailable- added by maoueh (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 18 Jul 2013 09:13:52 PM UTCbothnerStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Thu 18 Jul 2013 07:20:30 AM UTCbothnerStatusNone=>Confirmed
      Assigned toNone=>bothner
    Mon 03 Jun 2013 01:55:30 PM UTCmaouehAttached File-=>Added appendvalueserror.scm, #28234
      Attached File-=>Added AppendValuesErrorsOffendingDiff.patch, #28235

    Back to the top


    Powered by Savane 3.1-cleanup