Author: Amaury Forgeot d'Arc <[email protected]> Branch: more-rposix Changeset: r74346:6f17e9b7ff10 Date: 2014-11-05 18:41 +0100 http://bitbucket.org/pypy/pypy/changeset/6f17e9b7ff10/
Log: hg merge default diff --git a/README.rst b/README.rst --- a/README.rst +++ b/README.rst @@ -37,4 +37,4 @@ to use virtualenv with the resulting pypy-c as the interpreter; you can find more details about various installation schemes here: -http://doc.pypy.org/en/latest/getting-started.html#installing-pypy + http://doc.pypy.org/en/latest/install.html diff --git a/rpython/jit/metainterp/history.py b/rpython/jit/metainterp/history.py --- a/rpython/jit/metainterp/history.py +++ b/rpython/jit/metainterp/history.py @@ -279,7 +279,8 @@ # careful in this comparison: if self.value and other.value # are both NaN, stored as regular floats (i.e. on 64-bit), # then just using "==" would say False: two NaNs are always - # different from each other. + # different from each other. Conversely, "0.0 == -0.0" but + # they are not the same constant. return (longlong.extract_bits(self.value) == longlong.extract_bits(other.value)) return False diff --git a/rpython/rlib/objectmodel.py b/rpython/rlib/objectmodel.py --- a/rpython/rlib/objectmodel.py +++ b/rpython/rlib/objectmodel.py @@ -201,6 +201,11 @@ return result return decorator +def always_inline(func): + """ mark the function as to-be-inlined by the RPython optimizations (not + the JIT!), no matter its size.""" + func._always_inline_ = True + return func # ____________________________________________________________ diff --git a/rpython/rlib/test/test_objectmodel.py b/rpython/rlib/test/test_objectmodel.py --- a/rpython/rlib/test/test_objectmodel.py +++ b/rpython/rlib/test/test_objectmodel.py @@ -438,6 +438,11 @@ assert exc.value.message == "f argument 'b' must be of type <type 'str'>" py.test.raises(TypeError, "f('hello', 'world', 3)") +def test_always_inline(): + @always_inline + def f(a, b, c): + return a, b, c + assert f._always_inline_ == True def test_enforceargs_defaults(): @enforceargs(int, int) diff --git a/rpython/rtyper/module/ll_os.py b/rpython/rtyper/module/ll_os.py --- a/rpython/rtyper/module/ll_os.py +++ b/rpython/rtyper/module/ll_os.py @@ -22,8 +22,6 @@ from rpython.rtyper.tool import rffi_platform as platform from rpython.rlib import rposix from rpython.translator.tool.cbuild import ExternalCompilationInfo -from rpython.rtyper.lltypesystem.llmemory import itemoffsetof, offsetof -from rpython.rtyper.lltypesystem.rstr import STR from rpython.rlib.objectmodel import specialize from rpython.translator import cdir @@ -251,12 +249,9 @@ @registering_if(os, 'execv') def register_os_execv(self): - eci = self.gcc_profiling_bug_workaround( - 'RPY_EXPORTED_FOR_TESTS int _noprof_execv(char *path, char *argv[])', - 'return execv(path, argv);') - os_execv = self.llexternal('_noprof_execv', - [rffi.CCHARP, rffi.CCHARPP], - rffi.INT, compilation_info = eci) + os_execv = self.llexternal( + 'execv', + [rffi.CCHARP, rffi.CCHARPP], rffi.INT) def execv_llimpl(path, args): l_args = rffi.ll_liststr2charpp(args) @@ -270,12 +265,9 @@ @registering_if(os, 'execve') def register_os_execve(self): - eci = self.gcc_profiling_bug_workaround( - 'RPY_EXPORTED_FOR_TESTS int _noprof_execve(char *filename, char *argv[], char *envp[])', - 'return execve(filename, argv, envp);') os_execve = self.llexternal( - '_noprof_execve', [rffi.CCHARP, rffi.CCHARPP, rffi.CCHARPP], - rffi.INT, compilation_info = eci) + 'execve', + [rffi.CCHARP, rffi.CCHARPP, rffi.CCHARPP], rffi.INT) def execve_llimpl(path, args, env): # XXX Check path, args, env for \0 and raise TypeErrors as @@ -958,8 +950,6 @@ [rffi.INT, rffi.VOIDP, rffi.SIZE_T], rffi.SIZE_T) - offset = offsetof(STR, 'chars') + itemoffsetof(STR.chars, 0) - def os_read_llimpl(fd, count): if count < 0: raise OSError(errno.EINVAL, None) @@ -1684,10 +1674,7 @@ @registering_if(os, 'fork') def register_os_fork(self): from rpython.rlib import debug, rthread - eci = self.gcc_profiling_bug_workaround('RPY_EXPORTED_FOR_TESTS pid_t _noprof_fork(void)', - 'return fork();') - os_fork = self.llexternal('_noprof_fork', [], rffi.PID_T, - compilation_info = eci, + os_fork = self.llexternal('fork', [], rffi.PID_T, _nowrapper = True) def fork_llimpl(): @@ -1888,21 +1875,6 @@ return extdef([int], str, "ll_os.ttyname", llimpl=ttyname_llimpl) - # ____________________________________________________________ - # XXX horrible workaround for a bug of profiling in gcc on - # OS X with functions containing a direct call to some system calls - # like fork(), execv(), execve() - def gcc_profiling_bug_workaround(self, decl, body): - body = ('/*--no-profiling-for-this-file!--*/\n' - '#include "src/precommondefs.h"\n' - '%s {\n' - '\t%s\n' - '}\n' % (decl, body,)) - return ExternalCompilationInfo( - include_dirs=[cdir], - post_include_bits = [decl + ';'], - separate_module_sources = [body]) - # ____________________________________________________________ # Support for os.environ diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py --- a/rpython/translator/c/genc.py +++ b/rpython/translator/c/genc.py @@ -42,26 +42,7 @@ self.compiler = compiler def first(self): - platform = self.compiler.platform - if platform.name.startswith('darwin'): - # XXX incredible hack for darwin - STR = '/*--no-profiling-for-this-file!--*/' - no_prof = [] - prof = [] - for cfile in self.compiler.cfiles: - if STR in cfile.read(): - no_prof.append(cfile) - else: - prof.append(cfile) - p_eci = self.compiler.eci.merge( - ExternalCompilationInfo(compile_extra=['-fprofile-generate'], - link_extra=['-fprofile-generate'])) - ofiles = platform._compile_o_files(prof, p_eci) - _, eci = self.compiler.eci.get_module_files() - ofiles += platform._compile_o_files(no_prof, eci) - return platform._finish_linking(ofiles, p_eci, None, True) - else: - return self.build('-fprofile-generate') + return self.build('-fprofile-generate') def probe(self, exe, args): # 'args' is a single string typically containing spaces diff --git a/rpython/translator/platform/distutils_platform.py b/rpython/translator/platform/distutils_platform.py --- a/rpython/translator/platform/distutils_platform.py +++ b/rpython/translator/platform/distutils_platform.py @@ -127,14 +127,6 @@ for cfile in self.cfilenames: cfile = py.path.local(cfile) compile_extra = self.compile_extra[:] - # -frandom-seed is only to try to be as reproducable as possible - if 0 and self.fix_gcc_random_seed: - compile_extra.append('-frandom-seed=%s' % (cfile.basename,)) - # XXX horrible workaround for a bug of profiling in gcc on - # OS X with functions containing a direct call to fork() - if '/*--no-profiling-for-this-file!--*/' in cfile.read(): - compile_extra = [arg for arg in compile_extra - if not arg.startswith('-fprofile-')] old = cfile.dirpath().chdir() try: _______________________________________________ pypy-commit mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-commit
