def run(self, code): space = FakeSpace() def f(code): interp = numpy_compile(hlstr(code)) interp.run(space) res = interp.results[-1] w_res = res.eval(0).wrap(interp.space) if isinstance(w_res, BoolObject): return float(w_res.boolval) elif isinstance(w_res, FloatObject): return w_res.floatval elif isinstance(w_res, IntObject): return w_res.intval else: return -42. if self.graph is None: interp, graph = self.meta_interp(f, [llstr(code)], listops=True, backendopt=True, graph_and_interp_only=True) self.__class__.interp = interp self.__class__.graph = graph reset_stats() pyjitpl._warmrunnerdesc.memory_manager.alive_loops.clear() return self.interp.eval_graph(self.graph, [llstr(code)])
def run(self, name): space = FakeSpace() i = self.code_mapping[name] codes = self.codes def f(i): interp = InterpreterState(codes[i]) interp.run(space) if not len(interp.results): raise Exception("need results") w_res = interp.results[-1] if isinstance(w_res, BaseArray): concr = w_res.get_concrete_or_scalar() sig = concr.find_sig() frame = sig.create_frame(concr) w_res = sig.eval(frame, concr) if isinstance(w_res, interp_boxes.W_Float64Box): return w_res.value if isinstance(w_res, interp_boxes.W_Int64Box): return float(w_res.value) elif isinstance(w_res, interp_boxes.W_BoolBox): return float(w_res.value) raise TypeError(w_res) if self.graph is None: interp, graph = self.meta_interp(f, [i], listops=True, backendopt=True, graph_and_interp_only=True) self.__class__.interp = interp self.__class__.graph = graph reset_stats() pyjitpl._warmrunnerdesc.memory_manager.alive_loops.clear() return self.interp.eval_graph(self.graph, [i])
def run(self, name): space = FakeSpace() i = self.code_mapping[name] codes = self.codes def f(i): interp = InterpreterState(codes[i]) interp.run(space) res = interp.results[-1] w_res = res.eval(res.start_iter()).wrap(interp.space) if isinstance(w_res, BoolObject): return float(w_res.boolval) elif isinstance(w_res, FloatObject): return w_res.floatval elif isinstance(w_res, IntObject): return w_res.intval else: return -42. if self.graph is None: interp, graph = self.meta_interp(f, [i], listops=True, backendopt=True, graph_and_interp_only=True) self.__class__.interp = interp self.__class__.graph = graph reset_stats() pyjitpl._warmrunnerdesc.memory_manager.alive_loops.clear() return self.interp.eval_graph(self.graph, [i])