code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#!/usr/bin/env python
#
# Pyrex -- Main Program, Unix
#
from Pyrex.Compiler.Main import main
main(command_line = 1)
| Python |
#!/usr/bin/env python
#
# Pyrex -- Main Program, Unix
#
from Pyrex.Compiler.Main import main
main(command_line = 1)
| 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 |
# Subclasses disutils.command.build_ext,
# replacing it with a Pyrex version that compiles pyx->c
# before calling the original build_ext command.
# July 2002, Graham Fawcett
# Modified by Darrell Gallion <dgallion1@yahoo.com>
# to allow inclusion of .c files along with .pyx files.
# Pyrex is (c) Greg Ewing.
import di... | Python |
# July 2002, Graham Fawcett
#
# this hack was inspired by the way Thomas Heller got py2exe
# to appear as a distutil command
#
# we replace distutils.command.build_ext with our own version
# and keep the old one under the module name _build_ext,
# so that *our* build_ext can make use of it.
from build_ext imp... | Python |
###############################################
#
# Odds and ends for debugging
#
###############################################
def print_call_chain(*args):
import sys
print " ".join(map(str, args))
f = sys._getframe(2)
while f:
name = f.f_code.co_name
s = f.f_locals.get('self', Non... | Python |
import py
class Directory(py.test.collect.Directory):
def run(self):
return []
| Python |
#
# Pyrex -- Misc Mac-specific things
#
import os, MacOS, macfs
def open_new_file(path):
# On the Mac, try to preserve Finder position
# of previously existing file.
fsspec = macfs.FSSpec(path)
try:
old_finfo = fsspec.GetFInfo()
except MacOS.Error, e:
#print "MacUtils.open_new_fi... | Python |
#
# Pyrex - Darwin system interface
#
verbose = 0
import os
from Pyrex.Utils import replace_suffix
from Pyrex.Compiler.Errors import PyrexError
py_include_dirs = [
"/Library/Frameworks/Python.framework/Headers"
]
compiler = "gcc"
compiler_options = \
"-g -c -fno-strict-aliasing -Wno-long-double -no-cpp-pr... | Python |
"""Suite Misc Suite: Suite that adds additional features to the Application.
Level 1, version 1
Generated from MPW:MPW Shell
AETE/AEUT resource version 1/0, language 0, script 0
"""
import aetools
import MacOS
_code = 'misc'
class MPW_Misc_Suite:
def DoScript(self, _object, _attributes={}, **_arguments):
... | Python |
"""Suite Standard Suite: Common terms for most applications
Level 1, version 1
Generated from Macintosh HD:System 8.0:Finder
AETE/AEUT resource version 0/144, language 0, script 0
"""
import aetools
import MacOS
_code = 'core'
class Finder_Std_Suite:
_argmap_class_info = {
'_in' : 'wrcd',
}
de... | Python |
"""Suite Misc Suite: Suite that adds additional features to the Application.
Level 1, version 1
Generated from Macintosh HD:Desktop Folder:ToolServer 3.4.1:ToolServer
AETE/AEUT resource version 1/0, language 0, script 0
"""
import aetools
import MacOS
_code = 'misc'
class TS_Misc_Suite:
def DoScript(self, _obj... | Python |
#
# Simple Apple-event driven Python interpreter
#
import os, sys, traceback
from cStringIO import StringIO
from MiniAEFrame import AEServer, MiniApplication
class PythonServer(AEServer, MiniApplication):
def __init__(self):
MiniApplication.__init__(self)
AEServer.__init__(self)
sel... | Python |
#
# Pyrex -- Mac system interface
#
import os, sys, string
import aetools
from aetools import TalkTo
from StdSuites.Standard_Suite import Standard_Suite_Events as Standard_Suite
from Pyrex.Utils import replace_suffix
from Pyrex.Compiler.Errors import PyrexError
c_compiler = "MWCPPC"
c_optimizations = "off"
#c_linke... | Python |
"Apple Event suite for pyserver."
import aetools
import MacOS
_code = 'misc'
class PS_Misc_Suite:
def DoScript(self, _object, _attributes={}, **_arguments):
"""DoScript: Execute a Python file, optionally with command line args.
Required argument: filename.py or [filename.py, arg, ...]
K... | Python |
#
# Pyrex -- Things that don't belong
# anywhere else in particular
#
import os, sys
def replace_suffix(path, newsuf):
base, _ = os.path.splitext(path)
return base + newsuf
def default_open_new_file(path):
return open(path, "w")
if sys.platform == "mac":
from Pyrex.Mac.MacUtils impo... | Python |
#
# Pyrex - Command Line Parsing
#
import sys
usage = """\
Usage: pyrexc [options] sourcefile...
Options:
-v, --version Display version number of pyrex compiler
-l, --create-listing Write error messages to a listing file
-I, --include-dir <directory> Search for include files in nam... | Python |
debug_disposal_code = 0
debug_temp_alloc = 0
debug_coercion = 0
| Python |
#
# Pyrex Scanner - Lexical Definitions
#
# Changing anything in this file will cause Lexicon.pickle
# to be rebuilt next time pyrexc is run.
#
string_prefixes = "cCrR"
def make_lexicon():
from Pyrex.Plex import \
Str, Any, AnyBut, AnyChar, Rep, Rep1, Opt, Bol, Eol, Eof, \
TEXT, IGNORE, Stat... | Python |
version = '0.9.2.1'
| Python |
#
# Pyrex Parser
#
import os, re
from string import join, replace
from types import ListType, TupleType
from Scanning import PyrexScanner
import Nodes
import ExprNodes
from Errors import error, InternalError
def p_ident(s, message = "Expected an identifier"):
if s.sy == 'IDENT':
name = s.systring
... | Python |
#
# Pyrex - Errors
#
import sys
from Pyrex.Utils import open_new_file
class PyrexError(Exception):
pass
class CompileError(PyrexError):
def __init__(self, position = None, message = ""):
self.position = position
self.message = message
if position:
pos_str = "%s:%d... | Python |
#
# Pyrex - Parse tree nodes for expressions
#
from string import join
from Errors import error, InternalError
import Naming
from Nodes import Node
import PyrexTypes
from PyrexTypes import py_object_type
import Symtab
import Options
from Pyrex.Debugging import print_call_chain
from DebugFlags import debug_disposal... | Python |
#
# Pyrex - Symbol Table
#
import re
from Errors import error, InternalError
import Options
import Naming
from PyrexTypes import c_int_type, \
py_object_type, c_char_array_type, \
CEnumType, CStructOrUnionType, PyExtensionType
from TypeSlots import \
pyfunction_signature, pymethod_signature, \
get_sp... | Python |
#
# Pyrex Top Level
#
import sys
if sys.version_info[:2] < (2, 2):
print >>sys.stderr, "Sorry, Pyrex requires Python 2.2 or later"
sys.exit(1)
import os
from time import time
import Version
from Scanning import PyrexScanner
import Errors
from Errors import PyrexError, CompileError, error
import Parsing
from... | Python |
#
# Pyrex - Tables describing slots in the type object
# and associated know-how.
#
import Naming
import PyrexTypes
class Signature:
# Method slot signature descriptor.
#
# has_dummy_arg boolean
# has_generic_args boolean
# fixed_arg_format string
# ret_format ... | Python |
#
# Pyrex - Parse tree nodes
#
import os, string, sys, time
import Code
from Errors import error, InternalError
import Naming
import PyrexTypes
from PyrexTypes import py_object_type, error_type
from Symtab import ModuleScope, LocalScope, \
StructOrUnionScope, PyClassScope, CClassScope
import TypeSlots
import Ve... | Python |
#
# Pyrex - Types
#
import string
import Naming
class PyrexType:
#
# Base class for all Pyrex types.
#
# is_pyobject boolean Is a Python object type
# is_extension_type boolean Is a Python extension type
# is_numeric boolean Is a C numeric type
# ... | Python |
#
# Pyrex - Compilation-wide options
#
intern_names = 1 # Intern global variable and attribute names
| Python |
#
# Pyrex - Code output module
#
import Naming
from Pyrex.Utils import open_new_file
class CCodeWriter:
# f file output file
# level int indentation level
# bol bool beginning of line?
# marker string comment... | Python |
#
# Pyrex Scanner
#
#import pickle
import cPickle as pickle
import os
import stat
import sys
from time import time
from Pyrex import Plex
from Pyrex.Plex import Scanner
from Pyrex.Plex.Errors import UnrecognizedInput
from Errors import CompileError, error
from Lexicon import string_prefixes, make_lexicon
plex_ver... | Python |
#
# Pyrex - C naming conventions
#
#
# Prefixes for generating C names.
# Collected here to facilitate ensuring uniqueness.
#
pyrex_prefix = "__pyx_"
arg_prefix = pyrex_prefix + "arg_"
funcdoc_prefix = pyrex_prefix + "doc_"
enum_prefix = pyrex_prefix + "e_"
func_prefix = pyrex_prefix + ... | Python |
#=======================================================================
#
# Python Lexical Analyser
#
# Actions for use in token specifications
#
#=======================================================================
class Action:
def same_as(self, other):
return self is other
class Return(Action):
"... | Python |
#=======================================================================
#
# Python Lexical Analyser
#
#
# Scanning an input stream
#
#=======================================================================
import Errors
from Regexps import BOL, EOL, EOF
class Scanner:
"""
A Scanner is used to read tokens fro... | Python |
#=======================================================================
#
# Python Lexical Analyser
#
# Classes for building NFAs and DFAs
#
#=======================================================================
import string
import sys
from sys import maxint
from types import TupleType
from Transitions import... | Python |
#=======================================================================
#
# Python Lexical Analyser
#
# Exception classes
#
#=======================================================================
import exceptions
class PlexError(exceptions.Exception):
message = ""
class PlexTypeError(PlexError, TypeError):
... | Python |
#
# Plex - Transition Maps
#
# This version represents state sets direcly as dicts
# for speed.
#
from copy import copy
import string
from sys import maxint
from types import TupleType
class TransitionMap:
"""
A TransitionMap maps an input event to a set of states.
An input event is one of: a range of cha... | Python |
#=======================================================================
#
# Python Lexical Analyser
#
# Regular Expressions
#
#=======================================================================
import array
import string
import types
from sys import maxint
import Errors
#
# Constants
#
BOL = 'bol'
EOL = 'e... | Python |
#=======================================================================
#
# Python Lexical Analyser
#
# Traditional Regular Expression Syntax
#
#=======================================================================
from Regexps import *
from Errors import PlexError
class RegexpSyntaxError(PlexError):
pass
... | Python |
#=======================================================================
#
# Python Lexical Analyser
#
# Converting NFA to DFA
#
#=======================================================================
import Machines
from Machines import LOWEST_PRIORITY
from Transitions import TransitionMap
def nfa_to_dfa(old_ma... | Python |
#
# Get time in platform-dependent way
#
import os
from sys import platform, exit, stderr
if platform == 'mac':
import MacOS
def time():
return MacOS.GetTicks() / 60.0
timekind = "real"
elif hasattr(os, 'times'):
def time():
t = os.times()
return t[0] + t[1]
timekind = "cpu"
else:
stderr.wri... | Python |
#=======================================================================
#
# Python Lexical Analyser
#
#=======================================================================
"""
The Plex module provides lexical analysers with similar capabilities
to GNU Flex. The following classes and functions are exported;
see t... | Python |
#=======================================================================
#
# Python Lexical Analyser
#
# Lexical Analyser Specification
#
#=======================================================================
import types
import Actions
import DFA
import Errors
import Machines
import Regexps
# debug_flags for ... | 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 |
#! /usr/bin/env python
"""
"PYSTONE" Benchmark Program
Version: Python/1.1 (corresponds to C/1.1 plus 2 Pystone fixes)
Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
Translated from ADA to C by Rick Richardson.
Every method to preserve ADA-likeness h... | Python |
#! /usr/bin/env python
"""
"PYSTONE" Benchmark Program
Version: Python/1.1 (corresponds to C/1.1 plus 2 Pystone fixes)
Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
Translated from ADA to C by Rick Richardson.
Every method to preserve ADA-likeness h... | 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 |
"""Snippets for translation
This module holds various snippets, to be used by translator
unittests.
We define argument types as default arguments to the snippet
functions.
"""
numtype = (int, float)
anytype = (int, float, str)
seqtype = (list, tuple)
def if_then_else(cond=anytype, x=anytype, y=anytype):
if cond... | Python |
import sys
import shutil
import py
from py.compat import subprocess
from pypy.config.config import Config
from pypy.translator.oosupport.genoo import GenOO
from pypy.translator.oosupport.treebuilder import build_trees
from pypy.translator.backendopt.ssa import SSI_to_SSA
from pypy.translator.cli import conftest
from p... | Python |
import cPickle as pickle
import os.path
from py.compat import subprocess
from pypy.rpython.ootypesystem import ootype
from pypy.translator.cli.rte import Query
from pypy.translator.cli.sdk import SDK
from pypy.translator.cli.support import log
from pypy.translator.cli.dotnet import CLR, CliNamespace, CliClass,\
Na... | Python |
from pypy.rpython.lltypesystem.lltype import Signed, Unsigned, Void, Bool, Float
from pypy.rpython.lltypesystem.lltype import SignedLongLong, UnsignedLongLong
from pypy.rlib.objectmodel import CDefinedIntSymbolic
from pypy.rpython.ootypesystem import ootype
from pypy.translator.oosupport.metavm import Generator
from py... | Python |
from pypy.translator.cli.conftest import option
_defaultopt = dict(wd = False, source = False, nostop = False, stdout = False, nostackopt = False)
def getoption(name):
return getattr(option, name, _defaultopt.get(name))
| Python |
"""
Translate between PyPy ootypesystem and .NET Common Type System
"""
import exceptions
from pypy.rpython.lltypesystem.lltype import SignedLongLong, UnsignedLongLong
from pypy.rpython.lltypesystem import lltype
from pypy.rpython.ootypesystem import ootype
from pypy.rpython.lltypesystem.llmemory import WeakGcAddress... | Python |
"""
Support for an automatically compiled Run Time Environment.
The source of the RTE is in the src/ directory.
"""
import os
import os.path
import shutil
import py
from py.compat import subprocess
from pypy.translator.cli.sdk import SDK
from pypy.tool.ansi_print import ansi_log
log = py.log.Producer("cli")
py.log.se... | Python |
import types
from pypy.rpython.ootypesystem import ootype
from pypy.translator.cli.cts import CTS
from pypy.translator.cli.node import Node
IEQUALITY_COMPARER = 'class [mscorlib]System.Collections.Generic.IEqualityComparer`1<%s>'
class EqualityComparer(Node):
count = 0
def __init__(self, db, KEY_TYPE, eq... | Python |
from pypy.translator.cli.ilgenerator import IlasmGenerator
class StackOptMixin(object):
def __init__(self, *args):
self.super = super(StackOptMixin, self)
self.super.__init__(*args)
self._reset()
def _reset(self):
self.pending_ops = []
self.mapping = {} # varname --> (... | Python |
try:
set
except NameError:
from sets import Set as set
from pypy.objspace.flow import model as flowmodel
from pypy.rpython.lltypesystem.lltype import Void
from pypy.rpython.ootypesystem import ootype
from pypy.translator.oosupport.treebuilder import SubOperation
from pypy.translator.oosupport.function import F... | Python |
import py
Option = py.test.config.Option
option = py.test.config.addoptions\
("pypy-cli options",
Option('--source', action="store_true", dest="source", default=False,
help="only generate IL source, don't compile"),
Option('--wd', action="store_true", dest="wd", defaul... | Python |
from pypy.translator.cli.cts import CTS
from pypy.translator.cli.database import LowLevelDatabase
from pypy.translator.cli.node import Node
from pypy.rpython.ootypesystem import ootype
def get_entrypoint(graph):
from pypy.translator.cli.test.runtest import TestEntryPoint
try:
ARG0 = graph.getargs()[0].... | Python |
from pypy.rpython.ootypesystem import ootype
from pypy.translator.cli.node import Node
from pypy.translator.cli.cts import CTS
from pypy.translator.oosupport.constant import push_constant
from pypy.translator.cli.ilgenerator import CLIBaseGenerator
try:
set
except NameError:
from sets import Set as set
class ... | Python |
#! /usr/bin/env python
"""
Usage: carbonpython.py <module-name> [dll-name]
Compiles an RPython module into a .NET dll.
"""
import sys
import new
import types
import os.path
import inspect
from pypy.translator.driver import TranslationDriver
from pypy.translator.cli.entrypoint import DllEntryPoint
class DllDef:
... | Python |
from pypy.translator.cli.function import Function
try:
set
except NameError:
from sets import Set as set
class Helper(Function):
def render(self, ilasm):
ilasm.begin_namespace('pypy.runtime')
ilasm.begin_class('Helpers')
Function.render(self, ilasm)
ilasm.end_class()
... | Python |
from pypy.translator.cli import oopspec
from pypy.rpython.ootypesystem import ootype
from pypy.translator.oosupport.metavm import Generator, InstructionList, MicroInstruction,\
PushAllArgs, StoreResult, GetField, SetField, DownCast
from pypy.translator.cli.comparer import EqualityComparer
from pypy.translator.cli.... | Python |
import types
from pypy.annotation.pairtype import pair, pairtype
from pypy.annotation.model import SomeObject, SomeInstance, SomeOOInstance, SomeInteger, s_None,\
s_ImpossibleValue, lltype_to_annotation, annotation_to_lltype, SomeChar, SomeString, SomePBC
from pypy.annotation.binaryop import _make_none_union
from... | Python |
from pypy.rpython.ootypesystem import ootype
from pypy.translator.cli.cts import CTS
from pypy.translator.cli.node import Node
class Delegate(Node):
def __init__(self, db, TYPE, name):
self.cts = CTS(db)
self.TYPE = TYPE
self.name = name
def __eq__(self, other):
return ... | Python |
class Node(object):
def get_name(self):
pass
def dependencies(self):
pass
def render(self, ilasm):
pass
| Python |
from pypy.rpython.ootypesystem import ootype
from pypy.translator.cli.node import Node
from pypy.translator.cli.cts import CTS
class Record(Node):
def __init__(self, db, record, name):
self.db = db
self.cts = CTS(db)
self.record = record
self.name = name
def __hash__(self):
... | Python |
import os.path
import platform
import py
class AbstractSDK(object):
def _check_helper(cls, helper):
if py.path.local.sysfind(helper) is None:
py.test.skip("%s is not on your path." % helper)
else:
return helper
_check_helper = classmethod(_check_helper)
def runtime(... | Python |
from pypy.rpython.ootypesystem import ootype
def get_method_name(graph, op):
try:
oopspec = graph.func.oopspec
except AttributeError:
return None
# TODO: handle parsing of arguments; by now it is assumed that
# builtin methods take the same arguments of the corresponding
# ll_* fun... | Python |
import py
from pypy.rpython.ootypesystem import ootype
from pypy.translator.cli.rte import Support
from pypy.tool.ansi_print import ansi_log
log = py.log.Producer("cli")
py.log.setconsumer("cli", ansi_log)
try:
import CLR as PythonNet
PythonNet.System.Reflection.Assembly.LoadFile(Support.get())
except Import... | Python |
from pypy.translator.cli.metavm import Call, CallMethod, \
IndirectCall, GetField, SetField, OOString, DownCast, NewCustomDict,\
CastWeakAdrToPtr, MapException, Box, Unbox, NewArray, GetArrayElem, SetArrayElem,\
TypeOf
from pypy.translator.oosupport.metavm import PushArg, PushAllArgs, StoreResult, Instr... | Python |
#! /usr/bin/env python
"""
Usage: carbonpython.py <module-name> [dll-name]
Compiles an RPython module into a .NET dll.
"""
import sys
import new
import types
import os.path
import inspect
from pypy.translator.driver import TranslationDriver
from pypy.translator.cli.entrypoint import DllEntryPoint
class DllDef:
... | Python |
import operator
import string
from pypy.translator.cli.function import Function, log
from pypy.translator.cli.class_ import Class
from pypy.translator.cli.record import Record
from pypy.translator.cli.delegate import Delegate
from pypy.translator.cli.comparer import EqualityComparer
from pypy.translator.cli.node import... | Python |
"""
___________________________________________________________________________
CLI Constants
This module extends the oosupport/constant.py to be specific to the
CLI. Most of the code in this file is in the constant generators, which
determine how constants are stored and loaded (static fields, lazy
initialization, e... | Python |
import os
import platform
import py
from py.compat import subprocess
from pypy.tool.udir import udir
from pypy.translator.translator import TranslationContext
from pypy.rpython.test.tool import BaseRtypingTest, OORtypeMixin
from pypy.rpython.lltypesystem.lltype import typeOf
from pypy.rpython.ootypesystem import ootyp... | 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 |
from pypy.translator.cli.carbonpython import export
@export(int, int)
def sum(a, b):
return a+b
| Python |
#! /usr/bin/env python
if __name__ == '__main__':
import tool.autopath
import py
py.test.cmdline.main()
| Python |
from pypy.rlib.objectmodel import specialize, debug_assert
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.jit.codegen.model import AbstractRGenOp, GenLabel, GenBuilder
from pypy.jit.codegen.model import GenVar, GenConst, CodeGenSwitch
from pypy.jit.codegen.llgraph import llimpl
from pypy.rpython.lltyp... | Python |
"""
Functions that generate flow graphs and operations.
The functions below produce L2 graphs, but they define an interface
that can be used to produce any other kind of graph.
"""
from pypy.rpython.lltypesystem import lltype, llmemory, rtupletype
from pypy.objspace.flow import model as flowmodel
from pypy.translator.... | Python |
"""
Processor auto-detection
"""
import sys, os
class ProcessorAutodetectError(Exception):
pass
def autodetect():
mach = None
try:
import platform
mach = platform.machine()
except ImportError:
pass
if not mach:
platform = sys.platform.lower()
if platform.st... | Python |
from pypy.rlib.objectmodel import specialize
class NotConstant(Exception):
pass
# all the following classes will be subclassed by each backend.
class GenVarOrConst(object):
'''Instances of this "doubly abstract" class contains values,
either run-time values or compile time constants.'''
@specialize... | Python |
'''
Use this file to hide differences between llvm 1.x and 2.x .
'''
from pypy.jit.codegen.llvm.llvmjit import llvm_version
if llvm_version() < 2.0:
icmp = scmp = ucmp = fcmp = 'set'
inttoptr = trunc = zext = bitcast = inttoptr = 'cast'
shr_prefix = ['', '']
i1 = 'bool'
i8 = 'ubyte'
i16 = 's... | Python |
from distutils.core import setup
from distutils.extension import Extension
from os import popen
#Create llvm c api library by running "python setup.py build_ext -i" here
cxxflags = popen('llvm-config --cxxflags').readline().split()
ldflags = popen('llvm-config --ldflags').readline().split()
libs = popen('llvm-co... | Python |
import py, os
from pypy.rlib.objectmodel import specialize
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rlib.rarithmetic import intmask, r_uint
from pypy.jit.codegen.model import AbstractRGenOp, GenLabel, GenBuilder
from pypy.jit.codegen.model import GenVar, GenConst, CodeGenSwitch
from pypy.jit.cod... | Python |
import py
from pypy.jit.codegen import detect_cpu
#XXX Should check here if llvm supports a JIT for this platform (perhaps using lli?)
class Directory(py.test.collect.Directory):
def run(self):
py.test.skip("skipping jit.codegen.llvm for now")
# try:
# processor = detect_cpu.autodetect(... | Python |
import py
from pypy.jit.codegen.llvm.genvarorconst import Var, BoolConst, CharConst,\
IntConst, UIntConst, FloatConst, AddrConst
from pypy.jit.codegen.llvm.compatibility import icmp, scmp, ucmp, fcmp, inttoptr,\
trunc, zext, bitcast, inttoptr, shr_prefix, define, i1, i8, i16, i32, f64
def cast(osrc, dst):
... | Python |
'''
Another go at using the LLVM JIT as a codegenerator for PyPy.
For now we use the LLVM C++ API as little as possible!
In future we might talk directly to the LLVM C++ API.
This file contains the ctypes specification to use the llvmjit library!
'''
import autopath
from pypy.rpython.rctypes impor... | 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 py, os
from pypy.rlib.objectmodel import we_are_translated
from pypy.jit.codegen.llvm.conftest import option
PRINT_DEBUG = option.print_debug
class Logger:
enabled = True
log_fd = -1
def _freeze_(self):
# reset the machine_code_dumper global instance to its default state
if ... | Python |
import py, os
from pypy.rlib.objectmodel import specialize
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rlib.rarithmetic import intmask
from pypy.jit.codegen.model import GenVar, GenConst
from pypy.jit.codegen.llvm.logger import logger
from pypy.jit.codegen.llvm.compatibility import i1, i8, i16, i32... | Python |
import py
Option = py.test.config.Option
option = py.test.config.addoptions("codegen options",
Option('--trap', action="store_true", default=False,
dest="trap",
help="generate a breakpoint instruction at the start"))
| Python |
import py
from pypy.jit.codegen.model import AbstractRGenOp, GenLabel, GenBuilder
from pypy.jit.codegen.model import GenVar, GenConst, CodeGenSwitch
from pypy.jit.codegen.model import ReplayBuilder, dummy_var
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rpython.lltypesystem import lloperation
from p... | Python |
from pypy.jit.codegen.ppc.instruction import \
gprs, fprs, crfs, ctr, \
NO_REGISTER, GP_REGISTER, FP_REGISTER, CR_FIELD, CT_REGISTER, \
CMPInsn, Spill, Unspill, stack_slot, \
rSCRATCH
from pypy.jit.codegen.ppc.conftest import option
DEBUG_PRINT = option.debug_print
class RegisterAllocation:
d... | Python |
import os
from pypy.jit.codegen.ppc.ppcgen import form
# don't be fooled by the fact that there's some separation between a
# generic assembler class and a PPC assembler class... there's
# certainly a RISC dependency in here, and quite possibly a PPC
# dependency or two too. I personally don't care :)
class Assemble... | Python |
def lookup(sym):
global lookup
import py
_ppcgen = py.magic.autopath().dirpath().join('_ppcgen.c')._getpymodule()
try:
from _ppcgen import NSLookupAndBindSymbol
def lookup(sym):
return NSLookupAndBindSymbol('_' + sym)
except ImportError:
from _ppcgen import dl... | Python |
from pypy.jit.codegen.ppc.ppcgen.ppc_assembler import MyPPCAssembler
from pypy.jit.codegen.ppc.ppcgen.symbol_lookup import lookup
from pypy.jit.codegen.ppc.ppcgen.regname import *
def load_arg(code, argi, typecode):
rD = r3+argi
code.lwz(rD, r4, 12 + 4*argi)
if typecode == 'i':
code.load_word(r0, l... | Python |
import py
import mmap, struct
_ppcgen = None
def get_ppcgen():
global _ppcgen
if _ppcgen is None:
_ppcgen = py.magic.autopath().dirpath().join('_ppcgen.c')._getpymodule()
return _ppcgen
class AsmCode(object):
def __init__(self, size):
self.code = mmap.mmap(-1, size,
... | Python |
# only a small file, but there's some hairy stuff in here!
"""
>>> f = Field('test', 16, 31)
>>> f
<Field 'test'>
>>> f.encode(65535)
65535
>>> f.encode(65536)
Traceback (most recent call last):
File \"<stdin>\", line 1, in ?
File \"field.py\", line 25, in encode
raise ValueError(\"field '%s' can't accept value... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.