def _optimize_NEWSTR(self, op, mode):
     length_box = self.get_constant_box(op.getarg(0))
     if length_box and length_box.getint() <= MAX_CONST_LEN:
         # if the original 'op' did not have a ConstInt as argument,
         # build a new one with the ConstInt argument
         if not isinstance(op.getarg(0), ConstInt):
             op = ResOperation(mode.NEWSTR, [length_box], op.result)
         vvalue = self.make_vstring_plain(op.result, op, mode)
         vvalue.setup(length_box.getint())
     else:
         self.getvalue(op.result).ensure_nonnull()
         self.emit_operation(op)
         self.pure(mode.STRLEN, [op.result], op.getarg(0))
示例#2
0
文件: vstring.py 项目: Qointum/pypy
 def _optimize_NEWSTR(self, op, mode):
     length_box = self.get_constant_box(op.getarg(0))
     if length_box and length_box.getint() <= MAX_CONST_LEN:
         # if the original 'op' did not have a ConstInt as argument,
         # build a new one with the ConstInt argument
         if not isinstance(op.getarg(0), ConstInt):
             op = ResOperation(mode.NEWSTR, [length_box], op.result)
         vvalue = self.make_vstring_plain(op.result, op, mode)
         vvalue.setup(length_box.getint())
     else:
         self.getvalue(op.result).ensure_nonnull()
         self.emit_operation(op)
         self.pure(mode.STRLEN, [op.result], op.getarg(0))
示例#3
0
文件: simplify.py 项目: Darriall/pypy
 def optimize_VIRTUAL_REF(self, op):
     op = ResOperation(rop.SAME_AS, [op.getarg(0)], op.result)
     self.emit_operation(op)
示例#4
0
文件: simplify.py 项目: Qointum/pypy
 def optimize_VIRTUAL_REF(self, op):
     op = ResOperation(rop.SAME_AS, [op.getarg(0)], op.result)
     self.emit_operation(op)