Author: fijal
Branch:
Changeset: r86028:cb1aff2e4d19
Date: 2016-08-05 15:37 +0200
http://bitbucket.org/pypy/pypy/changeset/cb1aff2e4d19/
Log: improve the test, still failing
diff --git a/rpython/jit/backend/test/test_rvmprof.py
b/rpython/jit/backend/test/test_rvmprof.py
--- a/rpython/jit/backend/test/test_rvmprof.py
+++ b/rpython/jit/backend/test/test_rvmprof.py
@@ -2,7 +2,8 @@
from rpython.rlib import jit
from rpython.rtyper.annlowlevel import llhelper
from rpython.rtyper.lltypesystem import lltype, rffi
-from rpython.rlib.rvmprof import cintf
+from rpython.rlib.rvmprof import cintf, vmprof_execute_code, register_code,\
+ register_code_object_class, _get_vmprof
from rpython.jit.backend.x86.arch import WORD
from rpython.jit.codewriter.policy import JitPolicy
@@ -14,6 +15,7 @@
def helper():
stack = cintf.vmprof_tl_stack.getraw()
+ print stack
if stack:
# not during tracing
visited.append(stack.c_value)
@@ -22,15 +24,34 @@
llfn = llhelper(lltype.Ptr(lltype.FuncType([], lltype.Void)), helper)
- driver = jit.JitDriver(greens=[], reds='auto')
+ driver = jit.JitDriver(greens=['code'], reds='auto')
- def f(n):
+ class CodeObj(object):
+ pass
+
+ def get_code_fn(code, arg):
+ return code
+
+ def get_name(code):
+ return "foo"
+
+ register_code_object_class(CodeObj, get_name)
+
+ @vmprof_execute_code("main", get_code_fn)
+ def f(code, n):
i = 0
while i < n:
- driver.jit_merge_point()
+ driver.jit_merge_point(code=code)
i += 1
llfn()
+ def main(n):
+ cintf.vmprof_tl_stack.setraw(null) # make it empty
+ vmprof = _get_vmprof()
+ code = CodeObj()
+ register_code(code, get_name)
+ return f(code, n)
+
class Hooks(jit.JitHookInterface):
def after_compile(self, debug_info):
self.raw_start = debug_info.asminfo.rawstart
@@ -38,12 +59,12 @@
hooks = Hooks()
null = lltype.nullptr(cintf.VMPROFSTACK)
- cintf.vmprof_tl_stack.setraw(null) # make it empty
- self.meta_interp(f, [10], policy=JitPolicy(hooks))
- v = set(visited)
- assert 0 in v
- v.remove(0)
- assert len(v) == 1
- assert 0 <= list(v)[0] - hooks.raw_start <= 10*1024
- assert cintf.vmprof_tl_stack.getraw() == null
+ self.meta_interp(main, [10], policy=JitPolicy(hooks))
+ print visited
+ #v = set(visited)
+ #assert 0 in v
+ #v.remove(0)
+ #assert len(v) == 1
+ #assert 0 <= list(v)[0] - hooks.raw_start <= 10*1024
+ #assert cintf.vmprof_tl_stack.getraw() == null
# ^^^ make sure we didn't leave anything dangling
diff --git a/rpython/jit/backend/x86/test/test_rvmprof.py
b/rpython/jit/backend/x86/test/test_rvmprof.py
--- a/rpython/jit/backend/x86/test/test_rvmprof.py
+++ b/rpython/jit/backend/x86/test/test_rvmprof.py
@@ -3,5 +3,5 @@
from rpython.jit.backend.test.test_rvmprof import BaseRVMProfTest
from rpython.jit.backend.x86.test.test_basic import Jit386Mixin
-class TestFfiCall(Jit386Mixin, BaseRVMProfTest):
- pass
\ No newline at end of file
+class TestRVMProfCall(Jit386Mixin, BaseRVMProfTest):
+ pass
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit