code
stringlengths
1
1.72M
language
stringclasses
1 value
""" A simple standalone target for the javascript interpreter. """ import sys from pypy.rlib.streamio import open_file_as_stream from pypy.lang.js.interpreter import * from pypy.lang.js.jsobj import ExecutionReturned # __________ Entry point __________ interp = Interpreter() def entry_point(argv): if len(argv...
Python
# Ported from a Java benchmark whose history is : # This is adapted from a benchmark written by John Ellis and Pete Kovac # of Post Communications. # It was modified by Hans Boehm of Silicon Graphics. # # This is no substitute for real applications. No actual application # is likely to behave in exactl...
Python
""" self cloning, automatic path configuration copy this into any subdirectory of pypy from which scripts need to be run, typically all of the test subdirs. The idea is that any such script simply issues import autopath and this will make sure that the parent directory containing "pypy" is in sys.path. If y...
Python
import os, sys from pypy.translator.test import rpystone from pypy.translator.goal import richards import pypy.interpreter.gateway # needed before sys, order of imports !!! from pypy.module.sys.version import svn_revision # __________ Entry point __________ VERSION = svn_revision() # note that we have %f but no le...
Python
from pypy.translator.goal import richards entry_point = richards.entry_point # _____ Define and setup target ___ def target(*args): return entry_point, [int] def get_llinterp_args(): return [1] # _____ Run translated _____ def run(c_entry_point): print "Translated:" richards.main(c_entry_point, ite...
Python
#! /usr/bin/env python # App-level version of py.py. # See test/test_app_main. """ options: -i inspect interactively after running script -O dummy optimization flag for compatibility with C Python -c CMD program passed in as CMD (terminates option list) -S do not 'import site...
Python
from pypy.module._demo import Module, demo from pypy.objspace.cpy.ann_policy import CPyAnnotatorPolicy from pypy.objspace.cpy.objspace import CPyObjSpace from pypy.objspace.cpy.wrappable import reraise import pypy.rpython.rctypes.implementation from pypy.interpreter.error import OperationError space = CPyObjSpace() m...
Python
print '--- beginning of app_example.py ---' print 6*7 print '--- end of app_example.py ---'
Python
# patches for the Boehm GC for PyPy under Windows """ How to build a pypy compatible version of the Boehm collector for Windows and Visual Studio .net 2003. First of all, download the official Boehm collector suite from http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc.tar.gz At the time of writing (2005-10-0...
Python
import autopath from pypy.config.pypyoption import get_pypy_config from pypy.translator.goal import translate from pypy.translator.goal import targetpypystandalone from pypy.translator.driver import TranslationDriver import os, sys, traceback, random def longoptfromname(config, name): from pypy.config.makerestdoc ...
Python
# functions to query information out of the translator and annotator from the debug prompt of translate import types import re import pypy.annotation.model as annmodel import pypy.objspace.flow.model as flowmodel class typerep(object): def __init__(self, x): self.typ = getattr(x, '__class__', type(x...
Python
""" A simple standalone target for the scheme interpreter. """ import autopath import sys from pypy.rlib.streamio import open_file_as_stream from pypy.lang.scheme.ssparser import parse from pypy.lang.scheme.object import SchemeQuit, ExecutionContext # __________ Entry point __________ def entry_point(argv): i...
Python
""" A simple deeply recursive target. The target below specifies None as the argument types list. This is a case treated specially in driver.py . If the list of input types is empty, it is meant to be a list of strings, actually implementing argv of the executable. """ import os, sys def debug(msg): os.write(2...
Python
from pypy.translator.goal import targetrpystonex LOOPS = 2000000 # __________ Entry point __________ # _____ Define and setup target _____ # _____ Run translated _____ (entry_point, target, run) = targetrpystonex.make_target_definition(LOOPS) def get_llinterp_args(): return [1]
Python
#! /usr/bin/env python import os homedir = os.getenv('HOME') os.environ['PATH'] += ':/usr/local/bin:/usr/local/llvm/cfrontend/ppc/llvm-gcc/bin:'+homedir+'/bin' import autopath import py import time, os, sys, stat from pypy.translator.llvm.buildllvm import Builder os.umask(022) # allow everyone to read/execute t...
Python
from pypy.translator.gensupp import NameManager from pypy.translator.squeak.node import FunctionNode, ClassNode, SetupNode from pypy.translator.squeak.node import MethodNode, SetterNode, GetterNode from pypy.rpython.ootypesystem.ootype import Record try: set except NameError: from sets import Set as set class...
Python
import py Option = py.test.config.Option option = py.test.config.addoptions("pypy-squeak options", Option('--showsqueak', action="store_true", dest="showsqueak", default=False, help="don't run squeak headless, for debugging"), )
Python
from pypy.objspace.flow.model import Constant, Variable from pypy.rpython.ootypesystem import ootype class AbstractCode: pass class Message(AbstractCode): def __init__(self, name): self.name = name self.infix = False if len(name) <= 2 and not name.isalnum(): # Binary inf...
Python
import datetime from pypy.objspace.flow.model import Constant, Variable, c_last_exception from pypy.translator.backendopt.removenoops import remove_unaryops from pypy.translator.squeak.opformatter import OpFormatter from pypy.translator.squeak.codeformatter import CodeFormatter, Message from pypy.translator.squeak.code...
Python
from pypy.rlib.rarithmetic import r_int, r_uint, r_longlong, r_ulonglong from pypy.translator.squeak.codeformatter import CodeFormatter from pypy.translator.squeak.codeformatter import Message, Self, Assignment, Field def _setup_int_masks(): """Generates code for helpers to mask the various integer types.""" m...
Python
import os import py from pypy.tool.udir import udir from pypy.translator.squeak.gensqueak import GenSqueak, camel_case from pypy.translator.translator import TranslationContext from pypy import conftest from pypy.translator.squeak import conftest as sqconftest def compile_function(func, annotation=[], graph=None): ...
Python
class A: def m(self, i): return 1 + i def f(i): return i + 1
Python
""" Backend for the JVM. """ import sys import py from py.compat import subprocess from pypy.tool.udir import udir from pypy.translator.translator import TranslationContext from pypy.translator.oosupport.genoo import GenOO from pypy.translator.jvm.generator import JasminGenerator from pypy.translator.jvm.option impo...
Python
from pypy.translator.jvm.conftest import option # Not sure why this is needed. Sure that it shouldn't be, even. _default_values = { 'javac':'javac', 'java':'java', 'jasmin':'jasmin', 'noasm':False, 'package':'pypy', 'wd':False, 'norun':False, 'trace':False, 'byte-arrays':False ...
Python
import py Option = py.test.config.Option option = py.test.config.addoptions( "pypy-jvm options", Option('--java', action='store', dest='java', default='java', help='Define the java executable to use'), Option('--javac', action='store', dest='javac', default='javac', help='Define the...
Python
""" Definition and some basic translations between PyPy ootypesystem and JVM type system. Here are some tentative non-obvious decisions: Signed scalar types mostly map as is. Unsigned scalar types are a problem; the basic idea is to store them as signed values, but execute special code when working with them. Ano...
Python
from pypy.objspace.flow import model as flowmodel from pypy.translator.oosupport.metavm import Generator from pypy.rpython.ootypesystem import ootype from pypy.rlib.objectmodel import CDefinedIntSymbolic from pypy.translator.oosupport.constant import push_constant import pypy.translator.jvm.typesystem as jvmtype from p...
Python
""" Special methods which we hand-generate, such as toString(), equals(), and hash(). These are generally added to methods listing of node.Class, and the only requirement is that they must have a render(self, gen) method. """ import pypy.translator.jvm.generator as jvmgen import pypy.translator.jvm.typesystem as jv...
Python
""" Log for the JVM backend Do the following: from pypy.translator.jvm.log import log """ from pypy.tool.ansi_print import ansi_log import py log = py.log.Producer("jvm") py.log.setconsumer("jvm", ansi_log)
Python
from pypy.translator.translator import graphof # ___________________________________________________________________________ def throwZeroDivisionError(): raise ZeroDivisionError def throwIndexError(): raise IndexError def throwOverflowError(): raise OverflowError # ____________________________________...
Python
from pypy.translator.oosupport.metavm import MicroInstruction from pypy.translator.jvm.typesystem import JvmScalarType, JvmClassType import pypy.translator.jvm.generator as jvmgen import pypy.translator.jvm.typesystem as jvmtype class _IndirectCall(MicroInstruction): def render(self, gen, op): interface = ...
Python
""" Nodes describe Java structures that we are building. They know how to render themselves so as to build the java structure they describe. They are entered onto the database worklist as we go. Some nodes describe parts of the JVM structure that already exist --- for example, there are nodes that are used to describ...
Python
""" Mapping from OOType opcodes to JVM MicroInstructions. Most of these come from the oosupport directory. """ from pypy.translator.oosupport.metavm import \ PushArg, PushAllArgs, StoreResult, InstructionList, New, DoNothing, Call,\ SetField, GetField, DownCast, RuntimeNew, OOString, CastTo from pypy.tran...
Python
""" The database centralizes information about the state of our translation, and the mapping between the OOTypeSystem and the Java type system. """ from cStringIO import StringIO from pypy.rpython.lltypesystem import lltype from pypy.rpython.ootypesystem import ootype, rclass from pypy.translator.jvm import typesystem...
Python
from pypy.rpython.ootypesystem import ootype from pypy.objspace.flow import model as flowmodel from pypy.translator.jvm.generator import \ Field, Method, CUSTOMDICTMAKE from pypy.translator.oosupport.constant import \ BaseConstantGenerator, RecordConst, InstanceConst, ClassConst, \ StaticMethodConst, Cus...
Python
from pypy.translator.jvm import typesystem as jvmtype from pypy.translator.jvm import generator as jvmgen from pypy.rpython.ootypesystem import ootype from pypy.translator.jvm.typesystem import \ jInt, jVoid, jStringBuilder, jString, jPyPy, jChar, jArrayList, jObject, \ jBool, jHashMap, jPyPyDictItemsIterator...
Python
import os import platform import py from py.compat import subprocess from pypy.tool.udir import udir from pypy.rpython.test.tool import BaseRtypingTest, OORtypeMixin from pypy.rpython.lltypesystem.lltype import typeOf from pypy.rpython.ootypesystem import ootype from pypy.annotation.model import lltype_to_annotation f...
Python
""" Turning function dependencies into linear order ----------------------------------------------- The purpose of this module is to calculate a good linear ordering of functions, according to call transition statistics. Every node has some connections to other nodes, expressed in terms of transition frequencies. As...
Python
""" Simulation of function calls ---------------------------- The purpose of this module is to simulate function calls in the call-graph of a program, to gather information about frequencies of transitions between functions. The following SimNode/SimGraph classes show an example of the simulation performed. They can...
Python
""" CallTree An approach to do static call analysis in the PyPy backend to produce a somewhat locality-of-reference optimized ordering of the function objects in the generated source. In extent to that, it is planned to produce a non-optimized binary from instrumented source code, run some sample applications and op...
Python
# logging import py from pypy.tool.ansi_print import ansi_log log = py.log.Producer("locality") py.log.setconsumer("locality", ansi_log)
Python
#
Python
import types from pypy.objspace.flow.model import FunctionGraph from pypy.rpython.lltypesystem import lltype from pypy.translator.c.support import cdecl from pypy.rpython.lltypesystem.rstr import STR, mallocstr from pypy.rpython.lltypesystem import rstr from pypy.rpython.lltypesystem import rlist from pypy.rpython.modu...
Python
from pypy.rpython.lltypesystem.lltype import * class SymbolTable: """For debugging purposes only. This collects the information needed to know the byte-layout of the data structures generated in a C source. """ def __init__(self): self.next_number = 0 self.next_pointer = 0 ...
Python
from __future__ import generators from pypy.translator.c.support import USESLOTS # set to False if necessary while refactoring from pypy.translator.c.support import cdecl, ErrorValue from pypy.translator.c.support import llvalue_from_constant, gen_assignments from pypy.translator.c.support import c_string_constant from...
Python
from __future__ import generators import autopath, os, sys, __builtin__, marshal, zlib import py from types import FunctionType, CodeType, InstanceType, ClassType from pypy.objspace.flow.model import Variable, Constant, FunctionGraph from pypy.annotation.description import NoStandardGraph from pypy.translator.gensupp ...
Python
from __future__ import generators from pypy.rpython.lltypesystem.lltype import typeOf, Void from pypy.translator.c.support import USESLOTS # set to False if necessary while refactoring from pypy.translator.c.support import cdecl, somelettersfrom class CExternalFunctionCodeGenerator(object): if USESLOTS: __...
Python
from pypy.objspace.flow.model import Variable, Constant from pypy.objspace.flow.model import Block, Link, FunctionGraph, checkgraph from pypy.rpython.lltypesystem.lltype import \ Ptr, PyObject, typeOf, Signed, FuncType, functionptr, nullptr, Void from pypy.rpython.rtyper import LowLevelOpList from pypy.rpython.rmo...
Python
import sys from pypy.translator.c.support import cdecl from pypy.translator.c.node import ContainerNode from pypy.rpython.lltypesystem.lltype import \ typeOf, Ptr, ContainerType, RttiStruct, \ RuntimeTypeInfo, getRuntimeTypeInfo, top_container from pypy.rpython.memory.gctransform import \ refcounting, bo...
Python
from __future__ import generators from pypy.rpython.lltypesystem.lltype import \ Struct, Array, FixedSizeArray, FuncType, PyObjectType, typeOf, \ GcStruct, GcArray, RttiStruct, PyStruct, ContainerType, \ parentlink, Ptr, PyObject, Void, OpaqueType, Float, \ RuntimeTypeInfo, getRuntimeTypeInfo, Char,...
Python
""" self cloning, automatic path configuration copy this into any subdirectory of pypy from which scripts need to be run, typically all of the test subdirs. The idea is that any such script simply issues import autopath and this will make sure that the parent directory containing "pypy" is in sys.path. If y...
Python
from pypy.translator.simplify import join_blocks, cleanup_graph from pypy.translator.unsimplify import copyvar, varoftype from pypy.translator.unsimplify import insert_empty_block from pypy.translator.backendopt import canraise, inline, support, removenoops from pypy.objspace.flow.model import Block, Constant, Variable...
Python
from stackless import * c1 = coroutine() c2 = coroutine() def f(name, n, other): print "starting", name, n for i in xrange(n): print name, i, "switching to", other other.switch() print name, i, "back from", other return name c1.bind(f, "eins", 10, c2) c2.bind(f, "zwei", 10, c1) c...
Python
from pypy.rpython.lltypesystem import lltype from pypy.translator.gensupp import NameManager # # use __slots__ declarations for node classes etc # possible to turn it off while refactoring, experimenting # USESLOTS = True PyObjPtr = lltype.Ptr(lltype.PyObject) class ErrorValue: def __init__(self, TYPE): ...
Python
import autopath import py import sys from pypy.translator.c.node import PyObjectNode, PyObjHeadNode, FuncNode from pypy.translator.c.database import LowLevelDatabase from pypy.translator.c.extfunc import pre_include_code_lines from pypy.translator.gensupp import uniquemodulename, NameManager from pypy.translator.tool.c...
Python
from pypy.rpython.lltypesystem.lltype import \ Primitive, Ptr, typeOf, RuntimeTypeInfo, \ Struct, Array, FuncType, PyObject, Void, \ ContainerType, OpaqueType, FixedSizeArray, _uninitialized from pypy.rpython.lltypesystem import lltype from pypy.rpython.lltypesystem.llmemory import Address from pypy.tool...
Python
import sys from pypy.rlib.objectmodel import Symbolic, ComputedIntSymbolic from pypy.rlib.objectmodel import CDefinedIntSymbolic from pypy.rpython.lltypesystem.rffi import CConstant from pypy.rpython.lltypesystem.lltype import * from pypy.rpython.lltypesystem.llmemory import Address, \ AddressOffset, ItemOffset, A...
Python
""" self cloning, automatic path configuration copy this into any subdirectory of pypy from which scripts need to be run, typically all of the test subdirs. The idea is that any such script simply issues import autopath and this will make sure that the parent directory containing "pypy" is in sys.path. If y...
Python
""" self cloning, automatic path configuration copy this into any subdirectory of pypy from which scripts need to be run, typically all of the test subdirs. The idea is that any such script simply issues import autopath and this will make sure that the parent directory containing "pypy" is in sys.path. If y...
Python
import sys, os from pypy.translator.translator import TranslationContext, graphof from pypy.translator.tool.taskengine import SimpleTaskEngine from pypy.translator.goal import query from pypy.annotation import model as annmodel from pypy.annotation.listdef import s_list_of_strings from pypy.annotation import policy as...
Python
import autopath from pypy.tool import testit from pypy.tool.udir import udir from pypy.translator.tool.cbuild import build_cfunc from pypy.translator.test.test_cltrans import global_cl, make_cl_func def benchmark(func): try: func = func.im_func except AttributeError: pass c_func = build_cfu...
Python
import types, sys from pypy.annotation.model import SomeValue, debugname from pypy.annotation.annset import AnnotationSet from pypy.annotation.annrpython import RPythonAnnotator indent1 = [''] def show(n): if isinstance(n, AnnotationSet): return 'heap' elif isinstance(n, RPythonAnnotator): ret...
Python
import pdb import types import code import sys from pypy.objspace.flow.model import FunctionGraph class NoTTY(Exception): pass class PdbPlusShow(pdb.Pdb): def __init__(self, translator): pdb.Pdb.__init__(self) self.prompt = "(Pdb+) " self.translator = translator self.exposed =...
Python
from __future__ import generators """ """ import autopath, os import inspect, linecache from pypy.objspace.flow.model import * from pypy.objspace.flow import Space from pypy.tool.udir import udir from py.process import cmdexec from pypy.interpreter.pytraceback import offset2lineno class DotGen: def __init__(se...
Python
""" A quick hack to capture stdout/stderr. """ import os, sys class Capture: def __init__(self, mixed_out_err = False): "Start capture of the Unix-level stdout and stderr." if (not hasattr(os, 'tmpfile') or not hasattr(os, 'dup') or not hasattr(os, 'dup2') or ...
Python
import autopath import os, sys, inspect, re, imp from pypy.translator.tool import stdoutcapture import py from pypy.tool.ansi_print import ansi_log log = py.log.Producer("cbuild") py.log.setconsumer("cbuild", ansi_log) debug = 0 def make_module_from_pyxstring(name, dirpath, string): dirpath = py.path.local(dirp...
Python
from pypy.translator.translator import TranslationContext from pypy import conftest from py.test import raises from pypy.rpython.extregistry import ExtRegistryEntry from pypy.annotation import model as annmodel from pypy.annotation.policy import AnnotatorPolicy from pypy.rpython.lltypesystem import lltype from pypy.rpy...
Python
""" General-purpose reference tracker. Usage: call track(obj). """ import autopath, sys, os import gc from pypy.translator.tool.graphpage import GraphPage, DotGen from pypy.tool.uid import uid MARKER = object() class BaseRefTrackerPage(GraphPage): def compute(self, objectlist): assert objectlist[0] is...
Python
""" self cloning, automatic path configuration copy this into any subdirectory of pypy from which scripts need to be run, typically all of the test subdirs. The idea is that any such script simply issues import autopath and this will make sure that the parent directory containing "pypy" is in sys.path. If y...
Python
import inspect, types from pypy.objspace.flow.model import Block, Link, FunctionGraph from pypy.objspace.flow.model import safe_iterblocks, safe_iterlinks from pypy.translator.tool.make_dot import DotGen, make_dot, make_dot_graphs from pypy.annotation.model import SomePBC from pypy.annotation.description import MethodD...
Python
class SimpleTaskEngine(object): def __init__(self): self._plan_cache = {} self.tasks = tasks = {} for name in dir(self): if name.startswith('task_'): task_name = name[len('task_'):] task = getattr(self, name) assert callable(ta...
Python
""" Reference tracker for lltype data structures. """ import autopath, sys, os import gc from pypy.rpython.lltypesystem import lltype, llmemory from pypy.rpython.memory.gcheader import header2obj from pypy.translator.tool.reftracker import BaseRefTrackerPage, MARKER from pypy.tool.uid import uid class LLRefTrackerPa...
Python
# empty
Python
import os, pickle, sys, time, re STAT2TITLE = { 'stat:st_mtime': "date", 'exe_name': "executable", } def stat2title(s): if s.startswith('bench:'): return s[6:] else: return STAT2TITLE.get(s, s) class BenchmarkResultSet(object): def __init__(self, max_results=10): s...
Python
""" self cloning, automatic path configuration copy this into any subdirectory of pypy from which scripts need to be run, typically all of the test subdirs. The idea is that any such script simply issues import autopath and this will make sure that the parent directory containing "pypy" is in sys.path. If y...
Python
#
Python
import os, sys, time, pickle, re, py class BenchmarkFailed(Exception): pass PYSTONE_CMD = 'from test import pystone;pystone.main(%s)' PYSTONE_PATTERN = 'This machine benchmarks at' PYSTONE_ASCENDING_GOOD = True RICHARDS_CMD = 'from richards import *;main(iterations=%d)' RICHARDS_PATTERN = 'Average time per itera...
Python
# benchmarks on a unix machine. import autopath from pypy.translator.benchmark.result import BenchmarkResultSet from pypy.translator.benchmark.benchmarks import BENCHMARKS import os, sys, time, pickle, re, py def get_executables(args): #sorted by revision number (highest first) exes = sorted(args, key=os.path.ge...
Python
#
Python
from pypy.objspace.flow.model import Constant, checkgraph, c_last_exception from pypy.rpython.rtyper import LowLevelOpList, inputconst from pypy.translator.simplify import eliminate_empty_blocks, join_blocks #from pypy.translator.simplify import transform_dead_op_vars from pypy.rpython.lltypesystem import lltype from p...
Python
from pypy.objspace.flow.model import Variable, mkentrymap, flatten, Block from pypy.tool.algo.unionfind import UnionFind class DataFlowFamilyBuilder: """Follow the flow of the data in the graph. Builds a UnionFind grouping all the variables by families: each family contains exactly one variable where a va...
Python
from pypy.translator.backendopt.support import log, all_operations, annotate import pypy.rpython.raisingops.raisingops log = log.raisingop2directcall def is_raisingop(op): s = op.opname if (not s.startswith('int_') and not s.startswith('uint_') and not s.startswith('float_') and not s.startswith('llong...
Python
from pypy.translator.simplify import get_graph from pypy.objspace.flow.model import mkentrymap, checkgraph # this transformation is very academical -- I had too much time def _remove_tail_call(translator, graph, block): print "removing tail call" assert len(block.exits) == 1 assert block.exits[0].target i...
Python
from pypy.objspace.flow.model import Block, Constant, Variable, flatten from pypy.objspace.flow.model import checkgraph, mkentrymap from pypy.translator.backendopt.support import log log = log.mergeifblocks def is_chain_block(block, first=False): if len(block.operations) == 0: return False if len(bloc...
Python
from pypy.translator.simplify import get_graph import md5 def get_statistics(graph, translator, save_per_graph_details=None, ignore_stack_checks=False): seen_graphs = {} stack = [graph] num_graphs = 0 num_blocks = 0 num_ops = 0 per_graph = {} while stack: graph = stack.pop() ...
Python
""" Visit all known INSTANCEs to see which methods can be marked as non-virtual: a method is marked as non-virtual when it's never overridden in the subclasses: this means that backends can translate oosends relative to that method into non-virtual call (or maybe switching back to a direct_call if the backend doesn't s...
Python
from pypy.objspace.flow.model import Block, Variable, Constant from pypy.rpython.lltypesystem.lltype import Void from pypy.translator.backendopt.support import log from pypy.translator import simplify from pypy import conftest def remove_unaryops(graph, opnames): """Removes unary low-level ops with a name appearin...
Python
from pypy.translator.backendopt.raisingop2direct_call import raisingop2direct_call from pypy.translator.backendopt import removenoops from pypy.translator.backendopt import inline from pypy.translator.backendopt.malloc import remove_mallocs from pypy.translator.backendopt.constfold import constant_fold_graph from pypy....
Python
from pypy.annotation.model import setunion from pypy.objspace.flow.model import Variable, Constant from pypy.rpython.lltypesystem import lltype from pypy.translator.simplify import get_graph from pypy.rpython.rmodel import inputconst from pypy.translator.backendopt import support from pypy.tool.uid import uid class Cr...
Python
from pypy.translator.simplify import get_graph from pypy.rpython.lltypesystem.lloperation import llop, LL_OPERATIONS from pypy.rpython.lltypesystem import lltype from pypy.translator.backendopt import graphanalyze import py from pypy.tool.ansi_print import ansi_log log = py.log.Producer("canraise") py.log.setconsumer...
Python
import py from pypy.rpython.lltypesystem import lltype from pypy.translator.simplify import get_graph from pypy.rpython.rmodel import inputconst from pypy.tool.ansi_print import ansi_log from pypy.annotation.model import setunion, s_ImpossibleValue from pypy.translator.unsimplify import split_block, copyvar, insert_em...
Python
from pypy.translator.backendopt.escape import AbstractDataFlowInterpreter from pypy.translator.backendopt.all import remove_mallocs from pypy.translator.backendopt import inline from pypy.rpython.lltypesystem import lltype from pypy.translator import simplify from pypy.translator.backendopt import removenoops from pypy...
Python
from pypy.translator.simplify import get_graph from pypy.rpython.lltypesystem.lloperation import llop, LL_OPERATIONS from pypy.rpython.lltypesystem import lltype class GraphAnalyzer(object): """generic way to analyze graphs: recursively follow it until the first operation is found on which self.operation_is_tr...
Python
from pypy.objspace.flow.model import Variable, Constant, Block, Link from pypy.objspace.flow.model import SpaceOperation, traverse from pypy.tool.algo.unionfind import UnionFind from pypy.rpython.lltypesystem import lltype from pypy.rpython.ootypesystem import ootype from pypy.translator import simplify from pypy.trans...
Python
from pypy.objspace.flow.model import Constant, Variable, SpaceOperation from pypy.objspace.flow.model import c_last_exception from pypy.objspace.flow.model import mkentrymap from pypy.translator.backendopt.support import split_block_with_keepalive from pypy.translator.backendopt.support import log from pypy.translator....
Python
import sys from pypy.translator.simplify import join_blocks, cleanup_graph from pypy.translator.simplify import get_graph, get_funcobj from pypy.translator.unsimplify import copyvar from pypy.objspace.flow.model import Variable, Constant, Block, Link from pypy.objspace.flow.model import SpaceOperation, c_last_exception...
Python
""" Implementation of a translator from application Python to interpreter level RPython. The idea is that we can automatically transform application level implementations of methods into some equivalent representation at interpreter level. Then, the RPython to C translation might hopefully spit out some more efficient...
Python
""" Some support for genxxx implementations of source generators. Another name could be genEric, but well... """ from __future__ import generators import sys from pypy.objspace.flow.model import Block from pypy.objspace.flow.model import traverse # ordering the blocks of a graph by source position def ordered_bloc...
Python
from py.compat import optparse import autopath from pypy.translator.translator import TranslationContext from pypy.translator import driver DEFAULTS = { 'translation.backend': None, 'translation.type_system': None, 'translation.verbose': True, } class Translation(object): def __init__(self, entry_point, a...
Python
""" generate Pyrex files from the flowmodel. """ from pypy.interpreter.baseobjspace import ObjSpace from pypy.interpreter.argument import Arguments from pypy.objspace.flow.model import Variable, Constant from pypy.objspace.flow.model import mkentrymap, last_exception from pypy.annotation.annrpython import RPythonAnno...
Python