[pypy-commit] pypy optresult: more tests passing, really just whacking at it
fijal
noreply at buildbot.pypy.org
Fri Mar 6 17:13:31 CET 2015
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: optresult
Changeset: r76257:5a1e7576366b
Date: 2015-03-06 17:29 +0200
http://bitbucket.org/pypy/pypy/changeset/5a1e7576366b/
Log: more tests passing, really just whacking at it
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
@@ -78,6 +78,12 @@
def __init__(self, const):
self._const = const
+ def is_null(self):
+ return not bool(self._const.getref_base())
+
+ def is_nonnull(self):
+ return bool(self._const.getref_base())
+
def get_known_class(self, cpu):
if not self._const.nonnull():
return None
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
@@ -262,24 +262,26 @@
# self.optimizer.optheap.value_updated(value, self.getvalue(constbox))
def optimize_GUARD_ISNULL(self, op):
- value = self.getvalue(op.getarg(0))
- if value.is_null():
- return
- elif value.is_nonnull():
- r = self.optimizer.metainterp_sd.logger_ops.repr_of_resop(op)
- raise InvalidLoop('A GUARD_ISNULL (%s) was proven to always fail'
- % r)
+ info = self.getptrinfo(op.getarg(0))
+ if info is not None:
+ if info.is_null():
+ return
+ elif info.is_nonnull():
+ r = self.optimizer.metainterp_sd.logger_ops.repr_of_resop(op)
+ raise InvalidLoop('A GUARD_ISNULL (%s) was proven to always '
+ 'fail' % r)
self.emit_operation(op)
- value.make_constant(self.optimizer.cpu.ts.CONST_NULL)
+ self.make_constant(op.getarg(0), self.optimizer.cpu.ts.CONST_NULL)
def optimize_GUARD_NONNULL(self, op):
opinfo = self.getptrinfo(op.getarg(0))
- if opinfo.is_nonnull():
- return
- elif opinfo.is_null():
- r = self.optimizer.metainterp_sd.logger_ops.repr_of_resop(op)
- raise InvalidLoop('A GUARD_NONNULL (%s) was proven to always fail'
- % r)
+ if opinfo is not None:
+ if opinfo.is_nonnull():
+ return
+ elif opinfo.is_null():
+ r = self.optimizer.metainterp_sd.logger_ops.repr_of_resop(op)
+ raise InvalidLoop('A GUARD_NONNULL (%s) was proven to always '
+ 'fail' % r)
self.emit_operation(op)
self.make_nonnull(op.getarg(0))
More information about the pypy-commit
mailing list