eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'LazyMethod':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: LazyMethod


Inheritance:

   Object
   |
   +--ExecutableFunction
      |
      +--CompiledCode
         |
         +--Method
            |
            +--LazyMethod

Package:
stx:libcomp
Category:
Kernel-Methods
Version:
rev: 1.37 date: 2019/04/03 20:40:09
user: cg
file: LazyMethod.st directory: libcomp
module: stx stc-classLibrary: libcomp
Author:
Claus Gittinger

Description:


Instances of LazyMethod are created when doing a lazy autoload.
They do not contain any code (neither byte- nor machinecode), but
keep their sourcecode only.

When executed, these will trigger an error in the VM (noByteCode),
which is caught here to create a real method from the receiver,
amd re-execute the method.

This allows faster loading of code, which will be later compiled
when first executed; for classes with a large number of methods, of
which only a small subset is actually used, this can also save
lots of memory (beside making autoloading faster).


Related information:

    Autoload

Class protocol:

Signal constants
o  compilationFailedSignal

initialization
o  initialize


Instance protocol:

compiling
o  makeRealMethod
make the receiver a real method; i.e. compile the sourcecode and
fill in the bytecode. This must be done in order to execute the receiver.

error handling
o  noByteCode
this is triggered by the interpreter when a lazy method is about to
be executed (by sending the to-be executed method this message).
Hard-compile the method, install its bytecode in the receiver,
and recall it.

queries
o  isLazyMethod

o  literals
cannot ask a lazyMethod for literals ...

o  literalsDetect: aBlock ifNone: exceptionalValue
cannot ask a lazyMethod for literals ...

o  messagesSent
cannot ask a lazyMethod for messagesSent ...

o  messagesSentToSelf
cannot ask a lazyMethod for messagesSentToSelf ...

o  messagesSentToSuper
cannot ask a lazyMethod for messagesSentToSuper ...

o  resources
cannot ask a lazyMethod for resources ...

usage example(s):

(m := self asExecutableMethod) notNil ifTrue:[^ m resources].



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Tue, 19 Mar 2024 05:34:59 GMT