Author: Alex Gaynor <alex.gay...@gmail.com> Branch: Changeset: r68624:690573814782 Date: 2014-01-12 09:44 -0800 http://bitbucket.org/pypy/pypy/changeset/690573814782/
Log: merged upstream diff --git a/rpython/config/translationoption.py b/rpython/config/translationoption.py --- a/rpython/config/translationoption.py +++ b/rpython/config/translationoption.py @@ -363,6 +363,10 @@ # if we have specified strange inconsistent settings. config.translation.gc = config.translation.gc + # disallow asmgcc on OS/X + if config.translation.gcrootfinder == "asmgcc": + assert sys.platform != "darwin" + # ---------------------------------------------------------------- def set_platform(config): diff --git a/rpython/translator/c/gcc/test/test_trackgcroot.py b/rpython/translator/c/gcc/test/test_trackgcroot.py --- a/rpython/translator/c/gcc/test/test_trackgcroot.py +++ b/rpython/translator/c/gcc/test/test_trackgcroot.py @@ -127,6 +127,8 @@ def check_computegcmaptable(format, path): if format == 'msvc': r_globallabel = re.compile(r"([\w]+)::") + elif format == 'darwin' or format == 'darwin64': + py.test.skip("disabled on OS/X's terribly old gcc") else: r_globallabel = re.compile(r"([\w]+)=[.]+") print diff --git a/rpython/translator/c/gcc/trackgcroot.py b/rpython/translator/c/gcc/trackgcroot.py --- a/rpython/translator/c/gcc/trackgcroot.py +++ b/rpython/translator/c/gcc/trackgcroot.py @@ -31,7 +31,7 @@ cls.r_binaryinsn = re.compile(r"\t[a-z]\w*\s+(?P<source>"+cls.OPERAND+"),\s*(?P<target>"+cls.OPERAND+")\s*$") cls.r_jump = re.compile(r"\tj\w+\s+"+cls.LABEL+"\s*" + cls.COMMENT + "$") - cls.r_jmp_switch = re.compile(r"\tjmp\t[*]"+cls.LABEL+"[(]") + cls.r_jmp_switch = re.compile(r"\tjmp\t[*]") cls.r_jmp_source = re.compile(r"\d*[(](%[\w]+)[,)]") def __init__(self, funcname, lines, filetag=0): @@ -697,10 +697,22 @@ tablelabels = [] match = self.r_jmp_switch.match(line) if match: - # this is a jmp *Label(%index), used for table-based switches. - # Assume that the table is just a list of lines looking like - # .long LABEL or .long 0, ending in a .text or .section .text.hot. - tablelabels.append(match.group(1)) + # this is a jmp *Label(%index) or jmp *%addr, used for + # table-based switches. Assume that the table is coming + # after a .section .rodata and a label, and is a list of + # lines looking like .long LABEL or .long 0 or .long L2-L1, + # ending in a .text or .section .text.hot. + lineno = self.currentlineno + 1 + if '.section' not in self.lines[lineno]: + pass # bah, probably a tail-optimized indirect call... + else: + assert '.rodata' in self.lines[lineno] + lineno += 1 + while '.align' in self.lines[lineno]: + lineno += 1 + match = self.r_label.match(self.lines[lineno]) + assert match, repr(self.lines[lineno]) + tablelabels.append(match.group(1)) elif self.r_unaryinsn_star.match(line): # maybe a jmp similar to the above, but stored in a # registry: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit