bugKawa - Bugs: bug #8973, define-private functions not...

 
 

bug #8973: define-private functions not accessible from everywhere in a module

Submitter:  Chris Dean <ctdean>
Submitted:  Sun 16 May 2004 02:48:38 AM UTC
   
 
Category:  Code generation Severity:  3 - Normal
Item Group:  Run-time exception Status:  Works For Me
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 17 May 2004 04:19:25 AM UTC, comment #3: 

Still happens, but only inside my larger program.  Perhaps it's
related to some bootstrapping issue on my side?  I'll check
to see if we're doing something funny with the ClassLoader.

    |EXCEPTION OCCURRED ----- java.lang.IllegalAccessError: tried to access

> method
> gnu.kawa.slib.srfi1.$PcCars$PlCdrs(Ljava/lang/Object;)Ljava/lang/Object;
> from class gnu.kawa.slib.srfi1$frame27
>     gnu.kawa.slib.srfi1$frame27.lambda61(srfi1.scm:963)
>     gnu.kawa.slib.srfi1$frame27.apply0(srfi1.scm)
>     gnu.expr.ModuleMethod.apply0(ModuleMethod.java:81)
>     kawa.standard.call_with_values.callWithValues(call_with_values.java:10)
>     kawa.standard.call_with_values.apply2(call_with_values.java:19)
>     gnu.kawa.slib.srfi1$frame26.lambda59recur(srfi1.scm:963)
>     gnu.kawa.slib.srfi1.filterMap$V(srfi1.scm:962)
>

Chris Dean <ctdean>
Mon 17 May 2004 02:41:33 AM UTC, comment #2: 

Well no I can't replicate it either!  Shoot.  I'll run through
my regression test and see if I can find it somewhere else besides count.

Chris Dean <ctdean>
Sun 16 May 2004 10:44:32 PM UTC, comment #1: 

Hmm.  Another one where it works for me:

$ java kawa.repl
#|kawa:1|# (require 'list-lib)
#|kawa:2|# (count < '(1 2 4 8) '(2 4 6 8 10 12 14 16))
3

> Perhaps define-private functions should be implemented as "package scope"?


There is a mechanism for handling this, that is used for public macros that reference private data.  We should extend that mechanism, if needed.

> Sometimes define-private functions get used in a named let or letrec whose body is implemented as a separate class.


I'd like to reduce the number of such classes.  From the TODO file:
If a local variable is captured, and all functions intermediate between the capture site and the definition are call-only functions, and the local variable is never written (except before all calls to these intermediate functions), then add the variable as an extra implicit parameter to thse intermediate functions, instead of storing the variable in a frame.

Per Bothner <bothner>
Group administrator
Sun 16 May 2004 02:48:38 AM UTC, original submission:  

Sometimes define-private functions get used in a named let or letrec whose body is implemented as a separate class.
That is, for some module M with a private function p we
will generate the private method M.p.  If there is also a
function f then parts of the body of f might be generated
in M$frame1.lambda1recur.  If lambda1recur calls M.p we will
get a runtime error.

Perhaps define-private functions should be implemented as
"package scope"?

Here's an example from srfi1:

#|kawa:2|# (count < '(1 2 4 8) '(2 4 6 8 10 12 14 16))
java.lang.IllegalAccessError: tried to access method gnu.kawa.slib.srfi1.$PcCars$PlCdrs(Ljava/lang/Object;)Ljava/lang/Object; from class gnu.kawa.slib.srfi1$frame6
at gnu.kawa.slib.srfi1$frame6.lambda21(srfi1.scm:802)
at gnu.kawa.slib.srfi1$frame6.apply0(srfi1.scm)
at gnu.expr.ModuleMethod.apply0(ModuleMethod.java:81)
at kawa.standard.call_with_values.callWithValues(call_with_values.java:10)
at kawa.standard.call_with_values.apply2(call_with_values.java:19)
at gnu.kawa.slib.srfi1$frame5.lambda20lp(srfi1.scm:802)
at gnu.kawa.slib.srfi1.count$V(srfi1.scm:800)

Chris Dean <ctdean>

 

(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

 

CC list is empty

 

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
2004-12-13 bothner Open/ClosedOpen Closed
2004-05-16 bothner StatusNone Works For Me
    Assigned toNone bothner

Back to the top

Powered by Savane 3.13-4b48.
Corresponding source code