This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: problem compiling primitive array references


Using a macro did solve the primitive array problem.  I did try upgrading to
Kawa 1.8 and that did solve this problem and introduced another problem.  It
seems that Kawa attempts to interpret quoted symbols consisting of digits
and '.' characters as numbers and chokes if there are multiple '.'
characters in the symbol.  

For example:
#|kawa:1|# (define ip '192.168.10.5)
<stdin>:1:23: not a valid number: duplicate '.' in number

These symbols were previously (correctly?) interpreted as string values.

--DaveH		"Be Excellent to each other!"

> -----Original Message-----
> From: Per Bothner [mailto:per@bothner.com]
> Sent: Friday, July 07, 2006 11:37 AM
> To: Hurst, Dave
> Cc: 'kawa@sources.redhat.com'
> Subject: Re: problem compiling primitive array references
> 
> 
> Hurst, Dave wrote:
> > Hello!
> > 
> > I have a function that converts an array of objects 
> returned by a Java
> > function into a Scheme list.  This function works just fine 
> in interpreted
> > mode.  When I try to compile the Scheme, I get an error 
> complaining that
> > gnu.kawa.reflect.ArrayLength does not implement Externalizable.
> 
> This seems to have been fixed sometime between kawa-1.7 and 
> kawa-1.7.90.
> 
> But notice this is a symptom of inefficient code:  If Kawa is able to
> generate efficient bytecode, it won't need to externalize ArrayLength.
> 
> > Here is example code:
> > 
> > (define (get-aggregation-policy pqm :: 
> <com.lisletech.PolicyQueryManager>)
> >   (let ((ap-get (primitive-array-get 
> <com.lisletech.PolicyNodeType>))
> >         (ap-length (primitive-array-length 
> <com.lisletech.PolicyNodeType>))
> >         (policy-list (PolicyQueryManager:getAggregationPolicy pqm)))
> >     (let collect ((index 0))
> >       (if (< index (ap-length policy-list))
> >           (cons (ap-get policy-list index)
> >                 (collect (+ index 1)))
> >           '()))))
> 
> The calls to ap-get and ap-length will require run-time reflection.
> You might want to define ap-get and ap-length as macros instead.
> It might also work to define them as constants:
> (define-constant ap-get
>    (primitive-array-get <com.lisletech.PolicyNodeType>))
> However, I haven't tested if this will let ap-get calls be inlined.
> 
> The current Kawa SVN has much more convenient ways to access
> Java arrays, by the way.
> -- 
> 	--Per Bothner
> per@bothner.com   http://per.bothner.com/
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]