Author: Ronan Lamy <ronan.l...@gmail.com> Branch: llconst Changeset: r80100:3b4b18239cb8 Date: 2015-10-10 02:09 +0100 http://bitbucket.org/pypy/pypy/changeset/3b4b18239cb8/
Log: create ll_const() diff --git a/rpython/rtyper/annlowlevel.py b/rpython/rtyper/annlowlevel.py --- a/rpython/rtyper/annlowlevel.py +++ b/rpython/rtyper/annlowlevel.py @@ -13,7 +13,7 @@ from rpython.rtyper.lltypesystem import lltype, llmemory from rpython.rlib.objectmodel import specialize from rpython.rtyper import extregistry -from rpython.rtyper.rmodel import warning, LLConstant +from rpython.rtyper.rmodel import warning, LLConstant, ll_const class KeyComp(object): @@ -161,7 +161,7 @@ def constfunc(self, ll_function, args_s, s_result): p = self.delayedfunction(ll_function, args_s, s_result) - return LLConstant(p, lltype.typeOf(p)) + return ll_const(p) def graph2delayed(self, graph, FUNCTYPE=None): if FUNCTYPE is None: @@ -176,7 +176,7 @@ def graph2const(self, graph): p = self.graph2delayed(graph) - return LLConstant(p, lltype.typeOf(p)) + return ll_const(p) def getdelayedrepr(self, s_value, check_never_seen=True): """Like rtyper.getrepr(), but the resulting repr will not be setup() at diff --git a/rpython/rtyper/controllerentry.py b/rpython/rtyper/controllerentry.py --- a/rpython/rtyper/controllerentry.py +++ b/rpython/rtyper/controllerentry.py @@ -201,7 +201,7 @@ from rpython.rtyper.lltypesystem import lltype assert hop.s_result.is_constant() hop.exception_cannot_occur() - return hop.inputconst(lltype.Bool, hop.s_result.const) + return hop.inputconst(hop.s_result.const) # ____________________________________________________________ diff --git a/rpython/rtyper/extfunc.py b/rpython/rtyper/extfunc.py --- a/rpython/rtyper/extfunc.py +++ b/rpython/rtyper/extfunc.py @@ -1,6 +1,7 @@ from rpython.rtyper import extregistry from rpython.rtyper.extregistry import ExtRegistryEntry -from rpython.rtyper.lltypesystem.lltype import typeOf, FuncType, functionptr +from rpython.rtyper.lltypesystem.lltype import FuncType, functionptr +from rpython.rtyper.rmodel import ll_const from rpython.annotator import model as annmodel from rpython.annotator.signature import annotation @@ -204,7 +205,7 @@ obj = functionptr(FT, name, _external_name=self.name, _callable=fakeimpl, _safe_not_sandboxed=self.safe_not_sandboxed) - vlist = [hop.inputconst(typeOf(obj), obj)] + hop.inputargs(*args_r) + vlist = [ll_const(obj)] + hop.inputargs(*args_r) hop.exception_is_here() return hop.genop('direct_call', vlist, r_result) diff --git a/rpython/rtyper/lltypesystem/lloperation.py b/rpython/rtyper/lltypesystem/lloperation.py --- a/rpython/rtyper/lltypesystem/lloperation.py +++ b/rpython/rtyper/lltypesystem/lloperation.py @@ -3,6 +3,7 @@ """ from rpython.rtyper.extregistry import ExtRegistryEntry +from rpython.rtyper.rmodel import ll_const class LLOp(object): @@ -118,7 +119,7 @@ def specialize_call(self, hop): from rpython.rtyper.lltypesystem import lltype hop.exception_cannot_occur() - return hop.inputconst(lltype.Void, None) + return ll_const(None) def enum_ops_without_sideeffects(raising_is_ok=False): """Enumerate operations that have no side-effects diff --git a/rpython/rtyper/lltypesystem/rstr.py b/rpython/rtyper/lltypesystem/rstr.py --- a/rpython/rtyper/lltypesystem/rstr.py +++ b/rpython/rtyper/lltypesystem/rstr.py @@ -12,7 +12,7 @@ from rpython.rtyper.lltypesystem.lltype import (GcStruct, Signed, Array, Char, UniChar, Ptr, malloc, Bool, Void, GcArray, nullptr, cast_primitive, typeOf, staticAdtMethod, GcForwardReference) -from rpython.rtyper.rmodel import inputconst, Repr +from rpython.rtyper.rmodel import inputconst, Repr, ll_const from rpython.rtyper.rint import IntegerRepr from rpython.rtyper.rstr import (AbstractStringRepr, AbstractCharRepr, AbstractUniCharRepr, AbstractStringIteratorRepr, AbstractLLHelpers, @@ -1179,11 +1179,11 @@ elif code == 'x': assert isinstance(r_arg, IntegerRepr) vchunk = hop.gendirectcall(ll_str.ll_int2hex, vitem, - inputconst(Bool, False)) + ll_const(False)) elif code == 'o': assert isinstance(r_arg, IntegerRepr) vchunk = hop.gendirectcall(ll_str.ll_int2oct, vitem, - inputconst(Bool, False)) + ll_const(False)) else: raise TyperError("%%%s is not RPython" % (code,)) else: diff --git a/rpython/rtyper/rint.py b/rpython/rtyper/rint.py --- a/rpython/rtyper/rint.py +++ b/rpython/rtyper/rint.py @@ -9,7 +9,7 @@ Char, UniChar, UnsignedLongLong, SignedLongLong, build_number, Number, cast_primitive, typeOf, SignedLongLongLong) from rpython.rtyper.rfloat import FloatRepr -from rpython.rtyper.rmodel import inputconst, log +from rpython.rtyper.rmodel import inputconst, log, ll_const from rpython.tool.pairtype import pairtype class IntegerRepr(FloatRepr): @@ -158,15 +158,13 @@ from rpython.rtyper.lltypesystem.ll_str import ll_int2hex self = self.as_int varg = hop.inputarg(self, 0) - true = inputconst(Bool, True) - return hop.gendirectcall(ll_int2hex, varg, true) + return hop.gendirectcall(ll_int2hex, varg, ll_const(True)) def rtype_oct(self, hop): from rpython.rtyper.lltypesystem.ll_str import ll_int2oct self = self.as_int varg = hop.inputarg(self, 0) - true = inputconst(Bool, True) - return hop.gendirectcall(ll_int2oct, varg, true) + return hop.gendirectcall(ll_int2oct, varg, ll_const(True)) _integer_reprs = {} diff --git a/rpython/rtyper/rmodel.py b/rpython/rtyper/rmodel.py --- a/rpython/rtyper/rmodel.py +++ b/rpython/rtyper/rmodel.py @@ -2,7 +2,8 @@ from rpython.flowspace.model import Constant from rpython.rtyper.error import TyperError, MissingRTypeOperation from rpython.rtyper.lltypesystem import lltype -from rpython.rtyper.lltypesystem.lltype import Void, Bool, LowLevelType, Ptr +from rpython.rtyper.lltypesystem.lltype import ( + Void, Bool, LowLevelType, Ptr, typeOf) from rpython.tool.pairtype import pairtype, extendabletype, pair @@ -356,11 +357,15 @@ # ____________________________________________________________ class LLConstant(Constant): + """Low-level constant""" __slots__ = ["concretetype"] def __init__(self, value, concretetype): Constant.__init__(self, value) self.concretetype = concretetype +def ll_const(obj): + """Convert an object into a LLConstant""" + return LLConstant(obj, typeOf(obj)) def inputconst(reqtype, value): """Return a LLConstant with the given value, of the requested type, diff --git a/rpython/rtyper/rnone.py b/rpython/rtyper/rnone.py --- a/rpython/rtyper/rnone.py +++ b/rpython/rtyper/rnone.py @@ -1,5 +1,6 @@ from rpython.annotator.model import SomeNone -from rpython.rtyper.rmodel import Repr, TyperError, inputconst, LLConstant +from rpython.rtyper.rmodel import ( + Repr, TyperError, inputconst, LLConstant, ll_const) from rpython.rtyper.lltypesystem.lltype import Void, Bool, Ptr, Char from rpython.rtyper.lltypesystem.llmemory import Address from rpython.rtyper.rpbc import SmallFunctionSetPBCRepr @@ -43,7 +44,7 @@ class __extend__(pairtype(Repr, NoneRepr)): def convert_from_to((r_from, _), v, llops): - return inputconst(Void, None) + return ll_const(None) def rtype_is_((robj1, rnone2), hop): if hop.s_result.is_constant(): @@ -69,13 +70,13 @@ cnull = hop.inputconst(Address, robj1.null_instance()) return hop.genop('adr_eq', [v1, cnull], resulttype=Bool) elif robj1 == none_repr: - return hop.inputconst(Bool, True) + return ll_const(True) elif isinstance(robj1, SmallFunctionSetPBCRepr): if robj1.s_pbc.can_be_None: v1 = hop.inputarg(robj1, pos) return hop.genop('char_eq', [v1, inputconst(Char, '\000')], resulttype=Bool) else: - return inputconst(Bool, False) + return ll_const(False) else: raise TyperError('rtype_is_None of %r' % (robj1)) diff --git a/rpython/rtyper/rpbc.py b/rpython/rtyper/rpbc.py --- a/rpython/rtyper/rpbc.py +++ b/rpython/rtyper/rpbc.py @@ -16,8 +16,9 @@ from rpython.rtyper.lltypesystem.lltype import ( typeOf, Void, ForwardReference, Struct, Bool, Char, Ptr, malloc, nullptr, Array, Signed, cast_pointer, getfunctionptr) -from rpython.rtyper.rmodel import (Repr, inputconst, CanBeNull, mangle, - warning, impossible_repr, LLConstant) +from rpython.rtyper.rmodel import ( + Repr, inputconst, CanBeNull, mangle, warning, impossible_repr, + LLConstant, ll_const) from rpython.tool.pairtype import pair, pairtype from rpython.translator.unsimplify import varoftype @@ -332,7 +333,7 @@ row_of_one_graph = self.callfamily.calltables[shape][index] graph = row_of_one_graph[funcdesc] llfn = self.rtyper.getcallable(graph) - return inputconst(typeOf(llfn), llfn) + return ll_const(llfn) def get_unique_llfn(self): # try to build a unique low-level function. Avoid to use @@ -356,7 +357,7 @@ if graphs != [graph] * len(graphs): raise TyperError("cannot pass a specialized function here") llfn = self.rtyper.getcallable(graph) - return inputconst(typeOf(llfn), llfn) + return ll_const(llfn) def get_concrete_llfn(self, s_pbc, args_s, op): bk = self.rtyper.annotator.bookkeeper @@ -365,8 +366,7 @@ with bk.at_position(None): graph = funcdesc.get_graph(args, op) llfn = self.rtyper.getcallable(graph) - return inputconst(typeOf(llfn), llfn) - + return ll_const(llfn) class __extend__(pairtype(FunctionRepr, FunctionRepr)): @@ -379,7 +379,7 @@ class __extend__(pairtype(FunctionsPBCRepr, FunctionRepr)): def convert_from_to((r_fpbc1, r_fpbc2), v, llops): - return inputconst(Void, None) + return ll_const(None) class __extend__(pairtype(FunctionsPBCRepr, FunctionsPBCRepr)): def convert_from_to((r_fpbc1, r_fpbc2), v, llops): @@ -421,7 +421,7 @@ pointer_table[i] = self.pointer_repr.convert_desc(desc) else: pointer_table[i] = self.pointer_repr.convert_const(None) - self.c_pointer_table = inputconst(Ptr(POINTER_TABLE), pointer_table) + self.c_pointer_table = ll_const(pointer_table) def convert_desc(self, funcdesc): return chr(self.descriptions.index(funcdesc)) @@ -441,7 +441,7 @@ graph = self.make_dispatcher(shape, index, argtypes, resulttype) self.rtyper.annotator.translator.graphs.append(graph) ll_ret = getfunctionptr(graph) - c_ret = self._dispatch_cache[key] = inputconst(typeOf(ll_ret), ll_ret) + c_ret = self._dispatch_cache[key] = ll_const(ll_ret) return c_ret def make_dispatcher(self, shape, index, argtypes, resulttype): @@ -460,7 +460,7 @@ args_v = [varoftype(t) for t in argtypes] b = Block(args_v) llfn = self.rtyper.getcallable(row_of_graphs[desc]) - v_fn = inputconst(typeOf(llfn), llfn) + v_fn = ll_const(llfn) v_result = varoftype(resulttype) b.operations.append( SpaceOperation("direct_call", [v_fn] + args_v, v_result)) @@ -491,7 +491,7 @@ def rtype_bool(self, hop): if not self.s_pbc.can_be_None: - return inputconst(Bool, True) + return ll_const(True) else: v1, = hop.inputargs(self) return hop.genop('char_ne', [v1, inputconst(Char, '\000')], @@ -500,7 +500,7 @@ class __extend__(pairtype(SmallFunctionSetPBCRepr, FunctionRepr)): def convert_from_to((r_set, r_ptr), v, llops): - return inputconst(Void, None) + return ll_const(None) class __extend__(pairtype(SmallFunctionSetPBCRepr, FunctionsPBCRepr)): def convert_from_to((r_set, r_ptr), v, llops): diff --git a/rpython/rtyper/rptr.py b/rpython/rtyper/rptr.py --- a/rpython/rtyper/rptr.py +++ b/rpython/rtyper/rptr.py @@ -4,7 +4,7 @@ from rpython.rlib.rarithmetic import r_uint from rpython.rtyper.error import TyperError from rpython.rtyper.lltypesystem import lltype -from rpython.rtyper.rmodel import Repr, inputconst +from rpython.rtyper.rmodel import Repr, inputconst, ll_const from rpython.rtyper.rint import IntegerRepr from rpython.tool.pairtype import pairtype @@ -100,7 +100,7 @@ opname = 'direct_call' else: opname = 'indirect_call' - vlist.append(inputconst(lltype.Void, None)) + vlist.append(ll_const(None)) hop.exception_is_here() return hop.genop(opname, vlist, resulttype = self.lowleveltype.TO.RESULT) diff --git a/rpython/rtyper/rrange.py b/rpython/rtyper/rrange.py --- a/rpython/rtyper/rrange.py +++ b/rpython/rtyper/rrange.py @@ -2,7 +2,7 @@ from rpython.rtyper.error import TyperError from rpython.rtyper.lltypesystem.lltype import Signed, Void, Ptr from rpython.rtyper.rlist import dum_nocheck, dum_checkidx -from rpython.rtyper.rmodel import Repr, IteratorRepr +from rpython.rtyper.rmodel import Repr, IteratorRepr, ll_const from rpython.rtyper.rint import IntegerRepr from rpython.tool.pairtype import pairtype @@ -94,9 +94,9 @@ # Irregular operations. def rtype_builtin_range(hop): - vstep = hop.inputconst(Signed, 1) + vstep = ll_const(1) if hop.nb_args == 1: - vstart = hop.inputconst(Signed, 0) + vstart = ll_const(0) vstop, = hop.inputargs(Signed) elif hop.nb_args == 2: vstart, vstop = hop.inputargs(Signed, Signed) diff --git a/rpython/rtyper/rtyper.py b/rpython/rtyper/rtyper.py --- a/rpython/rtyper/rtyper.py +++ b/rpython/rtyper/rtyper.py @@ -24,7 +24,8 @@ from rpython.rtyper.lltypesystem.lltype import (Signed, Void, LowLevelType, Ptr, ContainerType, FuncType, functionptr, typeOf, RuntimeTypeInfo, attachRuntimeTypeInfo, Primitive, getfunctionptr) -from rpython.rtyper.rmodel import Repr, inputconst, BrokenReprTyperError +from rpython.rtyper.rmodel import ( + Repr, inputconst, BrokenReprTyperError, ll_const) from rpython.rtyper import rclass from rpython.rtyper.rclass import RootClassRepr from rpython.tool.pairtype import pair @@ -871,7 +872,7 @@ # build the 'direct_call' operation f = self.rtyper.getcallable(graph) - c = inputconst(typeOf(f), f) + c = ll_const(f) fobj = f._obj return self.genop('direct_call', [c]+newargs_v, resulttype = typeOf(fobj).RESULT) @@ -882,14 +883,14 @@ argtypes = [v.concretetype for v in args_v] FUNCTYPE = FuncType(argtypes, resulttype or Void) f = functionptr(FUNCTYPE, fnname, **flags) - cf = inputconst(typeOf(f), f) + cf = ll_const(f) return self.genop('direct_call', [cf]+list(args_v), resulttype) def gencapicall(self, cfnname, args_v, resulttype=None, **flags): return self.genexternalcall(cfnname, args_v, resulttype=resulttype, external="CPython", **flags) def genconst(self, ll_value): - return inputconst(typeOf(ll_value), ll_value) + return ll_const(ll_value) def genvoidconst(self, placeholder): return inputconst(Void, placeholder) diff --git a/rpython/rtyper/rvirtualizable.py b/rpython/rtyper/rvirtualizable.py --- a/rpython/rtyper/rvirtualizable.py +++ b/rpython/rtyper/rvirtualizable.py @@ -1,4 +1,4 @@ -from rpython.rtyper.rmodel import inputconst, log +from rpython.rtyper.rmodel import inputconst, log, ll_const from rpython.rtyper.lltypesystem import lltype, llmemory from rpython.rtyper.rclass import (FieldListAccessor, InstanceRepr) @@ -55,7 +55,7 @@ def replace_force_virtualizable_with_call(graphs, VTYPEPTR, funcptr): # funcptr should be a function pointer with a VTYPEPTR argument - c_funcptr = inputconst(lltype.typeOf(funcptr), funcptr) + c_funcptr = ll_const(funcptr) count = 0 for graph in graphs: for block in graph.iterblocks(): diff --git a/rpython/translator/backendopt/constfold.py b/rpython/translator/backendopt/constfold.py --- a/rpython/translator/backendopt/constfold.py +++ b/rpython/translator/backendopt/constfold.py @@ -1,6 +1,6 @@ from rpython.flowspace.model import (Variable, SpaceOperation, mkentrymap) -from rpython.rtyper.rmodel import LLConstant +from rpython.rtyper.rmodel import LLConstant, ll_const from rpython.rtyper.lltypesystem import lltype from rpython.rtyper.lltypesystem.lloperation import llop from rpython.translator.unsimplify import insert_empty_block, split_block diff --git a/rpython/translator/backendopt/inline.py b/rpython/translator/backendopt/inline.py --- a/rpython/translator/backendopt/inline.py +++ b/rpython/translator/backendopt/inline.py @@ -2,7 +2,7 @@ from rpython.flowspace.model import (Variable, Constant, Block, Link, SpaceOperation, FunctionGraph, mkentrymap) -from rpython.rtyper.rmodel import LLConstant, inputconst +from rpython.rtyper.rmodel import LLConstant, ll_const from rpython.rtyper.lltypesystem.lltype import Bool, Signed, typeOf, Void, Ptr, normalizeptr from rpython.tool.algo import sparsemat from rpython.translator.backendopt import removenoops @@ -357,7 +357,7 @@ #XXXXX don't look: insert blocks that do exception matching #for the cases where direct matching did not work ll_exc_match = self.translator.rtyper.exceptiondata.fn_exception_match - exc_match = inputconst(typeOf(ll_exc_match), ll_exc_match) + exc_match = ll_const(ll_exc_match) blocks = [] for i, link in enumerate(afterblock.exits[1:]): etype = copiedexceptblock.inputargs[0].copy() @@ -366,8 +366,7 @@ block = Block([etype, evalue] + passon_vars) res = Variable() res.concretetype = Bool - exitcase = link.llexitcase - cexitcase = LLConstant(exitcase, typeOf(exitcase)) + cexitcase = ll_const(link.llexitcase) args = [exc_match, etype, cexitcase] block.operations.append(SpaceOperation("direct_call", args, res)) block.exitswitch = res diff --git a/rpython/translator/backendopt/malloc.py b/rpython/translator/backendopt/malloc.py --- a/rpython/translator/backendopt/malloc.py +++ b/rpython/translator/backendopt/malloc.py @@ -1,7 +1,7 @@ from rpython.flowspace.model import Variable, Constant, SpaceOperation from rpython.tool.algo.unionfind import UnionFind from rpython.rtyper.lltypesystem import lltype -from rpython.rtyper.rmodel import LLConstant +from rpython.rtyper.rmodel import LLConstant, ll_const from rpython.translator import simplify from rpython.translator.backendopt import removenoops from rpython.translator.backendopt.support import log @@ -456,7 +456,7 @@ from rpython.rtyper.lltypesystem.rstr import string_repr msg = "unreachable operation (from malloc.py)" ll_msg = string_repr.convert_const(msg) - c_msg = LLConstant(ll_msg, lltype.typeOf(ll_msg)) + c_msg = ll_const(ll_msg) return SpaceOperation("debug_fatalerror", [c_msg], v_result) def flowin_op(self, op, vars, newvarsmap): diff --git a/rpython/translator/backendopt/mallocv.py b/rpython/translator/backendopt/mallocv.py --- a/rpython/translator/backendopt/mallocv.py +++ b/rpython/translator/backendopt/mallocv.py @@ -7,7 +7,7 @@ from rpython.rtyper.lltypesystem.lltype import getfunctionptr from rpython.rtyper.lltypesystem import lltype from rpython.rtyper.lltypesystem.lloperation import llop -from rpython.rtyper.rmodel import LLConstant +from rpython.rtyper.rmodel import LLConstant, ll_const def virtualize_mallocs(translator, graphs, verbose=False): @@ -792,7 +792,7 @@ from rpython.rtyper.lltypesystem.rstr import string_repr msg = 'unreachable: %s' % (op,) ll_msg = string_repr.convert_const(msg) - c_msg = LLConstant(ll_msg, lltype.typeOf(ll_msg)) + c_msg = ll_const(ll_msg) newresult = self.make_rt_result(op.result) return [SpaceOperation('debug_fatalerror', [c_msg], newresult)] @@ -937,7 +937,7 @@ def handle_residual_call(self, op, newgraph, newnodes): fspecptr = getfunctionptr(newgraph) - newargs = [LLConstant(fspecptr, concretetype=lltype.typeOf(fspecptr))] + newargs = [ll_const(fspecptr)] newargs += self.expand_nodes(newnodes) newresult = self.make_rt_result(op.result) newop = SpaceOperation('direct_call', newargs, newresult) diff --git a/rpython/translator/backendopt/support.py b/rpython/translator/backendopt/support.py --- a/rpython/translator/backendopt/support.py +++ b/rpython/translator/backendopt/support.py @@ -1,7 +1,7 @@ import py from rpython.rtyper.lltypesystem import lltype -from rpython.rtyper.rmodel import inputconst +from rpython.rtyper.rmodel import ll_const from rpython.tool.ansi_print import ansi_log from rpython.translator.simplify import get_graph @@ -22,10 +22,11 @@ yield op def annotate(translator, func, result, args): - args = [arg.concretetype for arg in args] - graph = translator.rtyper.annotate_helper(func, args) - fptr = lltype.functionptr(lltype.FuncType(args, result.concretetype), func.func_name, graph=graph) - c = inputconst(lltype.typeOf(fptr), fptr) + args = [arg.concretetype for arg in args] + graph = translator.rtyper.annotate_helper(func, args) + fptr = lltype.functionptr(lltype.FuncType(args, result.concretetype), + func.func_name, graph=graph) + c = ll_const(fptr) return c def var_needsgc(var): diff --git a/rpython/translator/exceptiontransform.py b/rpython/translator/exceptiontransform.py --- a/rpython/translator/exceptiontransform.py +++ b/rpython/translator/exceptiontransform.py @@ -8,7 +8,7 @@ from rpython.rtyper.lltypesystem import lloperation from rpython.rtyper.rclass import ll_inst_type from rpython.rtyper import rtyper -from rpython.rtyper.rmodel import inputconst, LLConstant +from rpython.rtyper.rmodel import inputconst, LLConstant, ll_const from rpython.rlib.rarithmetic import r_uint, r_longlong, r_ulonglong from rpython.rlib.rarithmetic import r_singlefloat, r_longfloat from rpython.rlib.debug import ll_assert @@ -43,9 +43,6 @@ def error_constant(T): return LLConstant(error_value(T), T) -def constant_value(llvalue): - return LLConstant(llvalue, lltype.typeOf(llvalue)) - class ExceptionTransformer(object): def __init__(self, translator): @@ -62,9 +59,9 @@ (n_i_error_ll_exc_type, n_i_error_ll_exc) = self.get_builtin_exception(NotImplementedError) - self.c_assertion_error_ll_exc_type = constant_value( + self.c_assertion_error_ll_exc_type = ll_const( assertion_error_ll_exc_type) - self.c_n_i_error_ll_exc_type = constant_value(n_i_error_ll_exc_type) + self.c_n_i_error_ll_exc_type = ll_const(n_i_error_ll_exc_type) def rpyexc_occured(): exc_type = exc_data.exc_type @@ -469,7 +466,7 @@ def constant_func(self, name, inputtypes, rettype, graph, **kwds): FUNC_TYPE = lltype.FuncType(inputtypes, rettype) fn_ptr = lltype.functionptr(FUNC_TYPE, name, graph=graph, **kwds) - return LLConstant(fn_ptr, lltype.Ptr(FUNC_TYPE)) + return ll_const(fn_ptr) def gen_getfield(self, name, llops): c_name = inputconst(lltype.Void, name) diff --git a/rpython/translator/transform.py b/rpython/translator/transform.py --- a/rpython/translator/transform.py +++ b/rpython/translator/transform.py @@ -9,7 +9,7 @@ SpaceOperation, Variable, Constant, Link, checkgraph) from rpython.annotator import model as annmodel from rpython.rtyper.lltypesystem import lltype -from rpython.rtyper.rmodel import inputconst +from rpython.rtyper.rmodel import ll_const def checkgraphs(self, blocks): seen = set() @@ -206,8 +206,7 @@ graph = rtyper.annotate_helper(stack_check, []) rtyper.specialize_more_blocks() stack_check_ptr = rtyper.getcallable(graph) - stack_check_ptr_const = inputconst(lltype.typeOf(stack_check_ptr), - stack_check_ptr) + stack_check_ptr_const = ll_const(stack_check_ptr) edges = set() insert_in = set() block2graph = {} _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit