[pypy-svn] r12242 - pypy/dist/pypy/documentation

pedronis at codespeak.net pedronis at codespeak.net
Fri May 13 18:40:20 CEST 2005

Author: pedronis
Date: Fri May 13 18:40:20 2005
New Revision: 12242

start of documentation about SomePBC. Missing how method annotation is encoded f:ClassDef

Modified: pypy/dist/pypy/documentation/translation.txt
--- pypy/dist/pypy/documentation/translation.txt	(original)
+++ pypy/dist/pypy/documentation/translation.txt	Fri May 13 18:40:20 2005
@@ -316,9 +316,6 @@
 reversible operation).  If the new item type is more general reflowing
 from all the read positions is also scheduled.
 User-defined Classes and Instances
@@ -365,10 +362,42 @@
 parent class.
-Prebuilt Constants
+Prebuilt Constants and instance methods
-(to be completed)
+Constants in the flowgraph are annotated with a corresponding
+``SomeXxx`` instance with 'const' attribute set to the their value.
+Constant instances of user-defined classes, callables (which include
+functions but also class types themself) and staticmethod are treated
+specially.  Constant user-defined class instances can declare themself
+immutable by having a '_freeze_' method returning true, otherwise they
+will be assumed mutable and be annotated with usual ``SomeInstance``
+annotation without 'const' set.
+For user-defined constant instances that declared themself immutable,
+staticmethods and other callables ``SomePBC`` is used (PBC = pre-built
+constant). Its instances contain a 'prebuiltinstances' dictionary. For
+the normal case and single value ``x`` this will be set to ``{x :
+True}``. For a single value the 'const' attribute will also be set.
+The union of ``SomePBC`` instances will result in an instance with the
+merge of the original dictionaries.  So for example a dictionary
+pointing to functions, will usually have as its value annotation such
+a ``SomePBC`` with a 'prebuiltinstances' dict having all the functions
+as keys.
+For a large part of operations when encountering ``SomeXxx`` with
+'const' set the annotator will do constant propagation and produce
+results with also 'const' set. This also means that based on 'const'
+truth values the annotator will not flow into code that is not
+reachable given global constant values. A later graph transformation
+will remove such dead code.
+XXX None, how methods annotation storage work
+XXX complete
 Built-in functions and methods

More information about the Pypy-commit mailing list