[pypy-commit] pypy vmprof-newstack: fix that test

2016-01-22 Thread fijal
Author: fijal
Branch: vmprof-newstack
Changeset: r81915:900de81cdc5e
Date: 2016-01-22 15:11 +0100
http://bitbucket.org/pypy/pypy/changeset/900de81cdc5e/

Log:fix that test

diff --git a/rpython/jit/metainterp/test/test_recursive.py 
b/rpython/jit/metainterp/test/test_recursive.py
--- a/rpython/jit/metainterp/test/test_recursive.py
+++ b/rpython/jit/metainterp/test/test_recursive.py
@@ -1312,7 +1312,7 @@
 return (code + 1) * 2
 
 driver = JitDriver(greens=["pc", "code"], reds='auto',
-   get_unique_id=get_unique_id)
+   get_unique_id=get_unique_id, is_recursive=True)
 
 def f(pc, code):
 i = 0
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy vmprof-newstack: fix the test

2016-01-22 Thread fijal
Author: fijal
Branch: vmprof-newstack
Changeset: r81920:b5543f370125
Date: 2016-01-22 17:33 +0100
http://bitbucket.org/pypy/pypy/changeset/b5543f370125/

Log:fix the test

diff --git a/rpython/jit/metainterp/test/test_jitdriver.py 
b/rpython/jit/metainterp/test/test_jitdriver.py
--- a/rpython/jit/metainterp/test/test_jitdriver.py
+++ b/rpython/jit/metainterp/test/test_jitdriver.py
@@ -193,7 +193,7 @@
 return pc + 1
 
 driver = JitDriver(greens=["pc"], reds='auto',
-   get_unique_id=get_unique_id)
+   get_unique_id=get_unique_id, is_recursive=True)
 
 def f(arg):
 i = 0
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy vmprof-newstack: Fix for some tests: don't use .offset directly, call .getoffset()

2016-01-22 Thread arigo
Author: Armin Rigo 
Branch: vmprof-newstack
Changeset: r81918:fba43bc13dda
Date: 2016-01-22 16:41 +0100
http://bitbucket.org/pypy/pypy/changeset/fba43bc13dda/

Log:Fix for some tests: don't use .offset directly, call .getoffset()

diff --git a/rpython/jit/backend/x86/assembler.py 
b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -857,7 +857,8 @@
 # eax = address in the stack of a 3-words struct vmprof_stack_s
 self.mc.LEA_rs(eax.value, (FRAME_FIXED_SIZE - 4) * WORD)
 # old = current value of vmprof_tl_stack
-self.mc.MOV_rm(old.value, (tloc.value, cintf.vmprof_tl_stack.offset))
+offset = cintf.vmprof_tl_stack.getoffset()
+self.mc.MOV_rm(old.value, (tloc.value, offset))
 # eax->next = old
 self.mc.MOV_mr((eax.value, 0), old.value)
 # eax->value = my esp
@@ -865,7 +866,7 @@
 # eax->kind = VMPROF_JITTED_TAG
 self.mc.MOV_mi((eax.value, WORD * 2), VMPROF_JITTED_TAG)
 # save in vmprof_tl_stack the new eax
-self.mc.MOV_mr((tloc.value, cintf.vmprof_tl_stack.offset), eax.value)
+self.mc.MOV_mr((tloc.value, offset), eax.value)
 
 def _call_footer_vmprof(self):
 from rpython.rlib.rvmprof.rvmprof import cintf
@@ -874,7 +875,8 @@
 # eax = (our local vmprof_tl_stack).next
 self.mc.MOV_rs(eax.value, (FRAME_FIXED_SIZE - 4 + 0) * WORD)
 # save in vmprof_tl_stack the value eax
-self.mc.MOV_mr((edx.value, cintf.vmprof_tl_stack.offset), eax.value)
+offset = cintf.vmprof_tl_stack.getoffset()
+self.mc.MOV_mr((edx.value, offset), eax.value)
 
 def _call_header(self):
 self.mc.SUB_ri(esp.value, FRAME_FIXED_SIZE * WORD)
diff --git a/rpython/rlib/rthread.py b/rpython/rlib/rthread.py
--- a/rpython/rlib/rthread.py
+++ b/rpython/rlib/rthread.py
@@ -308,7 +308,7 @@
 offset = CDefinedIntSymbolic('RPY_TLOFS_%s' % self.fieldname,
  default='?')
 offset.loop_invariant = loop_invariant
-self.offset = offset
+self._offset = offset
 
 def getraw():
 if we_are_translated():
@@ -364,7 +364,7 @@
 ThreadLocalField.__init__(self, lltype.Signed, 'tlref%d' % unique_id,
   loop_invariant=loop_invariant)
 setraw = self.setraw
-offset = self.offset
+offset = self._offset
 
 def get():
 if we_are_translated():
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy vmprof-newstack: fix

2016-01-22 Thread arigo
Author: Armin Rigo 
Branch: vmprof-newstack
Changeset: r81919:e45af82e0252
Date: 2016-01-22 17:31 +0100
http://bitbucket.org/pypy/pypy/changeset/e45af82e0252/

Log:fix

diff --git a/rpython/jit/codewriter/test/test_jtransform.py 
b/rpython/jit/codewriter/test/test_jtransform.py
--- a/rpython/jit/codewriter/test/test_jtransform.py
+++ b/rpython/jit/codewriter/test/test_jtransform.py
@@ -1332,7 +1332,7 @@
 tlfield = ThreadLocalField(lltype.Signed, 'foobar_test_',
loop_invariant=loop_inv)
 OS_THREADLOCALREF_GET = effectinfo.EffectInfo.OS_THREADLOCALREF_GET
-c = const(tlfield.offset)
+c = const(tlfield.getoffset())
 v = varoftype(lltype.Signed)
 op = SpaceOperation('threadlocalref_get', [c], v)
 cc = FakeBuiltinCallControl()
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy vmprof-newstack: Fix massive leak :-)

2016-01-15 Thread arigo
Author: Armin Rigo 
Branch: vmprof-newstack
Changeset: r81786:e6e35c5fb24e
Date: 2016-01-15 11:16 +0100
http://bitbucket.org/pypy/pypy/changeset/e6e35c5fb24e/

Log:Fix massive leak :-)

diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py
--- a/rpython/rlib/rvmprof/cintf.py
+++ b/rpython/rlib/rvmprof/cintf.py
@@ -101,3 +101,4 @@
 
 def leave_code(s):
 vmprof_tl_stack.setraw(s.c_next)
+lltype.free(s, flavor='raw')
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy vmprof-newstack: fix tests

2016-01-15 Thread arigo
Author: Armin Rigo 
Branch: vmprof-newstack
Changeset: r81788:bcf38eb09571
Date: 2016-01-15 11:57 +0100
http://bitbucket.org/pypy/pypy/changeset/bcf38eb09571/

Log:fix tests

diff --git a/rpython/rlib/rvmprof/src/rvmprof.c 
b/rpython/rlib/rvmprof/src/rvmprof.c
--- a/rpython/rlib/rvmprof/src/rvmprof.c
+++ b/rpython/rlib/rvmprof/src/rvmprof.c
@@ -12,6 +12,8 @@
 #else
 
 #  include "common_header.h"
+#  include "structdef.h"
+#  include "src/threadlocal.h"
 #  include "rvmprof.h"
 /*#  ifndef VMPROF_ADDR_OF_TRAMPOLINE
 #   error "RPython program using rvmprof, but not calling 
vmprof_execute_code()"
diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h 
b/rpython/rlib/rvmprof/src/vmprof_main.h
--- a/rpython/rlib/rvmprof/src/vmprof_main.h
+++ b/rpython/rlib/rvmprof/src/vmprof_main.h
@@ -126,12 +126,18 @@
  * *
  */
 
-#include "src/threadlocal.h"
 
+#ifndef RPYTHON_LL2CTYPES
 static vmprof_stack_t *get_vmprof_stack(void)
 {
 return RPY_THREADLOCALREF_GET(vmprof_tl_stack);
 }
