Rudi Schlatte | 6 Sep 2004 11:47
Picon
Gravatar

Re: [sbcl] load CLIM automatically


On 5. Sep 2004, at 21:51, Christian Pohlmann wrote:

> Hello,
>
> I am new to lisp and very new to SBCL and CLIM. After
> setting up CLIM and SBCL correctly (some examples from
> the internet worked nicely) I was wondering how to
> speed up CLIM's initialization at startup. I just put
> the required asdf commands in /etc/sbclrc, but now
> every startup takes about one minute.

You could investigate the sb-est:save-lisp-and-die function in the 
manual, and the '--core' argument to sbcl.  Basically, you save the 
state of your running sbcl instance in a core file and can then resume 
later.  (This is possible only when running single-threaded, and when 
no foreign libraries are loaded, although the latter restriction will 
perhaps be removed this month.)

Hope that helps,

Rudi
Christophe Rhodes | 7 Sep 2004 22:30
Picon
Picon
Favicon

Re: Speeding up LOG of complex double-floats

Clemens Heitzinger <cheitzin <at> rainbow.studorg.tuwien.ac.at> writes:

> Would be great if anybody had an idea how to speed up something like
> (* z1 (log (- z0))), where z1 and z0 are complex double-floats.  I get
> this compiler note.  I am mostly interested in Linux/x86, if this make
> any difference.
>
> ; in: DEFUN ADD-TO-LOCAL-EXPANSION
> ;     (LOG (- FAST-MULTIPOLE-METHOD::Z0))
> ;
> ; note: doing complex double float to pointer coercion (cost 13)
> ; compilation unit finished
> ;   printed 1 note

This, I'm afraid, is somewhat of a late reply... (hm, only thirteen
months...)

