18
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1994 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
Method subclass:#LazyMethod
|
|
14 |
instanceVariableNames:''
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Kernel-Methods'
|
|
18 |
!
|
|
19 |
|
|
20 |
!LazyMethod methodsFor:'error handling'!
|
|
21 |
|
|
22 |
noByteCode
|
|
23 |
"this error is triggered by the interpreter when a lazy method
|
|
24 |
is about to be executed (by sending the bad method this message);
|
|
25 |
hard-compile the method now, install its bytecode in the receiver,
|
|
26 |
and call it now."
|
|
27 |
|
|
28 |
|code m lazy sender|
|
|
29 |
|
|
30 |
"compile the method"
|
|
31 |
|
|
32 |
lazy := Compiler compileLazy:false.
|
|
33 |
[
|
|
34 |
m := self asByteCodeMethod.
|
|
35 |
] valueNowOrOnUnwindDo:[
|
|
36 |
Compiler compileLazy:lazy.
|
|
37 |
].
|
|
38 |
|
|
39 |
m isNil ifTrue:[^ super invalidMethod].
|
|
40 |
byteCode := m byteCode.
|
|
41 |
sender := thisContext sender.
|
|
42 |
byteCode notNil ifTrue:[
|
|
43 |
literals := m literals.
|
|
44 |
flags := m flags.
|
|
45 |
"
|
|
46 |
thisContext sender is the original sends (the failed ones)
|
|
47 |
context ...
|
|
48 |
"
|
|
49 |
ObjectMemory flushCaches.
|
|
50 |
^ self valueWithReceiver:(sender receiver)
|
|
51 |
arguments:(sender args)
|
|
52 |
selector:(sender selector)
|
|
53 |
].
|
|
54 |
self error:'cannot compile method'
|
|
55 |
! !
|