bugKawa - Bugs: bug #23534, "uninitialized register...

 
 

bug #23534: "uninitialized register 10" (VerifyError) when accessing globals from method within define-simple-class

Submitted by:  Sean Luke <feijai>
Submitted on:  Tue 10 Jun 2008 06:26:54 PM UTC  
 
Category: Code generationSeverity: 3 - Normal
Item Group: Run-time exceptionStatus: 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 12 Jun 2008 05:53:16 AM UTC, comment #3:

Actually, the bug happens when accessing a method as if it were a variable. I added a check for this, so we now get an error message. Ideally, this should be fixable. For example, we could treat reference to a one-argument method foo as if were (lambda (x) (foo x)). Or we could treat it as (this):foo. However, it's a little tricky handling the general case. (What about overloading? Varargs methods? Static methods?)

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Thu 12 Jun 2008 12:05:55 AM UTC, comment #2:

Due to namespace confusion.
Simplified test-case:

(define momentum :: <double> 1.0)

(define-simple-class <flocker> ()

((momentum) "foo")

((step ) :: <void>
(+ momentum)))

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Wed 11 Jun 2008 05:45:30 PM UTC, comment #1:

I should add that this bug appears to happen when, in a method in a simple-class definition, I access multiple global variables.

Sean Luke <feijai>
Tue 10 Jun 2008 06:26:54 PM UTC, original submission:

I've come across the situation where I get class verification error stemming from a bad compilation in Kawa 1.9.1. It's repeatable but I cannot construct a simple example, so I'm giving you the full-blown version and making it as easy to set up as possible.

I'm using Kawa in conjunction with MASON, a java multiagent simulator package. I was working on building a simulation in Kawa when I hit on this showstopper. When I initialize a compiled Kawa simple-class, it bombs on verifying one of the methods with "java.lang.VerifyError: (class: flocker, method: step signature: (Lsim/engine/SimState;)V) Accessing value from uninitialized register 10"

Examining the bytecode, sure enough, there's a crazy access to register 10, never defined before, right there on line 104 of the 'step' method:

104: aload 10

To repeat:

1. Download and unpack http://cs.gmu.edu/~sean/temp/test.tar.gz
2. Follow the example below:

geepers[/tmp/test]> ls
flocker.scm kawa-1.9.1.jar mason.jar

geepers[/tmp/test]> java -cp kawa-1.9.1.jar:mason.jar kawa.repl

#|kawa:1|# (load "flocker.scm")
flocker.scm:22:21: warning - unknown class: flocker
flocker.scm:23:8: warning - more than one possibly applicable method 'nextBoolean' in ec.util.MersenneTwisterFast
candidate: boolean ec.util.MersenneTwisterFast.nextBoolean(double)
candidate: boolean ec.util.MersenneTwisterFast.nextBoolean(float)

#|kawa:2|# (<flocker>)
java.lang.VerifyError: (class: flocker, method: step signature: (Lsim/engine/SimState;)V) Accessing value from uninitialized register 10
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
at java.lang.Class.getDeclaredMethods(Class.java:1763)
at gnu.bytecode.ClassType.addMethods(ClassType.java:751)
at gnu.bytecode.ClassType.getDeclaredMethods(ClassType.java:519)
at gnu.bytecode.ClassType.getMethods(ClassType.java:617)
at gnu.kawa.reflect.ClassMethods.getMethods(ClassMethods.java:105)
at gnu.kawa.reflect.ClassMethods.apply(ClassMethods.java:175)
at gnu.kawa.reflect.Invoke.lookupMethods(Invoke.java:257)
at gnu.kawa.reflect.Invoke.applyN(Invoke.java:184)
at gnu.kawa.reflect.Invoke.apply(Invoke.java:98)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:251)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:296)
at kawa.Shell.run(Shell.java:230)
at kawa.Shell.run(Shell.java:172)
at kawa.Shell.run(Shell.java:159)
at kawa.repl.main(repl.java:844)

Sean Luke <feijai>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

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 feijai (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 12 Jun 2008 05:53:16 AM UTCbothnerStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Thu 12 Jun 2008 12:05:55 AM UTCbothnerStatusNone=>Confirmed
      Assigned toNone=>bothner

    Back to the top


    Powered by Savane 3.1-cleanup