CheapBlk.st
author Stefan Vogel <sv@exept.de>
Thu, 14 Dec 1995 23:42:02 +0100
changeset 757 93d5f6b86e98
parent 623 6795a71e39d1
child 920 006dded1f4e6
permissions -rw-r--r--
Add SemaphoreSet.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
156
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
     1
"
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
     3
	      All Rights Reserved
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
     4
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    11
"
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    12
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    13
Block subclass:#CheapBlock
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    14
	 instanceVariableNames:'selfValue method'
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    15
	 classVariableNames:''
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    16
	 poolDictionaries:''
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    17
	 category:'Kernel-Methods'
156
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    18
!
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    19
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    20
!CheapBlock class methodsFor:'documentation'!
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    21
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    22
copyright
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    23
"
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    24
 COPYRIGHT (c) 1994 by Claus Gittinger
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    25
	      All Rights Reserved
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    26
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    27
 This software is furnished under a license and may be used
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    28
 only in accordance with the terms of that license and with the
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    30
 be provided or otherwise made available to, or used by, any
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    31
 other person.  No title to or ownership of the software is
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    32
 hereby transferred.
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    33
"
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    34
!
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    35
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    36
documentation
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    37
"
222
85fee82884dd commenting
claus
parents: 213
diff changeset
    38
    CheapBlocks are blocks which do not need their home-context
85fee82884dd commenting
claus
parents: 213
diff changeset
    39
    (i.e. blocks that do not access any method arguments or method locals).
156
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    40
    Since they have no reference to the home, they must store their
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    41
    creating method explicitely - otherwise, the system had no chance of
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    42
    finding the source-position of the block.
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    43
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    44
    Instance variables:
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    45
222
85fee82884dd commenting
claus
parents: 213
diff changeset
    46
      selfValue   <Object>          value to use for self if its a copying block
85fee82884dd commenting
claus
parents: 213
diff changeset
    47
85fee82884dd commenting
claus
parents: 213
diff changeset
    48
      method      <Method>          method where block was created 
156
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    49
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    50
    NOTICE: layout known by runtime system and compiler - do not change
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    51
"
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    52
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    53
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    54
version
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    55
    ^ '$Header: /cvs/stx/stx/libbasic/Attic/CheapBlk.st,v 1.9 1995-11-23 11:16:21 cg Exp $'
156
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    56
! !
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    57
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    58
!CheapBlock methodsFor:'accessing'!
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    59
161
ed36169f354d *** empty log message ***
claus
parents: 156
diff changeset
    60
method
213
3b56a17534fd *** empty log message ***
claus
parents: 161
diff changeset
    61
    "return the receivers home method.
161
ed36169f354d *** empty log message ***
claus
parents: 156
diff changeset
    62
     Thats the method where the block was created."
ed36169f354d *** empty log message ***
claus
parents: 156
diff changeset
    63
ed36169f354d *** empty log message ***
claus
parents: 156
diff changeset
    64
    ^ method
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    65
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    66
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    67
selfValue
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    68
    "return the copied self"
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    69
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    70
    ^ selfValue
156
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    71
! !
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    72
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    73
!CheapBlock methodsFor:'printing & storing'!
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    74
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    75
printOn:aStream
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    76
    "append a a printed representation of the block to aStream"
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    77
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    78
    |class selector pair|
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    79
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    80
    "
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    81
     cheap blocks have no home context, but a method instead
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    82
    "
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    83
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    84
    aStream nextPutAll:'[] in '.
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    85
    "
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    86
     find out, for which class this method was for ...
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    87
    "
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    88
    method notNil ifTrue:[
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    89
	pair := method who.
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    90
	pair notNil ifTrue:[
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    91
	    class := pair at:1.
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    92
	    selector := pair at:2.
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    93
	    aStream nextPutAll:(class name , '-' , selector).
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    94
	    aStream nextPutAll:' (optimized)'.
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    95
	    ^ self
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    96
	].
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    97
    ].
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    98
    "
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
    99
     currently, some cheap blocks don't know where they have been created
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
   100
    "
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
   101
    aStream nextPutAll:' ??? (optimized)'.
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
   102
    ^ self
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
   103
! !
f03b8fb5e778 Initial revision
claus
parents:
diff changeset
   104