bugKawa - Bugs: bug #40494, internal error on kawa -C bug.scm,...

 
 

bug #40494: internal error on kawa -C bug.scm, 1.14 and head

Submitted by:  None
Submitted on:  Wed 06 Nov 2013 04:46:17 PM UTC  
 
Category: Code generationSeverity: 3 - Normal
Item Group: Compile-time exceptionStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Tue 12 Nov 2013 01:24:22 AM UTC, comment #4:

Confirmed, thanks!
-John -unavailable-

Anonymous
Mon 11 Nov 2013 07:18:57 AM UTC, comment #3:

I checked in the fix (and testcase) as discussed in previous comment.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Sun 10 Nov 2013 08:00:40 PM UTC, comment #2:

This one was tricky, and I've spent a fair amount of time on it.

The immediate problem is inlining function parameters that are lambda expressions. Specifically inlining of (lambda () (proc)) in bottom. This doesn't work because it needs the parameter to top - which is not inlined.

There is a hook to avoid inlining in this case - the call to Compilation.avoidInline in InlineCalls.visitLambdaExp. The problem is that avoidInline checks proc.outer and for complicated reasons the begin causes proc.outer to be a 'let'. (This is wrong, but it ia fixed in a later pass.)

So I finally found a simple and clean fix in the macro-expansion for 'begin'. Unfortunately, it loses some line-number information, which caused a regression in an error message in one of the tests.

So I ended up doing a major-rewrite of the data structure used for the preliminary 'scan' phase. The idea was good, but tracking down the various bug in the change took a while.

I'm almost ready to check in the fix - I just need to create a test based on your report. If nothing goes wrong, sometime this afternoon.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Sun 10 Nov 2013 07:33:31 PM UTC, comment #1:

Running with --no-inline works around this issue, as does replacing (proc) with (apply proc '()) in the definition of bottom. (Kawa 1.14)

-John

p.s., for convenience, here is the text of the attachment:

(module-export)

(begin
(define (bottom proc) (proc))
)

(define (top proc)
(bottom (lambda () (proc))))

(define-simple-class <top-class> ()
((frob)
(top (lambda () #f))))

Anonymous
Wed 06 Nov 2013 04:46:17 PM UTC, original submission:

Running "kawa -C bug.scm" on the attached program gives me:

(compiling bug.scm to bug)
internal error while compiling bug.scm
java.lang.Error: attempting to push dead variable
at gnu.bytecode.CodeAttr.emitLoad(CodeAttr.java:1364)
at gnu.expr.LambdaExp.enterFunction(LambdaExp.java:1468)
at gnu.expr.LambdaExp.compileAsMethod(LambdaExp.java:1704)
at gnu.expr.LambdaExp.compileEnd(LambdaExp.java:616)
at gnu.expr.Compilation.generateBytecode(Compilation.java:2094)
at gnu.expr.Compilation.process(Compilation.java:1970)
at gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:305)
at gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:290)
at kawa.repl.compileFiles(repl.java:806)
at kawa.repl.processArgs(repl.java:430)
at kawa.repl.main(repl.java:852)

In the course of whittling this down, the error varied. Samples:

SP at end of 'then' was 1 while SP at end of 'else' was 0

exception in inline-compiler

popType called with empty stack

Thanks.
-John

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #29548:  bug.scm added by None (182B - text/x-scheme)

 

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)
  •  

    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 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 11 Nov 2013 07:18:57 AM UTCbothnerStatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Sun 10 Nov 2013 08:00:40 PM UTCbothnerStatusNone=>In Progress
      Assigned toNone=>bothner
    Wed 06 Nov 2013 04:46:17 PM UTCNoneAttached File-=>Added bug.scm, #29548

    Back to the top


    Powered by Savane 3.1-cleanup1