Author: Maciej Fijalkowski <[email protected]>
Branch: optresult
Changeset: r77774:8010cbfca5a0
Date: 2015-06-02 16:52 +0200
http://bitbucket.org/pypy/pypy/changeset/8010cbfca5a0/
Log: fix fix fix fix
diff --git a/rpython/jit/metainterp/history.py
b/rpython/jit/metainterp/history.py
--- a/rpython/jit/metainterp/history.py
+++ b/rpython/jit/metainterp/history.py
@@ -760,7 +760,7 @@
op = ResOperation(opnum, argboxes, descr)
if value is None:
assert op.type == 'v'
- elif type(value) is bool:
+ elif not we_are_translated() and type(value) is bool:
assert op.type == 'i'
op.setint(int(value))
elif isinstance(value, float):
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
@@ -836,6 +836,7 @@
def optimize_STRGETITEM(self, op):
indexb = self.getintbound(op.getarg(1))
if indexb.is_constant():
+ raise Exception("implement me")
arrayvalue = self.getvalue(op.getarg(0))
arrayvalue.make_len_gt(MODE_STR, op.getdescr(),
indexvalue.box.getint())
self.optimize_default(op)
@@ -843,6 +844,7 @@
def optimize_UNICODEGETITEM(self, op):
indexb = self.getintbound(op.getarg(1))
if indexb.is_constant():
+ raise Exception("implement me")
arrayvalue = self.getvalue(op.getarg(0))
arrayvalue.make_len_gt(MODE_UNICODE, op.getdescr(),
indexvalue.box.getint())
self.optimize_default(op)
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,6 +262,8 @@
box = self.get_box_replacement(box)
if box.is_constant():
if not box.same_constant(constbox):
+ r = self.optimizer.metainterp_sd.logger_ops.repr_of_resop(
+ op)
raise InvalidLoop('A GUARD_VALUE (%s) was proven '
'to always fail' % r)
return
diff --git a/rpython/jit/metainterp/optimizeopt/simplify.py
b/rpython/jit/metainterp/optimizeopt/simplify.py
--- a/rpython/jit/metainterp/optimizeopt/simplify.py
+++ b/rpython/jit/metainterp/optimizeopt/simplify.py
@@ -33,8 +33,9 @@
pass
def optimize_VIRTUAL_REF(self, op):
- op = ResOperation(rop.SAME_AS, [op.getarg(0)], op.result)
- self.emit_operation(op)
+ newop = ResOperation(rop.SAME_AS_R, [op.getarg(0)], op.result)
+ self.replace_op_with(op, newop)
+ self.emit_operation(newop)
def optimize_QUASIIMMUT_FIELD(self, op):
# xxx ideally we could also kill the following GUARD_NOT_INVALIDATED
diff --git a/rpython/jit/metainterp/pyjitpl.py
b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -1382,10 +1382,9 @@
vrefinfo = metainterp.staticdata.virtualref_info
obj = box.getref_base()
vref = vrefinfo.virtual_ref_during_tracing(obj)
- resbox = history.BoxPtr(vref)
+ cindex = history.ConstInt(len(metainterp.virtualref_boxes) // 2)
+ resbox = metainterp.history.record(rop.VIRTUAL_REF, [box, cindex],
vref)
self.metainterp.heapcache.new(resbox)
- cindex = history.ConstInt(len(metainterp.virtualref_boxes) // 2)
- metainterp.history.record(rop.VIRTUAL_REF, [box, cindex], resbox)
# Note: we allocate a JIT_VIRTUAL_REF here
# (in virtual_ref_during_tracing()), in order to detect when
# the virtual escapes during tracing already. We record it as a
@@ -2975,7 +2974,7 @@
num_extra_guards = 0
while True:
op = self.history.operations[-1-num_extra_guards]
- if op.getopnum() == rop.CALL_MAY_FORCE:
+ if op.is_call_may_force():
break
assert op.is_guard()
num_extra_guards += 1
@@ -3004,29 +3003,31 @@
for i in range(cif_description.nargs):
kind, descr, itemsize = get_arg_descr(self.cpu,
cif_description.atypes[i])
+ ofs = cif_description.exchange_args[i]
+ assert ofs % itemsize == 0 # alignment check
if kind == 'i':
- box_arg = history.BoxInt()
+ box_arg = self.history.record(rop.GETARRAYITEM_RAW_I,
+ [box_exchange_buffer,
+ ConstInt(ofs // itemsize)],
+ 0, descr)
elif kind == 'f':
- box_arg = history.BoxFloat()
+ box_arg = self.history.record(rop.GETARRAYITEM_RAW_F,
+ [box_exchange_buffer,
+ ConstInt(ofs // itemsize)],
+ 0.0, descr)
else:
assert kind == 'v'
continue
- ofs = cif_description.exchange_args[i]
- assert ofs % itemsize == 0 # alignment check
- self.history.record(rop.GETARRAYITEM_RAW,
- [box_exchange_buffer,
- ConstInt(ofs // itemsize)],
- box_arg, descr)
arg_boxes.append(box_arg)
#
- box_result = op.result
# for now, any call via libffi saves and restores everything
# (that is, errno and SetLastError/GetLastError on Windows)
# Note these flags match the ones in clibffi.ll_callback
c_saveall = ConstInt(rffi.RFFI_ERR_ALL | rffi.RFFI_ALT_ERRNO)
- self.history.record(rop.CALL_RELEASE_GIL,
- [c_saveall, op.getarg(2)] + arg_boxes,
- box_result, calldescr)
+ if op.type == 'i':
+ self.history.record(rop.CALL_RELEASE_GIL,
+ [c_saveall, op.getarg(2)] + arg_boxes,
+ box_result, calldescr)
#
self.history.operations.extend(extra_guards)
#
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit