Package compiler :: Module pyassem :: Class PyFlowGraph
[hide private]
[frames] | no frames]

_ClassType PyFlowGraph

FlowGraph --+
            |
           PyFlowGraph

Instance Methods [hide private]
 
super_init(self)
 
__init__(self, name, filename, args=(), optimized=0, klass=None)
 
setDocstring(self, doc)
 
setFlag(self, flag)
 
checkFlag(self, flag)
 
setFreeVars(self, names)
 
setCellVars(self, names)
 
getCode(self)
Get a Python code object
 
dump(self, io=None)
 
computeStackDepth(self)
Compute the max stack depth.
 
flattenGraph(self)
Arrange the blocks in order and resolve jumps
 
convertArgs(self)
Convert arguments from symbolic to concrete form
 
sort_cellvars(self)
Sort cellvars in the order of varnames and prune from freevars.
 
_lookupName(self, name, list)
Return index of name in list, appending if necessary
 
_convert_LOAD_CONST(self, arg)
 
_convert_LOAD_FAST(self, arg)
 
_convert_STORE_FAST(self, arg)
 
_convert_DELETE_FAST(self, arg)
 
_convert_LOAD_NAME(self, arg)
 
_convert_NAME(self, arg)
 
_convert_STORE_NAME(self, arg)
 
_convert_DELETE_NAME(self, arg)
 
_convert_IMPORT_NAME(self, arg)
 
_convert_IMPORT_FROM(self, arg)
 
_convert_STORE_ATTR(self, arg)
 
_convert_LOAD_ATTR(self, arg)
 
_convert_DELETE_ATTR(self, arg)
 
_convert_LOAD_GLOBAL(self, arg)
 
_convert_STORE_GLOBAL(self, arg)
 
_convert_DELETE_GLOBAL(self, arg)
 
_convert_DEREF(self, arg)
 
_convert_LOAD_DEREF(self, arg)
 
_convert_STORE_DEREF(self, arg)
 
_convert_LOAD_CLOSURE(self, arg)
 
_convert_COMPARE_OP(self, arg)
 
makeByteCode(self)
 
newCodeObject(self)
 
getConsts(self)
Return a tuple for the const slot of the code object

Inherited from FlowGraph: emit, fixupOrder, fixupOrderForward, fixupOrderHonorNext, getBlocks, getBlocksInOrder, getContainedGraphs, getRoot, newBlock, nextBlock, startBlock, startExitBlock

Inherited from FlowGraph (private): _disable_debug, _enable_debug

Class Variables [hide private]
  hasjrel = misc.Set()
  hasjabs = misc.Set()
  _converters = {}
  _cmp = ['<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'is'...
  opnum = {'<109>': 109, '<114>': 114, '<115>': 115, '<117>': 11...
  i = 119

Inherited from FlowGraph (private): _debug

Method Details [hide private]

__init__(self, name, filename, args=(), optimized=0, klass=None)
(Constructor)

 
Overrides: FlowGraph.__init__

computeStackDepth(self)

 

Compute the max stack depth.

Approach is to compute the stack effect of each basic block. Then find the path through the code with the largest total effect.

_lookupName(self, name, list)

 

Return index of name in list, appending if necessary

This routine uses a list instead of a dictionary, because a dictionary can't store two different keys if the keys have the same value but different types, e.g. 2 and 2L. The compiler must treat these two separately, so it does an explicit type comparison before comparing the values.

getConsts(self)

 

Return a tuple for the const slot of the code object

Must convert references to code (MAKE_FUNCTION) to code objects recursively.


Class Variable Details [hide private]

_cmp

Value:
['<',
 '<=',
 '==',
 '!=',
 '>',
 '>=',
 'in',
 'not in',
...

opnum

Value:
{'<109>': 109,
 '<114>': 114,
 '<115>': 115,
 '<117>': 117,
 '<118>': 118,
 '<123>': 123,
 '<127>': 127,
 '<128>': 128,
...