+#else
+static vmprof_stack_t *get_vmprof_stack(void)
+{
+return 0;
+}
+#endif
 
 static int get_stack_trace(intptr_t *result, int max_depth, intptr_t pc, 
ucontext_t *ucontext)
 {
diff --git a/rpython/rlib/rvmprof/src/vmprof_stack.h 
b/rpython/rlib/rvmprof/src/vmprof_stack.h
--- a/rpython/rlib/rvmprof/src/vmprof_stack.h
+++ b/rpython/rlib/rvmprof/src/vmprof_stack.h
@@ -1,3 +1,5 @@
+#ifndef _VMPROF_STACK_H_
+#define _VMPROF_STACK_H_
 
 #include 
 
@@ -19,3 +21,5 @@
 // to worry too much. There is a potential for squeezing it with bit
 // patterns into one WORD, but I don't want to care RIGHT NOW, potential
 // for future optimization potential
+
+#endif
diff --git a/rpython/rlib/rvmprof/test/test_ztranslation.py 
b/rpython/rlib/rvmprof/test/test_ztranslation.py
--- a/rpython/rlib/rvmprof/test/test_ztranslation.py
+++ b/rpython/rlib/rvmprof/test/test_ztranslation.py
@@ -64,8 +64,14 @@
 def test_interpreted():
 # takes forever if the Python process is already big...
 import subprocess
-subprocess.check_call([sys.executable, os.path.basename(__file__)],
-  cwd=(os.path.dirname(__file__) or '.'))
+me = os.path.basename(__file__)
+if me.endswith('pyc') or me.endswith('pyo'):
+me = me[:-1]
+env = os.environ.copy()
+env['PYTHONPATH'] = ''
+subprocess.check_call([sys.executable, me],
+  cwd=(os.path.dirname(__file__) or '.'),
+  env=env)
 
 def test_compiled():
 fn = compile(main, [], gcpolicy="minimark")
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy vmprof-newstack: Fix the jit to use thread-locals

2016-01-15 Thread arigo
Author: Armin Rigo 
Branch: vmprof-newstack
Changeset: r81789:195b2ba3887b
Date: 2016-01-15 12:35 +0100
http://bitbucket.org/pypy/pypy/changeset/195b2ba3887b/

Log:Fix the jit to use thread-locals

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
@@ -1,22 +1,22 @@
-
+import py
 from rpython.rlib import jit
 from rpython.rtyper.annlowlevel import llhelper
 from rpython.rtyper.lltypesystem import lltype, rffi
-from rpython.rlib.rvmprof import _get_vmprof
+from rpython.rlib.rvmprof import cintf
 from rpython.jit.backend.x86.arch import WORD
 from rpython.jit.codewriter.policy import JitPolicy
 
 class BaseRVMProfTest(object):
 def test_one(self):
+py.test.skip("needs thread-locals in the JIT, which is only available "
+ "after translation")
 visited = []
 
 def helper():
-stackp = _get_vmprof().cintf.vmprof_address_of_global_stack()[0]
-if stackp:
+stack = cintf.vmprof_tl_stack.getraw()
+if stack:
 # not during tracing
-stack = rffi.cast(rffi.CArrayPtr(lltype.Signed), stackp)
-item = rffi.cast(rffi.CArrayPtr(lltype.Signed), stack[1] - 
WORD)[0]
-visited.append(item)
+visited.append(stack.c_value)
 else:
 visited.append(0)
 
@@ -37,12 +37,13 @@
 
 hooks = Hooks()
 
-stackp = _get_vmprof().cintf.vmprof_address_of_global_stack()
-stackp[0] = 0 # make it empty
+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 stackp[0] == 0 # make sure we didn't leave anything dangling
+assert cintf.vmprof_tl_stack.getraw() == null
+# ^^^ make sure we didn't leave anything dangling
diff --git a/rpython/jit/backend/x86/arch.py b/rpython/jit/backend/x86/arch.py
--- a/rpython/jit/backend/x86/arch.py
+++ b/rpython/jit/backend/x86/arch.py
@@ -31,7 +31,7 @@
 
 if WORD == 4:
 # ebp + ebx + esi + edi + 15 extra words = 19 words
-FRAME_FIXED_SIZE = 19 + 4 # 4 for vmprof
+FRAME_FIXED_SIZE = 19 + 4 # 4 for vmprof, XXX make more compact!
 PASS_ON_MY_FRAME = 15
 JITFRAME_FIXED_SIZE = 6 + 8 * 2 # 6 GPR + 8 XMM * 2 WORDS/float
 # 'threadlocal_addr' is passed as 2nd argument on the stack,
@@ -41,7 +41,7 @@
 THREADLOCAL_OFS = (FRAME_FIXED_SIZE + 2) * WORD
 else:
 # rbp + rbx + r12 + r13 + r14 + r15 + threadlocal + 12 extra words = 19
-FRAME_FIXED_SIZE = 19 + 4 # 4 for vmprof
+FRAME_FIXED_SIZE = 19 + 4 # 4 for vmprof, XXX make more compact!
 PASS_ON_MY_FRAME = 12
 JITFRAME_FIXED_SIZE = 28 # 13 GPR + 15 XMM
 # 'threadlocal_addr' is passed as 2nd argument in %esi,
diff --git a/rpython/jit/backend/x86/assembler.py 
b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -40,7 +40,6 @@
 from rpython.jit.codewriter import longlong
 from rpython.rlib.rarithmetic import intmask, r_uint
 from rpython.rlib.objectmodel import compute_unique_id
-from rpython.rlib.rvmprof.rvmprof import _get_vmprof, VMPROF_JITTED_TAG
 
 
 class Assembler386(BaseAssembler, VectorAssemblerMixin):
@@ -839,28 +838,49 @@
 return frame_depth
 
 def _call_header_vmprof(self):
-stack = rffi.cast(lltype.Signed, 
_get_vmprof().cintf.vmprof_address_of_global_stack())
+from rpython.rlib.rvmprof.rvmprof import cintf, VMPROF_JITTED_TAG
+
+# tloc = address of pypy_threadlocal_s
+if IS_X86_32:
+# Can't use esi here, its old value is not saved yet.
+# But we can use eax and ecx.
+self.mc.MOV_rs(edx.value, THREADLOCAL_OFS)
+tloc = edx
+old = ecx
+else:
+# The thread-local value is already in esi.
+# We should avoid if possible to use ecx or edx because they
+# would be used to pass arguments #3 and #4 (even though, so
+# far, the assembler only receives two arguments).
+tloc = esi
+old = r11
+# eax = address in the stack of a 3-words struct vmprof_stack_s
 self.mc.LEA_rs(eax.value, (FRAME_FIXED_SIZE - 4) * WORD)
-# next
-self.mc.MOV(ecx, heap(stack))
-self.mc.MOV_mr((eax.value, 0), ecx.value)
-# value
+# old = current value of vmprof_tl_stack
+self.mc.MOV_rm(old.value, (tloc.value, cintf.vmprof_tl_stack.offset))
+# eax->next = old
+self.mc.MOV_mr((eax.value, 0), old.value)
+# eax->value = my esp
 

[pypy-commit] pypy vmprof-newstack: fix some tests

2016-01-15 Thread arigo
Author: Armin Rigo 
Branch: vmprof-newstack
Changeset: r81779:334e44a24a23
Date: 2016-01-15 10:02 +0100
http://bitbucket.org/pypy/pypy/changeset/334e44a24a23/

Log:fix some tests

diff --git a/rpython/memory/gctransform/shadowstack.py 
b/rpython/memory/gctransform/shadowstack.py
--- a/rpython/memory/gctransform/shadowstack.py
+++ b/rpython/memory/gctransform/shadowstack.py
@@ -315,7 +315,7 @@
 while addr != start:
 addr -= sizeofaddr
 gc._trace_callback(callback, arg, addr)
-
+
 gc = gctransformer.gcdata.gc
 assert not hasattr(gc, 'custom_trace_dispatcher')
 # ^^^ create_custom_trace_funcs() must not run before this
diff --git a/rpython/rlib/rvmprof/rvmprof.py b/rpython/rlib/rvmprof/rvmprof.py
--- a/rpython/rlib/rvmprof/rvmprof.py
+++ b/rpython/rlib/rvmprof/rvmprof.py
@@ -193,7 +193,7 @@
 if we_are_translated() and not jit.we_are_jitted():
 unique_id = get_code_fn(*args)._vmprof_unique_id
 ll_args, token = lower(*args)
-ll_trampoline = get_ll_trampoline(token, True)
+ll_trampoline = get_ll_trampoline(token)
 ll_result = ll_trampoline(*ll_args + (unique_id,))
 else:
 return func(*args)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy vmprof-newstack: fix fix fix

2016-01-11 Thread fijal
Author: fijal
Branch: vmprof-newstack
Changeset: r81674:a1dd8454d500
Date: 2016-01-11 20:45 +0200
http://bitbucket.org/pypy/pypy/changeset/a1dd8454d500/

Log:fix fix fix

diff --git a/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py 
b/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
--- a/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
+++ b/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
@@ -19,6 +19,7 @@
 from rpython.rlib import rvmprof
 
 class MyCode:
+_vmprof_unique_id = 0
 def __init__(self, name):
 self.name = name
 
@@ -26,14 +27,18 @@
 return code.name
 
 code2 = MyCode("py:y:foo:4")
+rvmprof.register_code(code2, get_name)
 
 try:
 rvmprof.register_code_object_class(MyCode, get_name)
 except rvmprof.VMProfPlatformUnsupported, e:
 py.test.skip(str(e))
 
+def get_unique_id(code):
+return rvmprof.get_unique_id(code)
+
 driver = JitDriver(greens = ['code'], reds = ['i', 's', 'num'],
-is_recursive=True)
+is_recursive=True, get_unique_id=get_unique_id)
 
 @rvmprof.vmprof_execute_code("xcode13", lambda code, num: code)
 def main(code, num):
