This file is indexed.

/usr/share/gnu-smalltalk/kernel/CompiledBlk.st is in gnu-smalltalk-common 3.2.4-2.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
"======================================================================
|
|   CompiledBlock Method Definitions
|
|
 ======================================================================"

"======================================================================
|
| Copyright 2000, 2001, 2003, 2008 Free Software Foundation, Inc.
| Written by Paolo Bonzini.
|
| This file is part of the GNU Smalltalk class library.
|
| The GNU Smalltalk class library is free software; you can redistribute it
| and/or modify it under the terms of the GNU Lesser General Public License
| as published by the Free Software Foundation; either version 2.1, or (at
| your option) any later version.
| 
| The GNU Smalltalk class library is distributed in the hope that it will be
| useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
| General Public License for more details.
| 
| You should have received a copy of the GNU Lesser General Public License
| along with the GNU Smalltalk class library; see the file COPYING.LIB.
| If not, write to the Free Software Foundation, 59 Temple Place - Suite
| 330, Boston, MA 02110-1301, USA.  
|
 ======================================================================"



CompiledCode subclass: CompiledBlock [
    | method |
    
    <shape: #byte>
    <category: 'Language-Implementation'>
    <comment: 'I represent a block that has been compiled.'>

    CompiledBlock class >> numArgs: args numTemps: temps bytecodes: bytecodes depth: depth literals: literalArray [
	"Answer an (almost) full fledged CompiledBlock.  To make it complete,
	 you must either set the new object's `method' variable, or put it
	 into a BlockClosure and put the BlockClosure into a CompiledMethod's
	 literals.  The clean-ness of the block is automatically computed."

	<category: 'instance creation'>
	<primitive: VMpr_CompiledBlock_create>
	self primitiveFailed
    ]

    CompiledBlock class >> new: numBytecodes header: anInteger method: outerMethod [
	"Answer a new instance of the receiver with room for the given
	 number of bytecodes and the given header."

	<category: 'instance creation'>
	^(self 
	    new: numBytecodes
	    header: anInteger
	    literals: outerMethod literals) method: outerMethod
    ]

    methodCategory [
	"Answer the method category"

	<category: 'basic'>
	^method methodCategory
    ]

    sourceCodeLinesDelta [
	"Answer the delta from the numbers in LINE_NUMBER bytecodes
	 to source code line numbers."

	<category: 'accessing'>
	^method sourceCodeLinesDelta
    ]

    sourceCodeMap [
	"Answer an array which maps bytecode indices to source code
	 line numbers.  0 values represent invalid instruction
	 pointer indices."

	<category: 'accessing'>
	| map line |
	map := ByteArray new: self size.
	line := 1.
	self allByteCodeIndicesDo: 
		[:each :byte :operand | 
		(self class bytecodeInfoTable at: byte * 4 + 4) >= 128 
		    ifTrue: 
			[line := operand.
			operand > 255 ifTrue: [map := map asArray]].
		map at: each put: line].
	^map
    ]

    methodCategory: aCategory [
	"Set the method category to the given string"

	<category: 'basic'>
	method methodCategory: aCategory
    ]

    methodSourceCode [
	"Answer the method source code (a FileSegment or String or nil)"

	<category: 'basic'>
	^method methodSourceCode
    ]

    methodSourceString [
	"Answer the method source code as a string"

	<category: 'basic'>
	^method methodSourceString
    ]

    methodSourceFile [
	"Answer the file where the method source code is stored"

	<category: 'basic'>
	^method methodSourceFile
    ]

    methodSourcePos [
	"Answer the location where the method source code is stored in
	 the methodSourceFile"

	<category: 'basic'>
	^method methodSourcePos
    ]

    = aMethod [
	"Answer whether the receiver and aMethod are equal"

	<category: 'basic'>
	self == aMethod ifTrue: [^true].
	^super = aMethod and: [method = aMethod method]
    ]

    method [
	"Answer the CompiledMethod in which the receiver lies"

	<category: 'accessing'>
	^method
    ]

    methodClass [
	"Answer the class in which the receiver is installed."

	<category: 'accessing'>
	^method methodClass
    ]

    methodClass: methodClass [
	"Set the receiver's class instance variable"

	<category: 'accessing'>
	method methodClass: methodClass
    ]

    selector: aSymbol [
	"Set the selector through which the method is called"

	<category: 'accessing'>
	method selector: aSymbol
    ]

    selector [
	"Answer the selector through which the method is called"

	<category: 'accessing'>
	^method selector
    ]

    flags [
	"Answer the `cleanness' of the block.
	 0 = clean;
	 1 = access to receiver variables and/or self;
	 2-30 = access to variables that are 1-29 contexts away;
	 31 = return from method or push thisContext"

	<category: 'accessing'>
	^header bitAnd: 31
    ]

    numArgs [
	"Answer the number of arguments passed to the receiver"

	<category: 'accessing'>
	^(header bitShift: -25) bitAnd: 31
    ]

    numTemps [
	"Answer the number of temporary variables used by the receiver"

	<category: 'accessing'>
	^(header bitShift: -20) bitAnd: 31
    ]

    stackDepth [
	"Answer the number of stack slots needed for the receiver"

	<category: 'accessing'>
	^((header bitShift: -14) bitAnd: 63) * 4
    ]

    numLiterals [
	"Answer the number of literals for the receiver"

	<category: 'accessing'>
	^literals size
    ]

    printOn: aStream [
	"Print the receiver's class and selector on aStream"

	<category: 'printing'>
	aStream
	    nextPutAll: '[] in ';
	    print: method
    ]

    printHeaderOn: aStream [
	"Private - Disassemble the method header to aStream"

	<category: 'private-printing'>
	aStream
	    nextPutAll: '    clean-ness flags: ';
	    print: self flags;
	    nl;
	    nextPutAll: '    number of arguments: ';
	    print: self numArgs;
	    nl;
	    nextPutAll: '    number of temporaries: ';
	    print: self numTemps;
	    nl;
	    nextPutAll: '    number of literals: ';
	    print: self numLiterals;
	    nl;
	    nextPutAll: '    needed stack slots: ';
	    print: self stackDepth;
	    nl
    ]

    header: hdr literals: lits [
	"Implementation note: here is the use of the header bits:
	 - bits  0-4  = clean-ness flags
	 - bits  5-13 = unused
	 - bits 14-19 = stack depth
	 - bits 20-24 = number of temps
	 - byte 25-29 = number of args"

	<category: 'private-printing'>
	header := hdr.
	literals := lits.
	Behavior flushCache
    ]

    binaryRepresentationObject [
	"This method is implemented to allow for a PluggableProxy to be used
	 with CompiledBlocks.  Answer a DirectedMessage which sends #blockAt:
	 to the CompiledMethod containing the receiver."

	<category: 'saving and loading'>
	| literalNumber |
	self literals keysAndValuesDo: 
		[:i :lit | 
		lit == self 
		    ifTrue: 
			[^DirectedMessage 
			    selector: #blockAt:
			    arguments: (Array with: i)
			    receiver: self method].
		(lit class == BlockClosure and: [lit block == self]) 
		    ifTrue: 
			[^DirectedMessage 
			    selector: #blockAt:
			    arguments: (Array with: i)
			    receiver: self method]].
	self error: 'object cannot be dumped'
    ]
]