aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonan Lamy <ronan.lamy@gmail.com>2019-04-01 16:49:02 +0100
committerRonan Lamy <ronan.lamy@gmail.com>2019-04-01 16:49:02 +0100
commit1a2ec4f82985603132ef437bda7a7904df75ce85 (patch)
treed2c56bde5e61e5f2be5677e97c72742126fae7ef /rpython
parentkill cast_instance_to_base_ref, cast_to_ref and simplify some code (diff)
downloadpypy-1a2ec4f82985603132ef437bda7a7904df75ce85.tar.gz
pypy-1a2ec4f82985603132ef437bda7a7904df75ce85.tar.bz2
pypy-1a2ec4f82985603132ef437bda7a7904df75ce85.zip
More cleanup
Diffstat (limited to 'rpython')
-rw-r--r--rpython/jit/metainterp/typesystem.py11
-rw-r--r--rpython/jit/metainterp/virtualizable.py9
-rw-r--r--rpython/jit/metainterp/warmspot.py35
3 files changed, 21 insertions, 34 deletions
diff --git a/rpython/jit/metainterp/typesystem.py b/rpython/jit/metainterp/typesystem.py
index a58b0edeb3..9192c542e3 100644
--- a/rpython/jit/metainterp/typesystem.py
+++ b/rpython/jit/metainterp/typesystem.py
@@ -29,14 +29,6 @@ class LLTypeHelper(TypeSystemHelper):
name = 'lltype'
- def get_typeptr(self, obj):
- return obj.typeptr
-
- def get_FuncType(self, ARGS, RESULT):
- FUNCTYPE = lltype.FuncType(ARGS, RESULT)
- FUNCPTRTYPE = lltype.Ptr(FUNCTYPE)
- return FUNCTYPE, FUNCPTRTYPE
-
def get_superclass(self, TYPE):
SUPER = TYPE.TO._first_struct()[1]
if SUPER is None:
@@ -69,9 +61,6 @@ class LLTypeHelper(TypeSystemHelper):
obj = evaluebox.getref(rclass.OBJECTPTR)
return cast_base_ptr_to_instance(Exception, obj)
- def cast_to_baseclass(self, value):
- return lltype.cast_opaque_ptr(rclass.OBJECTPTR, value)
-
@specialize.ll()
def getlength(self, array):
return len(array)
diff --git a/rpython/jit/metainterp/virtualizable.py b/rpython/jit/metainterp/virtualizable.py
index f3bdee74ef..922012ef85 100644
--- a/rpython/jit/metainterp/virtualizable.py
+++ b/rpython/jit/metainterp/virtualizable.py
@@ -293,15 +293,14 @@ class VirtualizableInfo(object):
#
all_graphs = self.warmrunnerdesc.translator.graphs
ts = self.warmrunnerdesc.cpu.ts
- (_, FUNCPTR) = ts.get_FuncType([self.VTYPEPTR], lltype.Void)
+ FUNC = lltype.FuncType([self.VTYPEPTR], lltype.Void)
funcptr = self.warmrunnerdesc.helper_func(
- FUNCPTR, force_virtualizable_if_necessary)
+ lltype.Ptr(FUNC), force_virtualizable_if_necessary)
rvirtualizable.replace_force_virtualizable_with_call(
all_graphs, self.VTYPEPTR, funcptr)
- (_, FUNCPTR) = ts.get_FuncType([llmemory.GCREF], lltype.Void)
+ FUNC = lltype.FuncType([llmemory.GCREF], lltype.Void)
self.clear_vable_ptr = self.warmrunnerdesc.helper_func(
- FUNCPTR, self.clear_vable_token)
- FUNC = FUNCPTR.TO
+ lltype.Ptr(FUNC), self.clear_vable_token)
ei = EffectInfo([], [], [], [], [], [], EffectInfo.EF_CANNOT_RAISE,
can_invalidate=False,
oopspecindex=EffectInfo.OS_JIT_FORCE_VIRTUALIZABLE)
diff --git a/rpython/jit/metainterp/warmspot.py b/rpython/jit/metainterp/warmspot.py
index f16ccea384..6953be1437 100644
--- a/rpython/jit/metainterp/warmspot.py
+++ b/rpython/jit/metainterp/warmspot.py
@@ -3,10 +3,10 @@ import sys, py
from rpython.tool.sourcetools import func_with_new_name
from rpython.rtyper.lltypesystem import lltype, llmemory
from rpython.rtyper.annlowlevel import (llhelper, MixLevelHelperAnnotator,
- cast_base_ptr_to_instance, hlstr, cast_instance_to_gcref)
+ hlstr, cast_instance_to_gcref, cast_gcref_to_instance)
from rpython.rtyper.llannotation import lltype_to_annotation
+from rpython.rtyper.rclass import OBJECTPTR
from rpython.annotator import model as annmodel
-from rpython.annotator.dictdef import DictDef
from rpython.rtyper.llinterp import LLException
from rpython.rtyper.test.test_llinterp import get_interpreter, clear_tcache
from rpython.flowspace.model import SpaceOperation, Variable, Constant
@@ -665,10 +665,10 @@ class WarmRunnerDesc(object):
jd.num_green_args = len(jd._green_args_spec)
jd.num_red_args = len(jd.red_args_types)
RESTYPE = graph.getreturnvar().concretetype
- (jd._JIT_ENTER_FUNCTYPE,
- jd._PTR_JIT_ENTER_FUNCTYPE) = self.cpu.ts.get_FuncType(ALLARGS, lltype.Void)
- (jd._PORTAL_FUNCTYPE,
- jd._PTR_PORTAL_FUNCTYPE) = self.cpu.ts.get_FuncType(ALLARGS, RESTYPE)
+ jd._JIT_ENTER_FUNCTYPE = lltype.FuncType(ALLARGS, lltype.Void)
+ jd._PTR_JIT_ENTER_FUNCTYPE = lltype.Ptr(jd._JIT_ENTER_FUNCTYPE)
+ jd._PORTAL_FUNCTYPE = lltype.FuncType(ALLARGS, RESTYPE)
+ jd._PTR_PORTAL_FUNCTYPE = lltype.Ptr(jd._PORTAL_FUNCTYPE)
#
if jd.result_type == 'v':
ASMRESTYPE = lltype.Void
@@ -680,8 +680,8 @@ class WarmRunnerDesc(object):
ASMRESTYPE = lltype.Float
else:
assert False
- (_, jd._PTR_ASSEMBLER_HELPER_FUNCTYPE) = self.cpu.ts.get_FuncType(
- [llmemory.GCREF, llmemory.GCREF], ASMRESTYPE)
+ jd._PTR_ASSEMBLER_HELPER_FUNCTYPE = lltype.Ptr(lltype.FuncType(
+ [llmemory.GCREF, llmemory.GCREF], ASMRESTYPE))
def rewrite_jitcell_accesses(self):
jitdrivers_by_name = {}
@@ -932,7 +932,6 @@ class WarmRunnerDesc(object):
RESULT = PORTALFUNC.RESULT
result_kind = history.getkind(RESULT)
assert result_kind.startswith(jd.result_type)
- ts = self.cpu.ts
state = jd.warmstate
maybe_compile_and_run = jd._maybe_compile_and_run_fn
EnterJitAssembler = jd._EnterJitAssembler
@@ -995,11 +994,11 @@ class WarmRunnerDesc(object):
return e.result
#
if isinstance(e, jitexc.ExitFrameWithExceptionRef):
- value = ts.cast_to_baseclass(e.value)
if not we_are_translated():
- raise LLException(ts.get_typeptr(value), value)
+ value = lltype.cast_opaque_ptr(OBJECTPTR, e.value)
+ raise LLException(value.typeptr, value)
else:
- value = cast_base_ptr_to_instance(Exception, value)
+ value = cast_gcref_to_instance(Exception, e.value)
assert value is not None
raise value
#
@@ -1087,10 +1086,10 @@ class WarmRunnerDesc(object):
closures = {}
graphs = self.translator.graphs
- _, PTR_SET_PARAM_FUNCTYPE = self.cpu.ts.get_FuncType([lltype.Signed],
- lltype.Void)
- _, PTR_SET_PARAM_STR_FUNCTYPE = self.cpu.ts.get_FuncType(
- [lltype.Ptr(STR)], lltype.Void)
+ SET_PARAM_FUNC = lltype.Ptr(lltype.FuncType(
+ [lltype.Signed], lltype.Void))
+ SET_PARAM_STR_FUNC = lltype.Ptr(lltype.FuncType(
+ [lltype.Ptr(STR)], lltype.Void))
def make_closure(jd, fullfuncname, is_string):
if jd is None:
def closure(i):
@@ -1105,9 +1104,9 @@ class WarmRunnerDesc(object):
i = hlstr(i)
getattr(state, fullfuncname)(i)
if is_string:
- TP = PTR_SET_PARAM_STR_FUNCTYPE
+ TP = SET_PARAM_STR_FUNC
else:
- TP = PTR_SET_PARAM_FUNCTYPE
+ TP = SET_PARAM_FUNC
funcptr = self.helper_func(TP, closure)
return Constant(funcptr, TP)
#