Category: Language-Implementation
Superclass: ArrayedCollection
I represent code that has been compiled. I am an abstract superclass for blocks and methods

Method category index

cache flushing (class)
instance creation (class)
tables (class)
accessing (instance)
basic (instance)
copying (instance)
debugging (instance)
decoding bytecodes (instance)
literals - iteration (instance)
security (instance)
testing accesses (instance)
translation (instance)

cache flushing (class)

flushTranslatorCache
Answer any kind of cache mantained by a just-in-time code translator in the virtual machine (if any). Do nothing for now.

top


instance creation (class)

new: numBytecodes header: anInteger literals: literals
Answer a new instance of the receiver with room for the given number of bytecodes and the given header

new: numBytecodes header: anInteger numLiterals: numLiterals

Answer a new instance of the receiver with room for the given number of bytecodes and the given header

top


tables (class)

bytecodeInfoTable
Return a ByteArray which defines some properties of the bytecodes. For each bytecode, 4 bytes are reserved. The fourth byte is a flag byte: bit 7 means that the argument is a line number to be used in creating the bytecode->line number map. The first three have a meaning only for those bytecodes that represent a combination of operations: the combination can be BC1 ARG BC2 OPERAND if the fourth byte's bit 0 = 0 or BC1 OPERAND BC2 ARG if the fourth byte's bit 0 = 1 where BC1 is the first byte, BC2 is the second, ARG is the third and OPERAND is the bytecode argument as it appears in the bytecode stream.

specialSelectors

Answer an array of message names that don't need to be in literals to be sent in a method. Their position here reflects their integer code in bytecode.

specialSelectorsNumArgs

Answer a harmoniously-indexed array of arities for the messages answered by #specialSelectors.

top


accessing (instance)

at: anIndex put: aBytecode
Store aBytecode as the anIndex-th bytecode

blockAt: anIndex

Answer the CompiledBlock attached to the anIndex-th literal, assuming that the literal is a CompiledBlock or a BlockClosure.

bytecodeAt: anIndex

Answer the anIndex-th bytecode

bytecodeAt: anIndex put: aBytecode

Store aBytecode as the anIndex-th bytecode

flags

Private - Answer the optimization flags for the receiver

isAnnotated

Answer `false'.

literalAt: anIndex

Answer the anIndex-th literal

literalAt: anInteger put: aValue

Store aValue as the anIndex-th literal

literals

Answer the literals referenced by my code or any CompiledCode instances I own.

method

Answer the parent method for the receiver, or self if it is a method.

methodClass

Answer the class in which the receiver is installed.

methodClass: methodClass

Set the receiver's class instance variable

numArgs

Answer the number of arguments for the receiver

numLiterals

Answer the number of literals 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

top


basic (instance)

= aMethod
Answer whether the receiver is the same object as arg. Testing for equality could break the browser, since it's possible to put arbitrary objects via ##(...), so this is safer.

hash

Answer an hash value for the receiver

methodCategory

Answer the method category

methodCategory: aCategory

Set the method category to the given string

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


copying (instance)

deepCopy
Answer a deep copy of the receiver

top


debugging (instance)

examineOn: aStream
Print the contents of the receiver in a verbose way.

top


decoding bytecodes (instance)

dispatchTo: anObject with: param
Disassemble the bytecodes and tell anObject about them in the form of message sends. param is given as an argument to every message send.

top


literals - iteration (instance)

allLiteralSymbolsDo: aBlock
As with #allLiteralsDo:, but only call aBlock with found Symbols.

allLiteralsDo: aBlock

Walk my literals, descending into Arrays and Messages, invoking aBlock with each touched object.

literalsDo: aBlock

Invoke aBlock with each object immediately in my list of literals.

top


security (instance)

verify
Verify the bytecodes for the receiver, and raise an exception if the verification process failed.

top


testing accesses (instance)

accesses: instVarIndex
Answer whether the receiver accesses the instance variable with the given index

assigns: instVarIndex

Answer whether the receiver writes to the instance variable with the given index

containsLiteral: anObject

Answer if the receiver contains a literal which is equal to anObject.

hasBytecode: byte between: firstIndex and: lastIndex

Answer whether the receiver includes the `byte' bytecode in any of the indices between firstIndex and lastIndex.

jumpDestinationAt: anIndex forward: aBoolean

Answer where the jump at bytecode index `anIndex' lands

reads: instVarIndex

Answer whether the receiver reads the instance variable with the given index

refersTo: anObject

Answer whether the receiver refers to the given object

sendsToSuper

Answer whether the receiver includes a send to super.

sourceCodeMap

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

top


translation (instance)

discardTranslation
Flush the just-in-time translated code for the receiver (if any).

top