@@ -45,7 +50,7 @@
 while i < num:
 driver.jit_merge_point(code=code, i=i, s=s, num=num)
 s += (i << 1)
-if s % 3 == 0 and code is not code2:
+if i % 3 == 0 and code is not code2:
 main(code2, 100)
 i += 1
 return s
@@ -72,7 +77,7 @@
 import pdb
 pdb.set_trace()
 
-self.meta_interp(f, [100])
+self.meta_interp(f, [100], inline=True)
 try:
 import vmprof
 except ImportError:
diff --git a/rpython/rlib/jit.py b/rpython/rlib/jit.py
--- a/rpython/rlib/jit.py
+++ b/rpython/rlib/jit.py
@@ -623,6 +623,8 @@
 raise AttributeError("no 'greens' or 'reds' supplied")
 if virtualizables is not None:
 self.virtualizables = virtualizables
+if get_unique_id is not None or is_recursive:
+assert get_unique_id is not None and is_recursive, "get_unique_id 
and is_recursive must be specified at the same time"
 for v in self.virtualizables:
 assert v in self.reds
 # if reds are automatic, they won't be passed to jit_merge_point, so
diff --git a/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h 
b/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h
--- a/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h
+++ b/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h
@@ -11,7 +11,7 @@
 #ifdef PYPY_JIT_CODEMAP
 void *codemap;
 long current_pos = 0;
