[pypy-commit] pypy optresult: (fijal, arigo) hack hack hack, next test passes
fijal
noreply at buildbot.pypy.org
Fri Feb 27 17:40:40 CET 2015
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: optresult
Changeset: r76181:623b19f3f2ec
Date: 2015-02-27 18:40 +0200
http://bitbucket.org/pypy/pypy/changeset/623b19f3f2ec/
Log: (fijal, arigo) hack hack hack, next test passes
diff --git a/rpython/jit/metainterp/optimizeopt/info.py b/rpython/jit/metainterp/optimizeopt/info.py
--- a/rpython/jit/metainterp/optimizeopt/info.py
+++ b/rpython/jit/metainterp/optimizeopt/info.py
@@ -48,7 +48,7 @@
return newop
return op
- def get_known_class(self):
+ def get_known_class(self, cpu):
return self._known_class
class StructPtrInfo(NonNullPtrInfo):
@@ -62,6 +62,15 @@
class StrPtrInfo(NonNullPtrInfo):
_attrs_ = ()
+
+class ConstPtrInfo(PtrInfo):
+ _attrs_ = ('_const',)
+
+ def __init__(self, const):
+ self._const = const
+
+ def get_known_class(self, cpu):
+ return cpu.ts.cls_of_box(self._const)
class XPtrOptInfo(AbstractInfo):
_attrs_ = ('_tag', 'known_class', 'last_guard_pos', 'lenbound')
diff --git a/rpython/jit/metainterp/optimizeopt/optimizer.py b/rpython/jit/metainterp/optimizeopt/optimizer.py
--- a/rpython/jit/metainterp/optimizeopt/optimizer.py
+++ b/rpython/jit/metainterp/optimizeopt/optimizer.py
@@ -307,7 +307,7 @@
op = self.get_box_replacement(op)
assert op.type == 'r'
if isinstance(op, ConstPtr):
- xxx
+ return info.ConstPtrInfo(op)
fw = op.get_forwarded()
if fw is not None:
assert isinstance(fw, info.PtrInfo)
@@ -528,18 +528,9 @@
def clear_newoperations(self):
self._newoperations = []
- def make_equal_to(self, box, value):
- assert isinstance(value, OptValue)
- try:
- cur_value = self.values[box]
- except KeyError:
- pass
- else:
- assert cur_value.getlevel() != LEVEL_CONSTANT
- # replacing with a different box
- cur_value.copy_from(value)
- return
- self.values[box] = value
+ def make_equal_to(self, op, oldop):
+ assert op.get_forwarded() is None
+ op.set_forwarded(oldop)
def replace_op_with(self, op, newopnum, args=None, descr=None):
newop = op.copy_and_change(newopnum, args, descr)
diff --git a/rpython/jit/metainterp/optimizeopt/rewrite.py b/rpython/jit/metainterp/optimizeopt/rewrite.py
--- a/rpython/jit/metainterp/optimizeopt/rewrite.py
+++ b/rpython/jit/metainterp/optimizeopt/rewrite.py
@@ -350,7 +350,7 @@
info = self.getptrinfo(op.getarg(0))
assert isinstance(expectedclassbox, Const)
if info is not None:
- realclassbox = info.get_known_class()
+ realclassbox = info.get_known_class(self.optimizer.cpu)
if realclassbox is not None:
if realclassbox.same_constant(expectedclassbox):
return
@@ -595,7 +595,7 @@
self.emit_operation(op)
def optimize_SAME_AS_I(self, op):
- self.make_equal_to(op, self.getvalue(op.getarg(0)))
+ self.make_equal_to(op, op.getarg(0))
optimize_SAME_AS_R = optimize_SAME_AS_I
optimize_SAME_AS_F = optimize_SAME_AS_I
More information about the pypy-commit
mailing list