Would

  (in-package "SB-C")
  (deftransform log ((x) ((complex double-float)))
    '(complex (log (abs x)) (phase x)))

work for you?  (Or, I guess, anyone who still cares...)  Simple
testing says that functions of the form above go about six or seven
times faster with this transform enabled.

Cheers,

Christophe
(Continue reading)

R. Mattes | 15 Sep 2004 22:34
Picon

Strange bug in MOP

Hello List,

 i'm trying to use SB-MOP to add extend some of the functionality
of CLSQLs object<->relation mapping. I want to create classes with
"virtal" slots - (multivalued) slots whose value will be calculated 
during slot access (in my case by querying a database).

To do this i wrote my own metaclass (a subclass of CLSQL's metaclass)
as well as both a direct-slot-definition class and an
effectiv-slot-definition class, both inherit from their corresponding
CLSQL slot classes [1]. I further implemented a version of 
mop:{direct|effective}-slot-definition-class that return my slot
metaclassesfor virtual slots (depending on some initargs) as well as
mop:compute-effective-slot-definition (with a call-next-method to do
the real work and some slot initialisation of the new
effective-slot-definition from my code) and, of course,
mop:get-slot-value-using-class and the corresponding setter.

I can load/compile this code without any problems but when i try to
create a class with my metaclass i get the following error:

  error in SB-PCL::GET-ACCESSOR-METHOD-FUNCTION
This is probably a bug in SBCL itself. (Alternatively, SBCL might have been
corrupted by bad user code, e.g. by an undefined Lisp operation like
(FMAKUNBOUND 'COMPILE), or by stray pointers from alien code or from unsafe
Lisp code; or there might be a bug in the OS or hardware that SBCL is running
on.) If it seems to be a bug in SBCL itself, the maintainers would like to know
about it. Bug reports are welcome on the SBCL mailing lists, which you can find
at <http://sbcl.sourceforge.net/>.
   [Condition of type SB-INT:BUG]
(Continue reading)

R. Mattes | 15 Sep 2004 23:56
Picon

Re: Strange bug in MOP

Following up my own post: this bug seems to occur at right after
compte-effective-slot-definition got called for all of my classes slots.

 Thanks Ralf

-------------------------------------------------------
This SF.Net email is sponsored by: thawte's Crypto Challenge Vl
Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam
Camcorder. More prizes in the weekly Lunch Hour Challenge.
Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m
Christophe Rhodes | 15 Sep 2004 23:10
Picon
Picon
Favicon

Re: Strange bug in MOP

"R. Mattes" <rm <at> mh-freiburg.de> writes:

> To do this i wrote my own metaclass (a subclass of CLSQL's metaclass)
> as well as both a direct-slot-definition class and an
> effectiv-slot-definition class, both inherit from their corresponding
> CLSQL slot classes [1]. I further implemented a version of 
> mop:{direct|effective}-slot-definition-class that return my slot
> metaclassesfor virtual slots (depending on some initargs) as well as
> mop:compute-effective-slot-definition (with a call-next-method to do
> the real work and some slot initialisation of the new
> effective-slot-definition from my code) and, of course,
> mop:get-slot-value-using-class and the corresponding setter.
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I presume this is spelt correctly in your code... if not, that's the
first problem.  In addition, as well as the reader and the writer, you
need to implement boundp and makunbound methods, though this doesn't
seem to be the direct cause of the problem you're seeing.

> I can load/compile this code without any problems but when i try to
> create a class with my metaclass i get the following error:
>
>   error in SB-PCL::GET-ACCESSOR-METHOD-FUNCTION
> This is probably a bug in SBCL itself. (Alternatively, SBCL might have been
> corrupted by bad user code, e.g. by an undefined Lisp operation like
> (FMAKUNBOUND 'COMPILE), or by stray pointers from alien code or from unsafe
> Lisp code; or there might be a bug in the OS or hardware that SBCL is running
> on.) If it seems to be a bug in SBCL itself, the maintainers would like to know
> about it. Bug reports are welcome on the SBCL mailing lists, which you can find
> at <http://sbcl.sourceforge.net/>.
(Continue reading)

Le grand pinguin | 15 Sep 2004 23:54
Picon

Re: Strange bug in MOP

On Wed, Sep 15, 2004 at 10:10:09PM +0100, Christophe Rhodes wrote:
> "R. Mattes" <rm <at> mh-freiburg.de> writes:
> 
> > To do this i wrote my own metaclass (a subclass of CLSQL's metaclass)
> > as well as both a direct-slot-definition class and an
> > effectiv-slot-definition class, both inherit from their corresponding
> > CLSQL slot classes [1]. I further implemented a version of 
> > mop:{direct|effective}-slot-definition-class that return my slot
> > metaclassesfor virtual slots (depending on some initargs) as well as
> > mop:compute-effective-slot-definition (with a call-next-method to do
> > the real work and some slot initialisation of the new
> > effective-slot-definition from my code) and, of course,
> > mop:get-slot-value-using-class and the corresponding setter.
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 

> I presume this is spelt correctly in your code... if not, that's the
> first problem.  

Sorry, yes. Too late for me. I have the following:

  (defmethod sb-mop:slot-value-using-class 
    ((class ontho-relation-metaclass)
    instance 
    (slot-def ontho-relation-slot-definition))

;;; Signals an error: these slots are write-only

  (defmethod (setf sb-mop:slot-value-using-class)
    (new-value 
(Continue reading)

Le grand pinguin | 16 Sep 2004 00:04
Picon

Re: Strange bug in MOP


Ok, my SBCL passes this test without any problems. BTW, this
is just the kind of sample code i was desperatly looking for
some time ago - the only thing i found was some LispWorks centric
stuff. Such nice gems hidden in the test directories? Maybe i shoud
dig further. 

Anyway, it looks like i should check what CLSQL does with the :allocation
property (unfortunately i have to inherit from CLSQL since that metaclass
seems to assume that all slots are clsql-type slots).

 Thank's again

    Ralf Mattes

-------------------------------------------------------
This SF.Net email is sponsored by: thawte's Crypto Challenge Vl
Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam
Camcorder. More prizes in the weekly Lunch Hour Challenge.
Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m
Christophe Rhodes | 16 Sep 2004 00:09
Picon
Picon
Favicon

Re: Strange bug in MOP

rm <at> mh-freiburg.de (Le grand pinguin) writes:

> On Wed, Sep 15, 2004 at 10:10:09PM +0100, Christophe Rhodes wrote:
>> This BUG message comes about if neither the standard-class
>> slot-value-using-class method nor the structure-class one is
>> applicable to the slot reading in question... how sure are you that
>> your slot definition and metaclass definitions are right?  It might be
>> helpful to see the return value of 
>>   (compute-applicable-methods
>>    #'sb-mop:slot-value-using-class
>>    (list (find-class '<metaclass-name>)
>>          (sb-mop:class-prototype '<metaclass-name>)
>>          (find-class '<effective-slot-definition-class-name>)))
>> and also the class hierarchy you have.
>> 
>
>  There is no applicable method for the generic function
>   #<STANDARD-GENERIC-FUNCTION CLASS-PROTOTYPE (4)>
>   when called with arguments
>     (ONTHO-RELATION-METACLASS).
>
> What is this supposed to do? Hmmm, did you forget a (find-class ...? I think that
> the method for SB-PCL::STD-CLASS specialized on the _class_ and not the class name.
> I tried this too:
>
>  (compute-applicable-methods
>     #'sb-mop:slot-value-using-class
>        (list (find-class 'ontho-relation-metaclass)
>              (sb-mop:class-prototype (find-class 'ontho-relation-metaclass))
> 	     (find-class 'ontho-relation-effective-slot-definition)))
(Continue reading)

Le grand pinguin | 16 Sep 2004 00:30
Picon

Re: Strange bug in MOP

On Wed, Sep 15, 2004 at 11:09:35PM +0100, Christophe Rhodes wrote:
> rm <at> mh-freiburg.de (Le grand pinguin) writes:
> 
> >
> > What is this supposed to do? Hmmm, did you forget a (find-class ...? I think that
> > the method for SB-PCL::STD-CLASS specialized on the _class_ and not the class name.
> > I tried this too:
> >
> >  (compute-applicable-methods
> >     #'sb-mop:slot-value-using-class
> >        (list (find-class 'ontho-relation-metaclass)
> >              (sb-mop:class-prototype (find-class 'ontho-relation-metaclass))
> > 	     (find-class 'ontho-relation-effective-slot-definition)))
> >
> >  => NIL
> 
> Whoops.  Not just one but two mistakes, sorry.  Try
>   (compute-applicable-methods
>    #'sb-mop:slot-value-using-class
>    (list (find-class 'ontho-relation-metaclass)
>          (sb-mop:class-prototype (find-class 'ontho-relation-metaclass))
>          (sb-mop:class-prototype (find-class 'ontho-relation-effective-slot-definition))))
> 
> >  ??? Strange. My metaclass inherits from CLSQL and that again inherits from 
> >  SB-PCL::STD-CLASS.
> >
> >   (class-direct-superclasses 
> >     (car (class-direct-superclasses 
> >       (car (class-direct-superclasses 
> >         (find-class 'ontho-relation-metaclass))))))
(Continue reading)

R. Mattes | 16 Sep 2004 21:03
Picon

Re: Strange bug in MOP


Ok, i think i found the problem,

things break after sb-mop:compute-effective-slot-definition in
'sb-pcl::get-accessor-method-function' which gets called (indirectly)
from 'sb-mop:compute-slots :after'. This function will build a list
of all applicable methods to access the given slot (read/write/bundp etc.).

Iff the list of these functions contains only one entry it will return
the "standard" accessor for this slot, otherwise it'll will check
whether any of the standard accessor fonctions (standard-slot-value...)
is a member of this list. If not the error i encountered it signaled.

Now, as long as a metaclass ingerits only from standard-class everything
works fine since the list of applicable accessor methods will at most
contain one method (that specialized on the metaclass), but as soon
as a metaclass inherits from another metaclass and there are methods for
sb-mob:slot-value-using-class specialized on both the metaclass and it's
superclass the list of applicable accessors will be longer than 1 and
hence the else-branch in '(if std-p ...' in get-accessor-method-function
will be chosen and the bug will show.

It's rather easy to construct a test case. Just take your test case and add:

;;; A metaclass that inherits from a metaclass
 (defclass superdynamic-slot-class (dynamic-slot-class) ())  

;;; Specialize svuc on this class as well
(defmethod slot-value-using-class ((class superdynamic-slot-class)
                                   instance slotd)
(Continue reading)


Gmane