bugKawa - Bugs: bug #22299, function misnaming with...

 
 

bug #22299: function misnaming with moduleStatic > 0

Submitter:  tk <huh>
Submitted:  Tue 12 Feb 2008 11:50:47 PM UTC
   
 
Category:  Code generation Severity:  3 - Normal
Item Group:  Run-time exception Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 17 Feb 2008 10:24:57 PM UTC, comment #2: 

I checked in a fix so we disable the "field inlining" if the class's ClassLoader is a ZipLoader or an ArrayClassLoader.  Seems to fix it.

Per Bothner <bothner>
Group administrator
Sat 16 Feb 2008 09:22:48 PM UTC, comment #1: 

A work-around is to disable inlining when compiling a.scm:

$ kawa --no-inline

The problem is that the Kawa compiler inlines the call (foo-b) to a field in b.class, which is OK if b.class is available to a's class-loader, but this case it isn't.

So the problem is disabling that particular inlining.  Hopefully not too difficult.

Per Bothner <bothner>
Group administrator
Tue 12 Feb 2008 11:50:47 PM UTC, original submission:  

svn 6049

when compiling with moduleStatic > 0, compiler is generating
incorrect name to refer to function in another module.
following example illustrates the error:

$ cat a.scm
(define (foo-a)
  (foo-b))
$ cat b.scm
(define (foo-b)
  (format #t "foo-b here~%"))

$ rlwrap java -jar kawa-1.9.3.jar
#|kawa:1|# (set! (static-field <gnu.expr.Compilation> 'moduleStatic) 1)
#|kawa:2|# (compile-file "b.scm" "b.zip")
#|kawa:3|# (load"b.zip")
#|kawa:4|# (compile-file "a.scm" "a.zip")
#|kawa:5|# (load"a.zip")
#|kawa:6|# (foo-b)
foo-b here
#|kawa:7|# (foo-a)
java.lang.NoClassDefFoundError: b
at a.fooA(a.scm:1)
at a.apply0(a.scm:1)
at gnu.expr.ModuleMethod.apply0(ModuleMethod.java:176)
at gnu.expr.ModuleMethod.apply(ModuleMethod.java:150)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:251)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:309)
at kawa.Shell.run(Shell.java:275)
at kawa.Shell.run(Shell.java:186)
at kawa.Shell.run(Shell.java:167)
at kawa.repl.main(repl.java:870)
Caused by: java.lang.ClassNotFoundException: b
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at gnu.bytecode.ZipLoader.loadClass(ZipLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 10 more



from disassembly of the class for a.scm, it appears that
the name of the file is being prepended to the function name:

public static java.lang.Object fooA();
  Code:
   0: getstatic #12; Field b.foo$Mnb:Lgnu/expr/ModuleMethod;
   3: invokevirtual #18; Method gnu/mapping/Procedure.apply0:()Ljava/lang/Object;
   6: areturn


bug was introduced sometime after svn 5959


tk <huh>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-02-17 bothner StatusIn Progress Fixed
    2008-02-16 bothner StatusNone In Progress
        Assigned toNone bothner

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code