-intptr_t id;
+intptr_t ident;
 long start_addr = 0;
 intptr_t addr = (intptr_t)ip;
 int start, k;
@@ -28,21 +28,22 @@
 result[n++] = start_addr;
 start = n;
 while (n < max_depth) {
-id = pypy_yield_codemap_at_addr(codemap, addr, _pos);
-if (id == -1)
+ident = pypy_yield_codemap_at_addr(codemap, addr, _pos);
+if (ident == -1)
 // finish
 break;
-if (id == 0)
+if (ident == 0)
 continue; // not main codemap
 result[n++] = VMPROF_JITTED_TAG;
-result[n++] = id;
+result[n++] = ident;
 }
-k = 0;
+k = 1;
+
 while (k < (n - start) / 2) {
 tmp = result[start + k];
-result[start + k] = result[n - k - 1];
-result[n - k - 1] = tmp;
-k++;
+result[start + k] = result[n - k];
+result[n - k] = tmp;
+k += 2;
 }
 #endif
 return n;
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy vmprof-newstack: fix translation

2016-01-10 Thread fijal
Author: fijal
Branch: vmprof-newstack
Changeset: r81656:f9c88ae567fd
Date: 2016-01-10 22:24 +0200
http://bitbucket.org/pypy/pypy/changeset/f9c88ae567fd/

Log:fix translation

diff --git a/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h 
b/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h
--- a/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h
+++ b/rpython/rlib/rvmprof/src/vmprof_get_custom_offset.h
@@ -8,6 +8,7 @@
 static long vmprof_write_header_for_jit_addr(intptr_t *result, long n,
  intptr_t ip, int max_depth)
 {
+#ifdef PYPY_JIT_CODEMAP
 void *codemap;
 long current_pos = 0;
 intptr_t id;
@@ -44,5 +45,6 @@
 result[n - k - 1] = tmp;
 k++;
 }
+#endif
 return n;
 }
diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h 
b/rpython/rlib/rvmprof/src/vmprof_main.h
--- a/rpython/rlib/rvmprof/src/vmprof_main.h
+++ b/rpython/rlib/rvmprof/src/vmprof_main.h
@@ -142,12 +142,14 @@
 intptr_t addr = 0;
 int bottom_jitted = 0;
 // check if the pc is in JIT
+#ifdef PYPY_JIT_CODEMAP
 if (pypy_find_codemap_at_addr((intptr_t)pc, )) {
 // the bottom part is jitted, means we can fill up the first part
 // from the JIT
 n = vmprof_write_header_for_jit_addr(result, n, pc, max_depth);
 stack = stack->next; // skip the first item as it contains garbage
 }
+#endif
 while (n < max_depth - 1 && stack) {
 result[n] = stack->kind;
 result[n + 1] = stack->value;
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy vmprof-newstack: Fix untranslated tests (hopefully without breaking translation)

2015-11-07 Thread arigo
Author: Armin Rigo 
Branch: vmprof-newstack
Changeset: r80580:a92f0641ba59
Date: 2015-11-07 19:29 +0100
http://bitbucket.org/pypy/pypy/changeset/a92f0641ba59/

Log:Fix untranslated tests (hopefully without breaking translation)

diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py
--- a/rpython/rlib/rvmprof/cintf.py
+++ b/rpython/rlib/rvmprof/cintf.py
@@ -14,30 +14,31 @@
 ROOT = py.path.local(rpythonroot).join('rpython', 'rlib', 'rvmprof')
 SRC = ROOT.join('src')
 
+if sys.platform.startswith('linux'):
+_libs = ['dl']
+else:
+_libs = []
+eci_kwds = dict(
+include_dirs = [SRC],
+includes = ['rvmprof.h'],
+libraries = _libs,
+separate_module_files = [SRC.join('rvmprof.c')],
+post_include_bits=['#define RPYTHON_VMPROF\n'],
+)
+global_eci = ExternalCompilationInfo(**eci_kwds)
+
+
 def setup():
 if not detect_cpu.autodetect().startswith(detect_cpu.MODEL_X86_64):
 raise VMProfPlatformUnsupported("rvmprof only supports"
 " x86-64 CPUs for now")
 
-if sys.platform.startswith('linux'):
-libs = ['dl']
-else:
-libs = []
-
-eci_kwds = dict(
-include_dirs = [SRC],
-includes = ['rvmprof.h'],
-libraries = libs,
-separate_module_files = [SRC.join('rvmprof.c')],
-post_include_bits=['#define RPYTHON_VMPROF\n'],
-)
-eci = ExternalCompilationInfo(**eci_kwds)
-
 platform.verify_eci(ExternalCompilationInfo(
 compile_extra=['-DRPYTHON_LL2CTYPES'],
 **eci_kwds))
 
 
+eci = global_eci
 vmprof_init = rffi.llexternal("vmprof_init",
   [rffi.INT, rffi.DOUBLE, rffi.CCHARP],
   rffi.CCHARP, compilation_info=eci)
@@ -102,6 +103,7 @@
 vmprof_stack_h = SRC.join("vmprof_stack.h").read()
 target = target.join('trampoline_%s_%s.vmprof.c' % (name, token))
 target.write("""
+#include "src/precommondefs.h"
 %(vmprof_stack_h)s
 
 %(type)s %(cont_name)s(%(llargs)s);
@@ -214,6 +216,7 @@
 post_include_bits = [header],
 separate_module_files = [str(target)],
 )
+eci = eci.merge(global_eci)
 
 ARGS = [token2lltype(tok) for tok in token] + [lltype.Signed]
 return rffi.llexternal(
diff --git a/rpython/rlib/rvmprof/src/vmprof_stack.h 
b/rpython/rlib/rvmprof/src/vmprof_stack.h
--- a/rpython/rlib/rvmprof/src/vmprof_stack.h
+++ b/rpython/rlib/rvmprof/src/vmprof_stack.h
@@ -4,4 +4,4 @@
 long value;
 } vmprof_stack;
 
-extern vmprof_stack* vmprof_global_stack;
\ No newline at end of file
+RPY_EXTERN vmprof_stack* vmprof_global_stack;
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit