[pypy-commit] pypy py3.5: hg merge default
arigo
pypy.commits at gmail.com
Fri Feb 3 05:09:53 EST 2017
Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r89906:b96d7d91a143
Date: 2017-02-03 11:09 +0100
http://bitbucket.org/pypy/pypy/changeset/b96d7d91a143/
Log: hg merge default
diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py b/pypy/module/pypyjit/test_pypy_c/test_misc.py
--- a/pypy/module/pypyjit/test_pypy_c/test_misc.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py
@@ -235,7 +235,7 @@
i21 = getfield_gc_i(p17, descr=<FieldS .*W_Array.*.inst_len .*>)
i23 = int_lt(0, i21)
guard_true(i23, descr=...)
- i24 = getfield_gc_i(p17, descr=<FieldU .*W_ArrayTypei.inst_buffer .*>)
+ i24 = getfield_gc_i(p17, descr=<FieldU .*W_ArrayBase.inst__buffer .*>)
i25 = getarrayitem_raw_i(i24, 0, descr=<.*>)
i27 = int_lt(1, i21)
guard_false(i27, descr=...)
diff --git a/rpython/rlib/_rweakvaldict.py b/rpython/rlib/_rweakvaldict.py
--- a/rpython/rlib/_rweakvaldict.py
+++ b/rpython/rlib/_rweakvaldict.py
@@ -119,7 +119,7 @@
@jit.dont_look_inside
def ll_get(self, d, llkey):
if d.resize_counter < 0:
- self.ll_weakdict_resize(d) # initialize prebuilt dicts at runtime
+ self.ll_weakdict_rehash_after_translation(d)
hash = self.ll_keyhash(llkey)
i = rdict.ll_dict_lookup(d, llkey, hash) & rdict.MASK
#llop.debug_print(lltype.Void, i, 'get')
@@ -139,7 +139,7 @@
@jit.dont_look_inside
def ll_set_nonnull(self, d, llkey, llvalue):
if d.resize_counter < 0:
- self.ll_weakdict_resize(d) # initialize prebuilt dicts at runtime
+ self.ll_weakdict_rehash_after_translation(d)
hash = self.ll_keyhash(llkey)
valueref = weakref_create(llvalue) # GC effects here, before the rest
i = rdict.ll_dict_lookup(d, llkey, hash) & rdict.MASK
@@ -156,7 +156,7 @@
@jit.dont_look_inside
def ll_set_null(self, d, llkey):
if d.resize_counter < 0:
- self.ll_weakdict_resize(d) # initialize prebuilt dicts at runtime
+ self.ll_weakdict_rehash_after_translation(d)
hash = self.ll_keyhash(llkey)
i = rdict.ll_dict_lookup(d, llkey, hash) & rdict.MASK
if d.entries.everused(i):
@@ -180,6 +180,15 @@
d.num_items = num_items
rdict.ll_dict_resize(d)
+ def ll_weakdict_rehash_after_translation(self, d):
+ # recompute all hashes. See comment in rordereddict.py,
+ # ll_dict_rehash_after_translation().
+ entries = d.entries
+ for i in range(len(entries)):
+ self.ll_keyhash(entries[i].key)
+ self.ll_weakdict_resize(d)
+ assert d.resize_counter >= 0
+
def specialize_make_weakdict(hop):
hop.exception_cannot_occur()
v_d = hop.gendirectcall(hop.r_result.ll_new_weakdict)
diff --git a/rpython/rlib/debug.py b/rpython/rlib/debug.py
--- a/rpython/rlib/debug.py
+++ b/rpython/rlib/debug.py
@@ -446,8 +446,85 @@
time.sleep(1) # give the GDB time to attach
else:
+ def make_vs_attach_eci():
+ # The COM interface to the Debugger has to be compiled as a .cpp file by
+ # Visual C. So we generate the source and then add a commandline switch
+ # to treat this source file as C++
+ import os
+ eci = ExternalCompilationInfo(post_include_bits=["""
+#ifdef __cplusplus
+extern "C" {
+#endif
+RPY_EXPORTED void AttachToVS();
+#ifdef __cplusplus
+}
+#endif
+ """],
+ separate_module_sources=["""
+#import "libid:80cc9f66-e7d8-4ddd-85b6-d9e6cd0e93e2" version("8.0") lcid("0") raw_interfaces_only named_guids
+extern "C" RPY_EXPORTED void AttachToVS() {
+ CoInitialize(0);
+ HRESULT hr;
+ CLSID Clsid;
+
+ CLSIDFromProgID(L"VisualStudio.DTE", &Clsid);
+ IUnknown *Unknown;
+ if (FAILED(GetActiveObject(Clsid, 0, &Unknown))) {
+ puts("Could not attach to Visual Studio (is it not running?");
+ return;
+ }
+
+ EnvDTE::_DTE *Interface;
+ hr = Unknown->QueryInterface(&Interface);
+ if (FAILED(GetActiveObject(Clsid, 0, &Unknown))) {
+ puts("Could not open COM interface to Visual Studio (no permissions?)");
+ return;
+ }
+
+ EnvDTE::Debugger *Debugger;
+ puts("Waiting for Visual Studio Debugger to become idle");
+ while (FAILED(Interface->get_Debugger(&Debugger)));
+
+ EnvDTE::Processes *Processes;
+ while (FAILED(Debugger->get_LocalProcesses(&Processes)));
+
+ long Count = 0;
+ if (FAILED(Processes->get_Count(&Count))) {
+ puts("Cannot query Process count");
+ }
+
+ for (int i = 0; i <= Count; i++) {
+ EnvDTE::Process *Process;
+ if (FAILED(Processes->Item(variant_t(i), &Process))) {
+ continue;
+ }
+
+ long ProcessID;
+ while (FAILED(Process->get_ProcessID(&ProcessID)));
+
+ if (ProcessID == GetProcessId(GetCurrentProcess())) {
+ printf("Found process ID %d\\n", ProcessID);
+ Process->Attach();
+ Debugger->Break(false);
+ CoUninitialize();
+ return;
+ }
+ }
+}
+ """]
+ )
+ eci = eci.convert_sources_to_files()
+ d = eci._copy_attributes()
+ cfile = d['separate_module_files'][0]
+ cppfile = cfile.replace(".c", "_vsdebug.cpp")
+ os.rename(cfile, cppfile)
+ d['separate_module_files'] = [cppfile]
+ return ExternalCompilationInfo(**d)
+
+ ll_attach = rffi.llexternal("AttachToVS", [], lltype.Void,
+ compilation_info=make_vs_attach_eci())
def impl_attach_gdb():
- print "Don't know how to attach GDB on Windows"
+ ll_attach()
register_external(attach_gdb, [], result=None,
export_name="impl_attach_gdb", llimpl=impl_attach_gdb)
diff --git a/rpython/rlib/test/test_rweakvaldict.py b/rpython/rlib/test/test_rweakvaldict.py
--- a/rpython/rlib/test/test_rweakvaldict.py
+++ b/rpython/rlib/test/test_rweakvaldict.py
@@ -230,7 +230,7 @@
fc = compile(f, [], gcpolicy="boehm", rweakref=True)
fc()
-def _test_translation_prebuilt_2():
+def test_translation_prebuilt_2():
from rpython.rlib import rsiphash
d = RWeakValueDictionary(str, X)
k1 = "key1"; k2 = "key2"
diff --git a/rpython/translator/platform/windows.py b/rpython/translator/platform/windows.py
--- a/rpython/translator/platform/windows.py
+++ b/rpython/translator/platform/windows.py
@@ -379,9 +379,9 @@
no_precompile = []
for f in list(no_precompile_cfiles):
f = m.pathrel(py.path.local(f))
- if f not in no_precompile and f.endswith('.c'):
+ if f not in no_precompile and (f.endswith('.c') or f.endswith('.cpp')):
no_precompile.append(f)
- target = f[:-1] + 'obj'
+ target = f[:f.rfind('.')] + '.obj'
rules.append((target, f,
'$(CC) /nologo $(CFLAGS) $(CFLAGSEXTRA) '
'/Fo%s /c %s $(INCLUDEDIRS)' %(target, f)))
More information about the pypy-commit
mailing list