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

 
 

bug #22299: function misnaming with moduleStatic > 0

Submitted by:  tk <huh>
Submitted on:  Tue 12 Feb 2008 11:50:47 PM UTC  
 
Category: Code generationSeverity: 3 - Normal
Item Group: Run-time exceptionStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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 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 huh (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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 17 Feb 2008 10:24:57 PM UTCbothnerStatusIn Progress=>Fixed
    Sat 16 Feb 2008 09:22:48 PM UTCbothnerStatusNone=>In Progress
      Assigned toNone=>bothner

    Back to the top


    Powered by Savane 3.1-cleanup