Category: Language-Implementation
Superclass: CompiledCode
I represent methods that have been compiled. I can recompile methods from their source code, I can invoke Emacs to edit the source code for one of my instances, and I know how to access components of my instances.

Method category index

c call-outs (class)
instance creation (class)
lean images (class)
accessing (instance)
attributes (instance)
basic (instance)
c call-outs (instance)
compiling (instance)
copying (instance)
invoking (instance)
printing (instance)
saving and loading (instance)
source code (instance)
testing (instance)

c call-outs (class)

asyncCCall: descr numArgs: numArgs attributes: attributesArray
Return a CompiledMethod corresponding to a #asyncCCall:args: pragma with the given arguments.

cCall: descr numArgs: numArgs attributes: attributesArray

Return a CompiledMethod corresponding to a #cCall:returning:args: pragma with the given arguments.

top


instance creation (class)

literals: lits numArgs: numArg numTemps: numTemp attributes: attrArray bytecodes: bytecodes depth: depth
Answer a full fledged CompiledMethod. Construct the method header from the parameters, and set the literals and bytecodes to the provided ones. Also, the bytecodes are optimized and any embedded CompiledBlocks modified to refer to these literals and to the newly created CompiledMethod.

numArgs: args

Create a user-defined method (one that is sent #valueWithReceiver:withArguments: when it is invoked) with numArgs arguments. This only makes sense when called for a subclass of CompiledMethod.

top


lean images (class)

stripSourceCode
Remove all the references to method source code from the system

top


accessing (instance)

allBlocksDo: aBlock
Evaluate aBlock, passing to it all the CompiledBlocks it holds

allLiterals

Answer the literals referred to by the receiver and all the blocks in it

arguments

Not commented.

argumentsFor: anObject

Not commented.

flags

Private - Answer the optimization flags for the receiver

isOldSyntax

Answer whether the method was written with the old (chunk-format) syntax

method

Answer the receiver, since it is already a method.

methodCategory

Answer the method category

methodCategory: aCategory

Set the method category to the given string

methodClass

Answer the class in which the receiver is installed.

methodClass: methodClass

Set the receiver's class instance variable

noteOldSyntax

Remember that the method is written with the old (chunk-format) syntax

numArgs

Answer the number of arguments for the receiver

numTemps

Answer the number of temporaries for the receiver

primitive

Answer the primitive called by the receiver

selector

Answer the selector through which the method is called

selector: aSymbol

Set the selector through which the method is called

sourceCodeLinesDelta

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

stackDepth

Answer the number of stack slots needed for the receiver

temporaries

Not commented.

temporariesFor: anObject

Not commented.

withAllBlocksDo: aBlock

Evaluate aBlock, passing the receiver and all the CompiledBlocks it holds

withNewMethodClass: class

Answer either the receiver or a copy of it, with the method class set to class

withNewMethodClass: class selector: selector

Answer either the receiver or a copy of it, with the method class set to class

top


attributes (instance)

attributeAt: aSymbol
Return a Message for the first attribute named aSymbol defined by the receiver, or answer an error if none was found.

attributeAt: aSymbol ifAbsent: aBlock

Return a Message for the first attribute named aSymbol defined by the receiver, or evaluate aBlock is none was found.

attributes

Return an Array of Messages, one for each attribute defined by the receiver.

attributesDo: aBlock

Evaluate aBlock once for each attribute defined by the receiver, passing a Message each time.

isAnnotated

If the receiver has any attributes, answer true.

primitiveAttribute

If the receiver defines a primitive, return a Message resembling the attribute that was used to define it.

top


basic (instance)

= aMethod
Answer whether the receiver and aMethod are equal

hash

Answer an hash value for the receiver

top


c call-outs (instance)

isValidCCall
Answer whether I appear to have the valid flags, information, and ops to invoke a C function and answer its result.

rewriteAsAsyncCCall: func args: argsArray

Not commented.

rewriteAsCCall: funcOrDescr for: aClass

Not commented.

rewriteAsCCall: func returning: returnType args: argsArray

Not commented.

top


compiling (instance)

methodFormattedSourceString
Answer the method source code as a string, formatted using the RBFormatter. Requires package Parser.

methodParseNode

Answer the parse tree for the receiver, or nil if there is an error. Requires package Parser.

parserClass

Answer a parser class, similar to Behavior>>parserClass, that can parse my source code. Requires package Parser.

recompile

Recompile the method in the scope of the class where it leaves.

recompileNotifying: aNotifier

Recompile the method in the scope of the class where it leaves, notifying errors to aNotifier by sending it #error:.

top


copying (instance)

copy
Not commented.

deepCopy

Returns a deep copy of the receiver (the instance variables are copies of the receiver's instance variables)

top


invoking (instance)

valueWithReceiver: anObject withArguments: args
Execute the method within anObject, passing the elements of the args Array as parameters. The method need not reside on the hierarchy from the receiver's class to Object -- it need not reside at all in a MethodDictionary, in fact -- but doing bad things will compromise stability of the Smalltalk virtual machine (and don't blame anybody but yourself). If the flags field of the method header is 6, this method instead provides a hook from which the virtual machine can call back whenever execution of the method is requested. In this case, invoking the method would cause an infinite loop (the VM asks the method to run, the method asks the VM to invoke it, and so on), so this method fails with a #subclassResponsibility error.

top


printing (instance)

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

storeOn: aStream

Print code to create the receiver on aStream

top


saving and loading (instance)

binaryRepresentationObject
This method is implemented to allow for a PluggableProxy to be used with CompiledMethods. Answer a DirectedMessage which sends #>> to the class object containing the receiver.

top


source code (instance)

methodRecompilationSourceString
Answer the method source code as a string, ensuring that it is in new syntax (it has brackets).

methodSourceCode

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

methodSourceFile

Answer the file where the method source code is stored

methodSourcePos

Answer the location where the method source code is stored in the methodSourceFile

methodSourceString

Answer the method source code as a string

top


testing (instance)

accesses: instVarIndex
Answer whether the receiver or the blocks it contains accesses the instance variable with the given index

assigns: instVarIndex

Answer whether the receiver or the blocks it contains writes to the instance variable with the given index

isAbstract

Answer whether the receiver is abstract.

reads: instVarIndex

Answer whether the receiver or the blocks it contains reads to the instance variable with the given index

sendsToSuper

Answer whether the receiver or the blocks it contains have sends to super

top