Author: Armin Rigo <[email protected]>
Branch:
Changeset: r82106:90f38a4668e2
Date: 2016-02-07 14:34 +0100
http://bitbucket.org/pypy/pypy/changeset/90f38a4668e2/
Log: merge heads
diff too long, truncating to 2000 out of 3793 lines
diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -75,6 +75,7 @@
^lib_pypy/__pycache__$
^lib_pypy/ctypes_config_cache/_.+_cache\.py$
^lib_pypy/ctypes_config_cache/_.+_.+_\.py$
+^lib_pypy/_libmpdec/.+.o$
^rpython/translator/cli/query-descriptions$
^pypy/doc/discussion/.+\.html$
^include/.+\.h$
diff --git a/dotviewer/drawgraph.py b/dotviewer/drawgraph.py
--- a/dotviewer/drawgraph.py
+++ b/dotviewer/drawgraph.py
@@ -14,12 +14,661 @@
FONT = os.path.join(this_dir, 'font', 'DroidSans.ttf')
FIXEDFONT = os.path.join(this_dir, 'font', 'DroidSansMono.ttf')
COLOR = {
- 'black': (0,0,0),
- 'white': (255,255,255),
- 'red': (255,0,0),
- 'green': (0,255,0),
- 'blue': (0,0,255),
- 'yellow': (255,255,0),
+ 'aliceblue': (240, 248, 255),
+ 'antiquewhite': (250, 235, 215),
+ 'antiquewhite1': (255, 239, 219),
+ 'antiquewhite2': (238, 223, 204),
+ 'antiquewhite3': (205, 192, 176),
+ 'antiquewhite4': (139, 131, 120),
+ 'aquamarine': (127, 255, 212),
+ 'aquamarine1': (127, 255, 212),
+ 'aquamarine2': (118, 238, 198),
+ 'aquamarine3': (102, 205, 170),
+ 'aquamarine4': (69, 139, 116),
+ 'azure': (240, 255, 255),
+ 'azure1': (240, 255, 255),
+ 'azure2': (224, 238, 238),
+ 'azure3': (193, 205, 205),
+ 'azure4': (131, 139, 139),
+ 'beige': (245, 245, 220),
+ 'bisque': (255, 228, 196),
+ 'bisque1': (255, 228, 196),
+ 'bisque2': (238, 213, 183),
+ 'bisque3': (205, 183, 158),
+ 'bisque4': (139, 125, 107),
+ 'black': (0, 0, 0),
+ 'blanchedalmond': (255, 235, 205),
+ 'blue': (0, 0, 255),
+ 'blue1': (0, 0, 255),
+ 'blue2': (0, 0, 238),
+ 'blue3': (0, 0, 205),
+ 'blue4': (0, 0, 139),
+ 'blueviolet': (138, 43, 226),
+ 'brown': (165, 42, 42),
+ 'brown1': (255, 64, 64),
+ 'brown2': (238, 59, 59),
+ 'brown3': (205, 51, 51),
+ 'brown4': (139, 35, 35),
+ 'burlywood': (222, 184, 135),
+ 'burlywood1': (255, 211, 155),
+ 'burlywood2': (238, 197, 145),
+ 'burlywood3': (205, 170, 125),
+ 'burlywood4': (139, 115, 85),
+ 'cadetblue': (95, 158, 160),
+ 'cadetblue1': (152, 245, 255),
+ 'cadetblue2': (142, 229, 238),
+ 'cadetblue3': (122, 197, 205),
+ 'cadetblue4': (83, 134, 139),
+ 'chartreuse': (127, 255, 0),
+ 'chartreuse1': (127, 255, 0),
+ 'chartreuse2': (118, 238, 0),
+ 'chartreuse3': (102, 205, 0),
+ 'chartreuse4': (69, 139, 0),
+ 'chocolate': (210, 105, 30),
+ 'chocolate1': (255, 127, 36),
+ 'chocolate2': (238, 118, 33),
+ 'chocolate3': (205, 102, 29),
+ 'chocolate4': (139, 69, 19),
+ 'coral': (255, 127, 80),
+ 'coral1': (255, 114, 86),
+ 'coral2': (238, 106, 80),
+ 'coral3': (205, 91, 69),
+ 'coral4': (139, 62, 47),
+ 'cornflowerblue': (100, 149, 237),
+ 'cornsilk': (255, 248, 220),
+ 'cornsilk1': (255, 248, 220),
+ 'cornsilk2': (238, 232, 205),
+ 'cornsilk3': (205, 200, 177),
+ 'cornsilk4': (139, 136, 120),
+ 'crimson': (220, 20, 60),
+ 'cyan': (0, 255, 255),
+ 'cyan1': (0, 255, 255),
+ 'cyan2': (0, 238, 238),
+ 'cyan3': (0, 205, 205),
+ 'cyan4': (0, 139, 139),
+ 'darkgoldenrod': (184, 134, 11),
+ 'darkgoldenrod1': (255, 185, 15),
+ 'darkgoldenrod2': (238, 173, 14),
+ 'darkgoldenrod3': (205, 149, 12),
+ 'darkgoldenrod4': (139, 101, 8),
+ 'darkgreen': (0, 100, 0),
+ 'darkkhaki': (189, 183, 107),
+ 'darkolivegreen': (85, 107, 47),
+ 'darkolivegreen1': (202, 255, 112),
+ 'darkolivegreen2': (188, 238, 104),
+ 'darkolivegreen3': (162, 205, 90),
+ 'darkolivegreen4': (110, 139, 61),
+ 'darkorange': (255, 140, 0),
+ 'darkorange1': (255, 127, 0),
+ 'darkorange2': (238, 118, 0),
+ 'darkorange3': (205, 102, 0),
+ 'darkorange4': (139, 69, 0),
+ 'darkorchid': (153, 50, 204),
+ 'darkorchid1': (191, 62, 255),
+ 'darkorchid2': (178, 58, 238),
+ 'darkorchid3': (154, 50, 205),
+ 'darkorchid4': (104, 34, 139),
+ 'darksalmon': (233, 150, 122),
+ 'darkseagreen': (143, 188, 143),
+ 'darkseagreen1': (193, 255, 193),
+ 'darkseagreen2': (180, 238, 180),
+ 'darkseagreen3': (155, 205, 155),
+ 'darkseagreen4': (105, 139, 105),
+ 'darkslateblue': (72, 61, 139),
+ 'darkslategray': (47, 79, 79),
+ 'darkslategray1': (151, 255, 255),
+ 'darkslategray2': (141, 238, 238),
+ 'darkslategray3': (121, 205, 205),
+ 'darkslategray4': (82, 139, 139),
+ 'darkslategrey': (47, 79, 79),
+ 'darkturquoise': (0, 206, 209),
+ 'darkviolet': (148, 0, 211),
+ 'deeppink': (255, 20, 147),
+ 'deeppink1': (255, 20, 147),
+ 'deeppink2': (238, 18, 137),
+ 'deeppink3': (205, 16, 118),
+ 'deeppink4': (139, 10, 80),
+ 'deepskyblue': (0, 191, 255),
+ 'deepskyblue1': (0, 191, 255),
+ 'deepskyblue2': (0, 178, 238),
+ 'deepskyblue3': (0, 154, 205),
+ 'deepskyblue4': (0, 104, 139),
+ 'dimgray': (105, 105, 105),
+ 'dimgrey': (105, 105, 105),
+ 'dodgerblue': (30, 144, 255),
+ 'dodgerblue1': (30, 144, 255),
+ 'dodgerblue2': (28, 134, 238),
+ 'dodgerblue3': (24, 116, 205),
+ 'dodgerblue4': (16, 78, 139),
+ 'firebrick': (178, 34, 34),
+ 'firebrick1': (255, 48, 48),
+ 'firebrick2': (238, 44, 44),
+ 'firebrick3': (205, 38, 38),
+ 'firebrick4': (139, 26, 26),
+ 'floralwhite': (255, 250, 240),
+ 'forestgreen': (34, 139, 34),
+ 'gainsboro': (220, 220, 220),
+ 'ghostwhite': (248, 248, 255),
+ 'gold': (255, 215, 0),
+ 'gold1': (255, 215, 0),
+ 'gold2': (238, 201, 0),
+ 'gold3': (205, 173, 0),
+ 'gold4': (139, 117, 0),
+ 'goldenrod': (218, 165, 32),
+ 'goldenrod1': (255, 193, 37),
+ 'goldenrod2': (238, 180, 34),
+ 'goldenrod3': (205, 155, 29),
+ 'goldenrod4': (139, 105, 20),
+ 'gray': (192, 192, 192),
+ 'gray0': (0, 0, 0),
+ 'gray1': (3, 3, 3),
+ 'gray10': (26, 26, 26),
+ 'gray100': (255, 255, 255),
+ 'gray11': (28, 28, 28),
+ 'gray12': (31, 31, 31),
+ 'gray13': (33, 33, 33),
+ 'gray14': (36, 36, 36),
+ 'gray15': (38, 38, 38),
+ 'gray16': (41, 41, 41),
+ 'gray17': (43, 43, 43),
+ 'gray18': (46, 46, 46),
+ 'gray19': (48, 48, 48),
+ 'gray2': (5, 5, 5),
+ 'gray20': (51, 51, 51),
+ 'gray21': (54, 54, 54),
+ 'gray22': (56, 56, 56),
+ 'gray23': (59, 59, 59),
+ 'gray24': (61, 61, 61),
+ 'gray25': (64, 64, 64),
+ 'gray26': (66, 66, 66),
+ 'gray27': (69, 69, 69),
+ 'gray28': (71, 71, 71),
+ 'gray29': (74, 74, 74),
+ 'gray3': (8, 8, 8),
+ 'gray30': (77, 77, 77),
+ 'gray31': (79, 79, 79),
+ 'gray32': (82, 82, 82),
+ 'gray33': (84, 84, 84),
+ 'gray34': (87, 87, 87),
+ 'gray35': (89, 89, 89),
+ 'gray36': (92, 92, 92),
+ 'gray37': (94, 94, 94),
+ 'gray38': (97, 97, 97),
+ 'gray39': (99, 99, 99),
+ 'gray4': (10, 10, 10),
+ 'gray40': (102, 102, 102),
+ 'gray41': (105, 105, 105),
+ 'gray42': (107, 107, 107),
+ 'gray43': (110, 110, 110),
+ 'gray44': (112, 112, 112),
+ 'gray45': (115, 115, 115),
+ 'gray46': (117, 117, 117),
+ 'gray47': (120, 120, 120),
+ 'gray48': (122, 122, 122),
+ 'gray49': (125, 125, 125),
+ 'gray5': (13, 13, 13),
+ 'gray50': (127, 127, 127),
+ 'gray51': (130, 130, 130),
+ 'gray52': (133, 133, 133),
+ 'gray53': (135, 135, 135),
+ 'gray54': (138, 138, 138),
+ 'gray55': (140, 140, 140),
+ 'gray56': (143, 143, 143),
+ 'gray57': (145, 145, 145),
+ 'gray58': (148, 148, 148),
+ 'gray59': (150, 150, 150),
+ 'gray6': (15, 15, 15),
+ 'gray60': (153, 153, 153),
+ 'gray61': (156, 156, 156),
+ 'gray62': (158, 158, 158),
+ 'gray63': (161, 161, 161),
+ 'gray64': (163, 163, 163),
+ 'gray65': (166, 166, 166),
+ 'gray66': (168, 168, 168),
+ 'gray67': (171, 171, 171),
+ 'gray68': (173, 173, 173),
+ 'gray69': (176, 176, 176),
+ 'gray7': (18, 18, 18),
+ 'gray70': (179, 179, 179),
+ 'gray71': (181, 181, 181),
+ 'gray72': (184, 184, 184),
+ 'gray73': (186, 186, 186),
+ 'gray74': (189, 189, 189),
+ 'gray75': (191, 191, 191),
+ 'gray76': (194, 194, 194),
+ 'gray77': (196, 196, 196),
+ 'gray78': (199, 199, 199),
+ 'gray79': (201, 201, 201),
+ 'gray8': (20, 20, 20),
+ 'gray80': (204, 204, 204),
+ 'gray81': (207, 207, 207),
+ 'gray82': (209, 209, 209),
+ 'gray83': (212, 212, 212),
+ 'gray84': (214, 214, 214),
+ 'gray85': (217, 217, 217),
+ 'gray86': (219, 219, 219),
+ 'gray87': (222, 222, 222),
+ 'gray88': (224, 224, 224),
+ 'gray89': (227, 227, 227),
+ 'gray9': (23, 23, 23),
+ 'gray90': (229, 229, 229),
+ 'gray91': (232, 232, 232),
+ 'gray92': (235, 235, 235),
+ 'gray93': (237, 237, 237),
+ 'gray94': (240, 240, 240),
+ 'gray95': (242, 242, 242),
+ 'gray96': (245, 245, 245),
+ 'gray97': (247, 247, 247),
+ 'gray98': (250, 250, 250),
+ 'gray99': (252, 252, 252),
+ 'green': (0, 255, 0),
+ 'green1': (0, 255, 0),
+ 'green2': (0, 238, 0),
+ 'green3': (0, 205, 0),
+ 'green4': (0, 139, 0),
+ 'greenyellow': (173, 255, 47),
+ 'grey': (192, 192, 192),
+ 'grey0': (0, 0, 0),
+ 'grey1': (3, 3, 3),
+ 'grey10': (26, 26, 26),
+ 'grey100': (255, 255, 255),
+ 'grey11': (28, 28, 28),
+ 'grey12': (31, 31, 31),
+ 'grey13': (33, 33, 33),
+ 'grey14': (36, 36, 36),
+ 'grey15': (38, 38, 38),
+ 'grey16': (41, 41, 41),
+ 'grey17': (43, 43, 43),
+ 'grey18': (46, 46, 46),
+ 'grey19': (48, 48, 48),
+ 'grey2': (5, 5, 5),
+ 'grey20': (51, 51, 51),
+ 'grey21': (54, 54, 54),
+ 'grey22': (56, 56, 56),
+ 'grey23': (59, 59, 59),
+ 'grey24': (61, 61, 61),
+ 'grey25': (64, 64, 64),
+ 'grey26': (66, 66, 66),
+ 'grey27': (69, 69, 69),
+ 'grey28': (71, 71, 71),
+ 'grey29': (74, 74, 74),
+ 'grey3': (8, 8, 8),
+ 'grey30': (77, 77, 77),
+ 'grey31': (79, 79, 79),
+ 'grey32': (82, 82, 82),
+ 'grey33': (84, 84, 84),
+ 'grey34': (87, 87, 87),
+ 'grey35': (89, 89, 89),
+ 'grey36': (92, 92, 92),
+ 'grey37': (94, 94, 94),
+ 'grey38': (97, 97, 97),
+ 'grey39': (99, 99, 99),
+ 'grey4': (10, 10, 10),
+ 'grey40': (102, 102, 102),
+ 'grey41': (105, 105, 105),
+ 'grey42': (107, 107, 107),
+ 'grey43': (110, 110, 110),
+ 'grey44': (112, 112, 112),
+ 'grey45': (115, 115, 115),
+ 'grey46': (117, 117, 117),
+ 'grey47': (120, 120, 120),
+ 'grey48': (122, 122, 122),
+ 'grey49': (125, 125, 125),
+ 'grey5': (13, 13, 13),
+ 'grey50': (127, 127, 127),
+ 'grey51': (130, 130, 130),
+ 'grey52': (133, 133, 133),
+ 'grey53': (135, 135, 135),
+ 'grey54': (138, 138, 138),
+ 'grey55': (140, 140, 140),
+ 'grey56': (143, 143, 143),
+ 'grey57': (145, 145, 145),
+ 'grey58': (148, 148, 148),
+ 'grey59': (150, 150, 150),
+ 'grey6': (15, 15, 15),
+ 'grey60': (153, 153, 153),
+ 'grey61': (156, 156, 156),
+ 'grey62': (158, 158, 158),
+ 'grey63': (161, 161, 161),
+ 'grey64': (163, 163, 163),
+ 'grey65': (166, 166, 166),
+ 'grey66': (168, 168, 168),
+ 'grey67': (171, 171, 171),
+ 'grey68': (173, 173, 173),
+ 'grey69': (176, 176, 176),
+ 'grey7': (18, 18, 18),
+ 'grey70': (179, 179, 179),
+ 'grey71': (181, 181, 181),
+ 'grey72': (184, 184, 184),
+ 'grey73': (186, 186, 186),
+ 'grey74': (189, 189, 189),
+ 'grey75': (191, 191, 191),
+ 'grey76': (194, 194, 194),
+ 'grey77': (196, 196, 196),
+ 'grey78': (199, 199, 199),
+ 'grey79': (201, 201, 201),
+ 'grey8': (20, 20, 20),
+ 'grey80': (204, 204, 204),
+ 'grey81': (207, 207, 207),
+ 'grey82': (209, 209, 209),
+ 'grey83': (212, 212, 212),
+ 'grey84': (214, 214, 214),
+ 'grey85': (217, 217, 217),
+ 'grey86': (219, 219, 219),
+ 'grey87': (222, 222, 222),
+ 'grey88': (224, 224, 224),
+ 'grey89': (227, 227, 227),
+ 'grey9': (23, 23, 23),
+ 'grey90': (229, 229, 229),
+ 'grey91': (232, 232, 232),
+ 'grey92': (235, 235, 235),
+ 'grey93': (237, 237, 237),
+ 'grey94': (240, 240, 240),
+ 'grey95': (242, 242, 242),
+ 'grey96': (245, 245, 245),
+ 'grey97': (247, 247, 247),
+ 'grey98': (250, 250, 250),
+ 'grey99': (252, 252, 252),
+ 'honeydew': (240, 255, 240),
+ 'honeydew1': (240, 255, 240),
+ 'honeydew2': (224, 238, 224),
+ 'honeydew3': (193, 205, 193),
+ 'honeydew4': (131, 139, 131),
+ 'hotpink': (255, 105, 180),
+ 'hotpink1': (255, 110, 180),
+ 'hotpink2': (238, 106, 167),
+ 'hotpink3': (205, 96, 144),
+ 'hotpink4': (139, 58, 98),
+ 'indianred': (205, 92, 92),
+ 'indianred1': (255, 106, 106),
+ 'indianred2': (238, 99, 99),
+ 'indianred3': (205, 85, 85),
+ 'indianred4': (139, 58, 58),
+ 'indigo': (75, 0, 130),
+ 'invis': (255, 255, 254),
+ 'ivory': (255, 255, 240),
+ 'ivory1': (255, 255, 240),
+ 'ivory2': (238, 238, 224),
+ 'ivory3': (205, 205, 193),
+ 'ivory4': (139, 139, 131),
+ 'khaki': (240, 230, 140),
+ 'khaki1': (255, 246, 143),
+ 'khaki2': (238, 230, 133),
+ 'khaki3': (205, 198, 115),
+ 'khaki4': (139, 134, 78),
+ 'lavender': (230, 230, 250),
+ 'lavenderblush': (255, 240, 245),
+ 'lavenderblush1': (255, 240, 245),
+ 'lavenderblush2': (238, 224, 229),
+ 'lavenderblush3': (205, 193, 197),
+ 'lavenderblush4': (139, 131, 134),
+ 'lawngreen': (124, 252, 0),
+ 'lemonchiffon': (255, 250, 205),
+ 'lemonchiffon1': (255, 250, 205),
+ 'lemonchiffon2': (238, 233, 191),
+ 'lemonchiffon3': (205, 201, 165),
+ 'lemonchiffon4': (139, 137, 112),
+ 'lightblue': (173, 216, 230),
+ 'lightblue1': (191, 239, 255),
+ 'lightblue2': (178, 223, 238),
+ 'lightblue3': (154, 192, 205),
+ 'lightblue4': (104, 131, 139),
+ 'lightcoral': (240, 128, 128),
+ 'lightcyan': (224, 255, 255),
+ 'lightcyan1': (224, 255, 255),
+ 'lightcyan2': (209, 238, 238),
+ 'lightcyan3': (180, 205, 205),
+ 'lightcyan4': (122, 139, 139),
+ 'lightgoldenrod': (238, 221, 130),
+ 'lightgoldenrod1': (255, 236, 139),
+ 'lightgoldenrod2': (238, 220, 130),
+ 'lightgoldenrod3': (205, 190, 112),
+ 'lightgoldenrod4': (139, 129, 76),
+ 'lightgoldenrodyellow': (250, 250, 210),
+ 'lightgray': (211, 211, 211),
+ 'lightgrey': (211, 211, 211),
+ 'lightpink': (255, 182, 193),
+ 'lightpink1': (255, 174, 185),
+ 'lightpink2': (238, 162, 173),
+ 'lightpink3': (205, 140, 149),
+ 'lightpink4': (139, 95, 101),
+ 'lightsalmon': (255, 160, 122),
+ 'lightsalmon1': (255, 160, 122),
+ 'lightsalmon2': (238, 149, 114),
+ 'lightsalmon3': (205, 129, 98),
+ 'lightsalmon4': (139, 87, 66),
+ 'lightseagreen': (32, 178, 170),
+ 'lightskyblue': (135, 206, 250),
+ 'lightskyblue1': (176, 226, 255),
+ 'lightskyblue2': (164, 211, 238),
+ 'lightskyblue3': (141, 182, 205),
+ 'lightskyblue4': (96, 123, 139),
+ 'lightslateblue': (132, 112, 255),
+ 'lightslategray': (119, 136, 153),
+ 'lightslategrey': (119, 136, 153),
+ 'lightsteelblue': (176, 196, 222),
+ 'lightsteelblue1': (202, 225, 255),
+ 'lightsteelblue2': (188, 210, 238),
+ 'lightsteelblue3': (162, 181, 205),
+ 'lightsteelblue4': (110, 123, 139),
+ 'lightyellow': (255, 255, 224),
+ 'lightyellow1': (255, 255, 224),
+ 'lightyellow2': (238, 238, 209),
+ 'lightyellow3': (205, 205, 180),
+ 'lightyellow4': (139, 139, 122),
+ 'limegreen': (50, 205, 50),
+ 'linen': (250, 240, 230),
+ 'magenta': (255, 0, 255),
+ 'magenta1': (255, 0, 255),
+ 'magenta2': (238, 0, 238),
+ 'magenta3': (205, 0, 205),
+ 'magenta4': (139, 0, 139),
+ 'maroon': (176, 48, 96),
+ 'maroon1': (255, 52, 179),
+ 'maroon2': (238, 48, 167),
+ 'maroon3': (205, 41, 144),
+ 'maroon4': (139, 28, 98),
+ 'mediumaquamarine': (102, 205, 170),
+ 'mediumblue': (0, 0, 205),
+ 'mediumorchid': (186, 85, 211),
+ 'mediumorchid1': (224, 102, 255),
+ 'mediumorchid2': (209, 95, 238),
+ 'mediumorchid3': (180, 82, 205),
+ 'mediumorchid4': (122, 55, 139),
+ 'mediumpurple': (147, 112, 219),
+ 'mediumpurple1': (171, 130, 255),
+ 'mediumpurple2': (159, 121, 238),
+ 'mediumpurple3': (137, 104, 205),
+ 'mediumpurple4': (93, 71, 139),
+ 'mediumseagreen': (60, 179, 113),
+ 'mediumslateblue': (123, 104, 238),
+ 'mediumspringgreen': (0, 250, 154),
+ 'mediumturquoise': (72, 209, 204),
+ 'mediumvioletred': (199, 21, 133),
+ 'midnightblue': (25, 25, 112),
+ 'mintcream': (245, 255, 250),
+ 'mistyrose': (255, 228, 225),
+ 'mistyrose1': (255, 228, 225),
+ 'mistyrose2': (238, 213, 210),
+ 'mistyrose3': (205, 183, 181),
+ 'mistyrose4': (139, 125, 123),
+ 'moccasin': (255, 228, 181),
+ 'navajowhite': (255, 222, 173),
+ 'navajowhite1': (255, 222, 173),
+ 'navajowhite2': (238, 207, 161),
+ 'navajowhite3': (205, 179, 139),
+ 'navajowhite4': (139, 121, 94),
+ 'navy': (0, 0, 128),
+ 'navyblue': (0, 0, 128),
+ 'none': (255, 255, 254),
+ 'oldlace': (253, 245, 230),
+ 'olivedrab': (107, 142, 35),
+ 'olivedrab1': (192, 255, 62),
+ 'olivedrab2': (179, 238, 58),
+ 'olivedrab3': (154, 205, 50),
+ 'olivedrab4': (105, 139, 34),
+ 'orange': (255, 165, 0),
+ 'orange1': (255, 165, 0),
+ 'orange2': (238, 154, 0),
+ 'orange3': (205, 133, 0),
+ 'orange4': (139, 90, 0),
+ 'orangered': (255, 69, 0),
+ 'orangered1': (255, 69, 0),
+ 'orangered2': (238, 64, 0),
+ 'orangered3': (205, 55, 0),
+ 'orangered4': (139, 37, 0),
+ 'orchid': (218, 112, 214),
+ 'orchid1': (255, 131, 250),
+ 'orchid2': (238, 122, 233),
+ 'orchid3': (205, 105, 201),
+ 'orchid4': (139, 71, 137),
+ 'palegoldenrod': (238, 232, 170),
+ 'palegreen': (152, 251, 152),
+ 'palegreen1': (154, 255, 154),
+ 'palegreen2': (144, 238, 144),
+ 'palegreen3': (124, 205, 124),
+ 'palegreen4': (84, 139, 84),
+ 'paleturquoise': (175, 238, 238),
+ 'paleturquoise1': (187, 255, 255),
+ 'paleturquoise2': (174, 238, 238),
+ 'paleturquoise3': (150, 205, 205),
+ 'paleturquoise4': (102, 139, 139),
+ 'palevioletred': (219, 112, 147),
+ 'palevioletred1': (255, 130, 171),
+ 'palevioletred2': (238, 121, 159),
+ 'palevioletred3': (205, 104, 137),
+ 'palevioletred4': (139, 71, 93),
+ 'papayawhip': (255, 239, 213),
+ 'peachpuff': (255, 218, 185),
+ 'peachpuff1': (255, 218, 185),
+ 'peachpuff2': (238, 203, 173),
+ 'peachpuff3': (205, 175, 149),
+ 'peachpuff4': (139, 119, 101),
+ 'peru': (205, 133, 63),
+ 'pink': (255, 192, 203),
+ 'pink1': (255, 181, 197),
+ 'pink2': (238, 169, 184),
+ 'pink3': (205, 145, 158),
+ 'pink4': (139, 99, 108),
+ 'plum': (221, 160, 221),
+ 'plum1': (255, 187, 255),
+ 'plum2': (238, 174, 238),
+ 'plum3': (205, 150, 205),
+ 'plum4': (139, 102, 139),
+ 'powderblue': (176, 224, 230),
+ 'purple': (160, 32, 240),
+ 'purple1': (155, 48, 255),
+ 'purple2': (145, 44, 238),
+ 'purple3': (125, 38, 205),
+ 'purple4': (85, 26, 139),
+ 'red': (255, 0, 0),
+ 'red1': (255, 0, 0),
+ 'red2': (238, 0, 0),
+ 'red3': (205, 0, 0),
+ 'red4': (139, 0, 0),
+ 'rosybrown': (188, 143, 143),
+ 'rosybrown1': (255, 193, 193),
+ 'rosybrown2': (238, 180, 180),
+ 'rosybrown3': (205, 155, 155),
+ 'rosybrown4': (139, 105, 105),
+ 'royalblue': (65, 105, 225),
+ 'royalblue1': (72, 118, 255),
+ 'royalblue2': (67, 110, 238),
+ 'royalblue3': (58, 95, 205),
+ 'royalblue4': (39, 64, 139),
+ 'saddlebrown': (139, 69, 19),
+ 'salmon': (250, 128, 114),
+ 'salmon1': (255, 140, 105),
+ 'salmon2': (238, 130, 98),
+ 'salmon3': (205, 112, 84),
+ 'salmon4': (139, 76, 57),
+ 'sandybrown': (244, 164, 96),
+ 'seagreen': (46, 139, 87),
+ 'seagreen1': (84, 255, 159),
+ 'seagreen2': (78, 238, 148),
+ 'seagreen3': (67, 205, 128),
+ 'seagreen4': (46, 139, 87),
+ 'seashell': (255, 245, 238),
+ 'seashell1': (255, 245, 238),
+ 'seashell2': (238, 229, 222),
+ 'seashell3': (205, 197, 191),
+ 'seashell4': (139, 134, 130),
+ 'sienna': (160, 82, 45),
+ 'sienna1': (255, 130, 71),
+ 'sienna2': (238, 121, 66),
+ 'sienna3': (205, 104, 57),
+ 'sienna4': (139, 71, 38),
+ 'skyblue': (135, 206, 235),
+ 'skyblue1': (135, 206, 255),
+ 'skyblue2': (126, 192, 238),
+ 'skyblue3': (108, 166, 205),
+ 'skyblue4': (74, 112, 139),
+ 'slateblue': (106, 90, 205),
+ 'slateblue1': (131, 111, 255),
+ 'slateblue2': (122, 103, 238),
+ 'slateblue3': (105, 89, 205),
+ 'slateblue4': (71, 60, 139),
+ 'slategray': (112, 128, 144),
+ 'slategray1': (198, 226, 255),
+ 'slategray2': (185, 211, 238),
+ 'slategray3': (159, 182, 205),
+ 'slategray4': (108, 123, 139),
+ 'slategrey': (112, 128, 144),
+ 'snow': (255, 250, 250),
+ 'snow1': (255, 250, 250),
+ 'snow2': (238, 233, 233),
+ 'snow3': (205, 201, 201),
+ 'snow4': (139, 137, 137),
+ 'springgreen': (0, 255, 127),
+ 'springgreen1': (0, 255, 127),
+ 'springgreen2': (0, 238, 118),
+ 'springgreen3': (0, 205, 102),
+ 'springgreen4': (0, 139, 69),
+ 'steelblue': (70, 130, 180),
+ 'steelblue1': (99, 184, 255),
+ 'steelblue2': (92, 172, 238),
+ 'steelblue3': (79, 148, 205),
+ 'steelblue4': (54, 100, 139),
+ 'tan': (210, 180, 140),
+ 'tan1': (255, 165, 79),
+ 'tan2': (238, 154, 73),
+ 'tan3': (205, 133, 63),
+ 'tan4': (139, 90, 43),
+ 'thistle': (216, 191, 216),
+ 'thistle1': (255, 225, 255),
+ 'thistle2': (238, 210, 238),
+ 'thistle3': (205, 181, 205),
+ 'thistle4': (139, 123, 139),
+ 'tomato': (255, 99, 71),
+ 'tomato1': (255, 99, 71),
+ 'tomato2': (238, 92, 66),
+ 'tomato3': (205, 79, 57),
+ 'tomato4': (139, 54, 38),
+ 'transparent': (255, 255, 254),
+ 'turquoise': (64, 224, 208),
+ 'turquoise1': (0, 245, 255),
+ 'turquoise2': (0, 229, 238),
+ 'turquoise3': (0, 197, 205),
+ 'turquoise4': (0, 134, 139),
+ 'violet': (238, 130, 238),
+ 'violetred': (208, 32, 144),
+ 'violetred1': (255, 62, 150),
+ 'violetred2': (238, 58, 140),
+ 'violetred3': (205, 50, 120),
+ 'violetred4': (139, 34, 82),
+ 'wheat': (245, 222, 179),
+ 'wheat1': (255, 231, 186),
+ 'wheat2': (238, 216, 174),
+ 'wheat3': (205, 186, 150),
+ 'wheat4': (139, 126, 102),
+ 'white': (255, 255, 255),
+ 'whitesmoke': (245, 245, 245),
+ 'yellow': (255, 255, 0),
+ 'yellow1': (255, 255, 0),
+ 'yellow2': (238, 238, 0),
+ 'yellow3': (205, 205, 0),
+ 'yellow4': (139, 139, 0),
+ 'yellowgreen': (154, 205, 50),
}
re_nonword=re.compile(r'([^0-9a-zA-Z_.]+)')
re_linewidth=re.compile(r'setlinewidth\((\d+(\.\d*)?|\.\d+)\)')
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -139,3 +139,7 @@
Refactor sandboxing to operate at a higher level.
.. branch: cpyext-bootstrap
+
+.. branch: vmprof-newstack
+
+Refactor vmprof to work cross-operating-system.
\ No newline at end of file
diff --git a/pypy/module/_cffi_backend/embedding.py
b/pypy/module/_cffi_backend/embedding.py
--- a/pypy/module/_cffi_backend/embedding.py
+++ b/pypy/module/_cffi_backend/embedding.py
@@ -84,11 +84,68 @@
return rffi.cast(rffi.INT, res)
# ____________________________________________________________
+if os.name == 'nt':
+ do_startup = r'''
+#include <stdio.h>
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+RPY_EXPORTED void rpython_startup_code(void);
+RPY_EXPORTED int pypy_setup_home(char *, int);
+static unsigned char _cffi_ready = 0;
+static const char *volatile _cffi_module_name;
-eci = ExternalCompilationInfo(separate_module_sources=[
-r"""
-/* XXX Windows missing */
+static void _cffi_init_error(const char *msg, const char *extra)
+{
+ fprintf(stderr,
+ "\nPyPy initialization failure when loading module '%s':\n%s%s\n",
+ _cffi_module_name, msg, extra);
+}
+
+BOOL CALLBACK _cffi_init(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex)
+{
+
+ HMODULE hModule;
+ TCHAR home[_MAX_PATH];
+ rpython_startup_code();
+ RPyGilAllocate();
+
+ GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
+ GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
+ (LPCTSTR)&_cffi_init, &hModule);
+ if (hModule == 0 ) {
+ /* TODO turn the int into a string with FormatMessage */
+
+ _cffi_init_error("dladdr() failed: ", "");
+ return TRUE;
+ }
+ GetModuleFileName(hModule, home, _MAX_PATH);
+ if (pypy_setup_home(home, 1) != 0) {
+ _cffi_init_error("pypy_setup_home() failed", "");
+ return TRUE;
+ }
+ _cffi_ready = 1;
+ fprintf(stderr, "startup succeeded, home %s\n", home);
+ return TRUE;
+}
+
+RPY_EXPORTED
+int pypy_carefully_make_gil(const char *name)
+{
+ /* For CFFI: this initializes the GIL and loads the home path.
+ It can be called completely concurrently from unrelated threads.
+ It assumes that we don't hold the GIL before (if it exists), and we
+ don't hold it afterwards.
+ */
+ static INIT_ONCE s_init_once;
+
+ _cffi_module_name = name; /* not really thread-safe, but better than
+ nothing */
+ InitOnceExecuteOnce(&s_init_once, _cffi_init, NULL, NULL);
+ return (int)_cffi_ready - 1;
+}'''
+else:
+ do_startup = r"""
#include <stdio.h>
#include <dlfcn.h>
#include <pthread.h>
@@ -141,6 +198,7 @@
pthread_once(&once_control, _cffi_init);
return (int)_cffi_ready - 1;
}
-"""])
+"""
+eci = ExternalCompilationInfo(separate_module_sources=[do_startup])
declare_c_function = rffi.llexternal_use_eci(eci)
diff --git a/pypy/module/_socket/test/test_sock_app.py
b/pypy/module/_socket/test/test_sock_app.py
--- a/pypy/module/_socket/test/test_sock_app.py
+++ b/pypy/module/_socket/test/test_sock_app.py
@@ -102,7 +102,7 @@
fd = space.appexec([w_socket, space.wrap(orig_fd.fileno()),
space.wrap(socket.AF_INET), space.wrap(socket.SOCK_STREAM),
space.wrap(0)],
- """(_socket, fd, family, type, proto):
+ """(_socket, fd, family, type, proto):
return _socket.fromfd(fd, family, type, proto)""")
assert space.unwrap(space.call_method(fd, 'fileno'))
@@ -326,7 +326,7 @@
def test_ntoa_exception(self):
import _socket
- raises(_socket.error, _socket.inet_ntoa, "ab")
+ raises(_socket.error, _socket.inet_ntoa, b"ab")
def test_aton_exceptions(self):
import _socket
@@ -418,7 +418,7 @@
# it if there is no connection.
try:
s.connect(("www.python.org", 80))
- except _socket.gaierror, ex:
+ except _socket.gaierror as ex:
skip("GAIError - probably no connection: %s" % str(ex.args))
name = s.getpeername() # Will raise socket.error if not connected
assert name[1] == 80
@@ -465,7 +465,7 @@
sizes = {socket.htonl: 32, socket.ntohl: 32,
socket.htons: 16, socket.ntohs: 16}
for func, size in sizes.items():
- mask = (1L<<size) - 1
+ mask = (1 << size) - 1
for i in (0, 1, 0xffff, ~0xffff, 2, 0x01234567, 0x76543210):
assert i & mask == func(func(i&mask)) & mask
@@ -493,7 +493,7 @@
socket.htons: 16, socket.ntohs: 16}
for func, size in sizes.items():
try:
- func(1L << size)
+ func(1 << size)
except OverflowError:
pass
else:
@@ -574,7 +574,7 @@
# connection.
try:
s.connect(("www.python.org", 80))
- except _socket.gaierror, ex:
+ except _socket.gaierror as ex:
skip("GAIError - probably no connection: %s" % str(ex.args))
exc = raises(TypeError, s.send, None)
assert str(exc.value) == "must be string or buffer, not None"
@@ -608,12 +608,12 @@
s, addr = serversock.accept()
assert not addr
- s.send('X')
+ s.send(b'X')
data = clientsock.recv(100)
- assert data == 'X'
- clientsock.send('Y')
+ assert data == b'X'
+ clientsock.send(b'Y')
data = s.recv(100)
- assert data == 'Y'
+ assert data == b'Y'
clientsock.close()
s.close()
@@ -640,12 +640,12 @@
def test_connect_to_kernel_netlink_routing_socket(self):
import _socket, os
s = _socket.socket(_socket.AF_NETLINK, _socket.SOCK_DGRAM,
_socket.NETLINK_ROUTE)
- assert s.getsockname() == (0L, 0L)
+ assert s.getsockname() == (0, 0)
s.bind((0, 0))
a, b = s.getsockname()
assert a == os.getpid()
assert b == 0
-
+
class AppTestPacket:
def setup_class(cls):
@@ -711,20 +711,20 @@
t, addr = self.serv.accept()
cli.settimeout(1.0)
# test recv() timeout
- t.send('*')
+ t.send(b'*')
buf = cli.recv(100)
- assert buf == '*'
+ assert buf == b'*'
raises(timeout, cli.recv, 100)
# test that send() works
- count = cli.send('!')
+ count = cli.send(b'!')
assert count == 1
buf = t.recv(1)
- assert buf == '!'
+ assert buf == b'!'
# test that sendall() works
- count = cli.sendall('?')
+ count = cli.sendall(b'?')
assert count is None
buf = t.recv(1)
- assert buf == '?'
+ assert buf == b'?'
# speed up filling the buffers
t.setsockopt(SOL_SOCKET, SO_RCVBUF, 4096)
cli.setsockopt(SOL_SOCKET, SO_SNDBUF, 4096)
@@ -732,14 +732,14 @@
count = 0
try:
while 1:
- count += cli.send('foobar' * 70)
+ count += cli.send(b'foobar' * 70)
except timeout:
pass
t.recv(count)
# test sendall() timeout
try:
while 1:
- cli.sendall('foobar' * 70)
+ cli.sendall(b'foobar' * 70)
except timeout:
pass
# done
@@ -749,13 +749,13 @@
def test_recv_into(self):
import socket
import array
- MSG = 'dupa was here\n'
+ MSG = b'dupa was here\n'
cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
cli.connect(self.serv.getsockname())
conn, addr = self.serv.accept()
buf = buffer(MSG)
conn.send(buf)
- buf = array.array('c', ' ' * 1024)
+ buf = array.array('b', b' ' * 1024)
nbytes = cli.recv_into(buf)
assert nbytes == len(MSG)
msg = buf.tostring()[:len(MSG)]
@@ -771,13 +771,13 @@
def test_recvfrom_into(self):
import socket
import array
- MSG = 'dupa was here\n'
+ MSG = b'dupa was here\n'
cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
cli.connect(self.serv.getsockname())
conn, addr = self.serv.accept()
buf = buffer(MSG)
conn.send(buf)
- buf = array.array('c', ' ' * 1024)
+ buf = array.array('b', b' ' * 1024)
nbytes, addr = cli.recvfrom_into(buf)
assert nbytes == len(MSG)
msg = buf.tostring()[:len(MSG)]
diff --git a/pypy/module/_vmprof/__init__.py b/pypy/module/_vmprof/__init__.py
--- a/pypy/module/_vmprof/__init__.py
+++ b/pypy/module/_vmprof/__init__.py
@@ -11,6 +11,7 @@
interpleveldefs = {
'enable': 'interp_vmprof.enable',
'disable': 'interp_vmprof.disable',
+ 'write_all_code_objects': 'interp_vmprof.write_all_code_objects',
'VMProfError': 'space.fromcache(interp_vmprof.Cache).w_VMProfError',
}
diff --git a/pypy/module/_vmprof/interp_vmprof.py
b/pypy/module/_vmprof/interp_vmprof.py
--- a/pypy/module/_vmprof/interp_vmprof.py
+++ b/pypy/module/_vmprof/interp_vmprof.py
@@ -59,11 +59,21 @@
'interval' is a float representing the sampling interval, in seconds.
Must be smaller than 1.0
"""
+ w_modules = space.sys.get('modules')
+ if space.is_true(space.contains(w_modules, space.wrap('_continuation'))):
+ space.warn(space.wrap("Using _continuation/greenlet/stacklet together "
+ "with vmprof will crash"),
+ space.w_RuntimeWarning)
try:
rvmprof.enable(fileno, period)
except rvmprof.VMProfError, e:
raise VMProfError(space, e)
+def write_all_code_objects(space):
+ """ Needed on cpython, just empty function here
+ """
+ pass
+
def disable(space):
"""Disable vmprof. Remember to close the file descriptor afterwards
if necessary.
diff --git a/pypy/module/_vmprof/test/conftest.py
b/pypy/module/_vmprof/test/conftest.py
deleted file mode 100644
--- a/pypy/module/_vmprof/test/conftest.py
+++ /dev/null
@@ -1,7 +0,0 @@
-import py
-from rpython.jit.backend import detect_cpu
-
-cpu = detect_cpu.autodetect()
-def pytest_runtest_setup(item):
- if cpu != detect_cpu.MODEL_X86_64:
- py.test.skip("x86_64 tests only")
diff --git a/pypy/module/_vmprof/test/test__vmprof.py
b/pypy/module/_vmprof/test/test__vmprof.py
--- a/pypy/module/_vmprof/test/test__vmprof.py
+++ b/pypy/module/_vmprof/test/test__vmprof.py
@@ -23,7 +23,7 @@
i += 5 * WORD # header
assert s[i ] == '\x05' # MARKER_HEADER
assert s[i + 1] == '\x00' # 0
- assert s[i + 2] == '\x01' # VERSION_THREAD_ID
+ assert s[i + 2] == '\x02' # VERSION_THREAD_ID
assert s[i + 3] == chr(4) # len('pypy')
assert s[i + 4: i + 8] == 'pypy'
i += 8
diff --git a/pypy/module/_vmprof/test/test_direct.py
b/pypy/module/_vmprof/test/test_direct.py
--- a/pypy/module/_vmprof/test/test_direct.py
+++ b/pypy/module/_vmprof/test/test_direct.py
@@ -19,6 +19,7 @@
lib = ffi.verify("""
#define PYPY_JIT_CODEMAP
+#include "vmprof_stack.h"
volatile int pypy_codemap_currently_invalid = 0;
@@ -42,7 +43,7 @@
}
-""" + open(str(srcdir.join("vmprof_get_custom_offset.h"))).read())
+""" + open(str(srcdir.join("vmprof_get_custom_offset.h"))).read(),
include_dirs=[str(srcdir)])
class TestDirect(object):
def test_infrastructure(self):
@@ -67,8 +68,5 @@
buf = ffi.new("long[10]", [0] * 10)
result = ffi.cast("void**", buf)
res = lib.vmprof_write_header_for_jit_addr(result, 0, ffi.NULL, 100)
- assert res == 6
- assert buf[0] == 2
- assert buf[1] == 16
- assert buf[2] == 12
- assert buf[3] == 8
+ assert res == 10
+ assert [x for x in buf] == [6, 0, 3, 16, 3, 12, 3, 8, 3, 4]
diff --git a/pypy/module/cpyext/frameobject.py
b/pypy/module/cpyext/frameobject.py
--- a/pypy/module/cpyext/frameobject.py
+++ b/pypy/module/cpyext/frameobject.py
@@ -17,6 +17,7 @@
PyFrameObjectFields = (PyObjectFields +
(("f_code", PyCodeObject),
("f_globals", PyObject),
+ ("f_locals", PyObject),
("f_lineno", rffi.INT),
))
cpython_struct("PyFrameObject", PyFrameObjectFields, PyFrameObjectStruct)
@@ -35,6 +36,7 @@
py_frame = rffi.cast(PyFrameObject, py_obj)
py_frame.c_f_code = rffi.cast(PyCodeObject, make_ref(space, frame.pycode))
py_frame.c_f_globals = make_ref(space, frame.get_w_globals())
+ py_frame.c_f_locals = make_ref(space, frame.get_w_locals())
rffi.setintfield(py_frame, 'c_f_lineno', frame.getorcreatedebug().f_lineno)
@cpython_api([PyObject], lltype.Void, external=False)
@@ -43,6 +45,7 @@
py_code = rffi.cast(PyObject, py_frame.c_f_code)
Py_DecRef(space, py_code)
Py_DecRef(space, py_frame.c_f_globals)
+ Py_DecRef(space, py_frame.c_f_locals)
from pypy.module.cpyext.object import PyObject_dealloc
PyObject_dealloc(space, py_obj)
@@ -72,6 +75,7 @@
space.interp_w(PyCode, w_code) # sanity check
py_frame.c_f_code = rffi.cast(PyCodeObject, make_ref(space, w_code))
py_frame.c_f_globals = make_ref(space, w_globals)
+ py_frame.c_f_locals = make_ref(space, w_locals)
return py_frame
@cpython_api([PyFrameObject], rffi.INT_real, error=-1)
diff --git a/pypy/module/cpyext/include/frameobject.h
b/pypy/module/cpyext/include/frameobject.h
--- a/pypy/module/cpyext/include/frameobject.h
+++ b/pypy/module/cpyext/include/frameobject.h
@@ -8,6 +8,7 @@
PyObject_HEAD
PyCodeObject *f_code;
PyObject *f_globals;
+ PyObject *f_locals;
int f_lineno;
} PyFrameObject;
diff --git a/pypy/module/cpyext/include/stringobject.h
b/pypy/module/cpyext/include/stringobject.h
--- a/pypy/module/cpyext/include/stringobject.h
+++ b/pypy/module/cpyext/include/stringobject.h
@@ -7,8 +7,8 @@
extern "C" {
#endif
-#define PyString_GET_SIZE(op) PyString_Size(op)
-#define PyString_AS_STRING(op) PyString_AsString(op)
+#define PyString_GET_SIZE(op) PyString_Size((PyObject*)(op))
+#define PyString_AS_STRING(op) PyString_AsString((PyObject*)(op))
typedef struct {
PyObject_HEAD
diff --git a/pypy/module/cpyext/test/test_frameobject.py
b/pypy/module/cpyext/test/test_frameobject.py
--- a/pypy/module/cpyext/test/test_frameobject.py
+++ b/pypy/module/cpyext/test/test_frameobject.py
@@ -9,6 +9,7 @@
PyObject *py_srcfile = PyString_FromString("filename");
PyObject *py_funcname = PyString_FromString("funcname");
PyObject *py_globals = PyDict_New();
+ PyObject *py_locals = PyDict_New();
PyObject *empty_string = PyString_FromString("");
PyObject *empty_tuple = PyTuple_New(0);
PyCodeObject *py_code;
@@ -39,7 +40,7 @@
PyThreadState_Get(), /*PyThreadState *tstate,*/
py_code, /*PyCodeObject *code,*/
py_globals, /*PyObject *globals,*/
- 0 /*PyObject *locals*/
+ py_locals /*PyObject *locals*/
);
if (!py_frame) goto bad;
py_frame->f_lineno = 48; /* Does not work with CPython */
@@ -51,6 +52,7 @@
Py_XDECREF(empty_string);
Py_XDECREF(empty_tuple);
Py_XDECREF(py_globals);
+ Py_XDECREF(py_locals);
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
return NULL;
diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -116,7 +116,7 @@
def _find_map_attr(self, name, index):
while isinstance(self, PlainAttribute):
- if name == self.name and index == self.index:
+ if index == self.index and name == self.name:
return self
self = self.back
return None
@@ -156,7 +156,6 @@
jit.isconstant(name) and
jit.isconstant(index))
def add_attr(self, obj, name, index, w_value):
- # grumble, jit needs this
attr = self._get_new_attr(name, index)
oldattr = obj._get_mapdict_map()
if not jit.we_are_jitted():
@@ -296,7 +295,7 @@
new_obj._get_mapdict_map().add_attr(new_obj, self.name, self.index,
w_value)
def delete(self, obj, name, index):
- if name == self.name and index == self.index:
+ if index == self.index and name == self.name:
# ok, attribute is deleted
if not self.ever_mutated:
self.ever_mutated = True
diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py
--- a/pypy/objspace/std/setobject.py
+++ b/pypy/objspace/std/setobject.py
@@ -942,7 +942,7 @@
return False
if w_set.length() == 0:
return True
- # it's possible to have 0-lenght strategy that's not empty
+ # it's possible to have 0-length strategy that's not empty
if w_set.strategy is w_other.strategy:
return self._issubset_unwrapped(w_set, w_other)
if not self.may_contain_equal_elements(w_other.strategy):
diff --git a/pypy/test_all.py b/pypy/test_all.py
--- a/pypy/test_all.py
+++ b/pypy/test_all.py
@@ -26,11 +26,10 @@
#Add toplevel repository dir to sys.path
sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
import pytest
- import pytest_cov
if sys.platform == 'win32':
#Try to avoid opeing a dialog box if one of the tests causes a system
error
# We do this in runner.py, but buildbots run twisted which ruins
inheritance
- # in windows subprocesses.
+ # in windows subprocesses.
import ctypes
winapi = ctypes.windll.kernel32
SetErrorMode = winapi.SetErrorMode
@@ -44,4 +43,4 @@
old_mode = SetErrorMode(flags)
SetErrorMode(old_mode | flags)
- sys.exit(pytest.main(plugins=[pytest_cov]))
+ sys.exit(pytest.main())
diff --git a/pytest_cov.py b/pytest_cov.py
deleted file mode 100644
--- a/pytest_cov.py
+++ /dev/null
@@ -1,353 +0,0 @@
-"""produce code coverage reports using the 'coverage' package, including
support for distributed testing.
-
-This plugin produces coverage reports. It supports centralised testing and
distributed testing in
-both load and each modes. It also supports coverage of subprocesses.
-
-All features offered by the coverage package should be available, either
through pytest-cov or
-through coverage's config file.
-
-
-Installation
-------------
-
-The `pytest-cov`_ package may be installed with pip or easy_install::
-
- pip install pytest-cov
- easy_install pytest-cov
-
-.. _`pytest-cov`: http://pypi.python.org/pypi/pytest-cov/
-
-
-Uninstallation
---------------
-
-Uninstalling packages is supported by pip::
-
- pip uninstall pytest-cov
-
-However easy_install does not provide an uninstall facility.
-
-.. IMPORTANT::
-
- Ensure that you manually delete the init_cov_core.pth file in your
site-packages directory.
-
- This file starts coverage collection of subprocesses if appropriate during
site initialisation
- at python startup.
-
-
-Usage
------
-
-Centralised Testing
-~~~~~~~~~~~~~~~~~~~
-
-Centralised testing will report on the combined coverage of the main process
and all of it's
-subprocesses.
-
-Running centralised testing::
-
- py.test --cov myproj tests/
-
-Shows a terminal report::
-
- -------------------- coverage: platform linux2, python 2.6.4-final-0
---------------------
- Name Stmts Miss Cover
- ----------------------------------------
- myproj/__init__ 2 0 100%
- myproj/myproj 257 13 94%
- myproj/feature4286 94 7 92%
- ----------------------------------------
- TOTAL 353 20 94%
-
-
-Distributed Testing: Load
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Distributed testing with dist mode set to load will report on the combined
coverage of all slaves.
-The slaves may be spread out over any number of hosts and each slave may be
located anywhere on the
-file system. Each slave will have it's subprocesses measured.
-
-Running distributed testing with dist mode set to load::
-
- py.test --cov myproj -n 2 tests/
-
-Shows a terminal report::
-
- -------------------- coverage: platform linux2, python 2.6.4-final-0
---------------------
- Name Stmts Miss Cover
- ----------------------------------------
- myproj/__init__ 2 0 100%
- myproj/myproj 257 13 94%
- myproj/feature4286 94 7 92%
- ----------------------------------------
- TOTAL 353 20 94%
-
-
-Again but spread over different hosts and different directories::
-
- py.test --cov myproj --dist load
- --tx ssh=memedough@host1//chdir=testenv1
- --tx
ssh=memedough@host2//chdir=/tmp/testenv2//python=/tmp/env1/bin/python
- --rsyncdir myproj --rsyncdir tests --rsync examples
- tests/
-
-Shows a terminal report::
-
- -------------------- coverage: platform linux2, python 2.6.4-final-0
---------------------
- Name Stmts Miss Cover
- ----------------------------------------
- myproj/__init__ 2 0 100%
- myproj/myproj 257 13 94%
- myproj/feature4286 94 7 92%
- ----------------------------------------
- TOTAL 353 20 94%
-
-
-Distributed Testing: Each
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Distributed testing with dist mode set to each will report on the combined
coverage of all slaves.
-Since each slave is running all tests this allows generating a combined
coverage report for multiple
-environments.
-
-Running distributed testing with dist mode set to each::
-
- py.test --cov myproj --dist each
- --tx
popen//chdir=/tmp/testenv3//python=/usr/local/python27/bin/python
- --tx
ssh=memedough@host2//chdir=/tmp/testenv4//python=/tmp/env2/bin/python
- --rsyncdir myproj --rsyncdir tests --rsync examples
- tests/
-
-Shows a terminal report::
-
- ---------------------------------------- coverage
----------------------------------------
- platform linux2, python 2.6.5-final-0
- platform linux2, python 2.7.0-final-0
- Name Stmts Miss Cover
- ----------------------------------------
- myproj/__init__ 2 0 100%
- myproj/myproj 257 13 94%
- myproj/feature4286 94 7 92%
- ----------------------------------------
- TOTAL 353 20 94%
-
-
-Reporting
----------
-
-It is possible to generate any combination of the reports for a single test
run.
-
-The available reports are terminal (with or without missing line numbers
shown), HTML, XML and
-annotated source code.
-
-The terminal report without line numbers (default)::
-
- py.test --cov-report term --cov myproj tests/
-
- -------------------- coverage: platform linux2, python 2.6.4-final-0
---------------------
- Name Stmts Miss Cover
- ----------------------------------------
- myproj/__init__ 2 0 100%
- myproj/myproj 257 13 94%
- myproj/feature4286 94 7 92%
- ----------------------------------------
- TOTAL 353 20 94%
-
-
-The terminal report with line numbers::
-
- py.test --cov-report term-missing --cov myproj tests/
-
- -------------------- coverage: platform linux2, python 2.6.4-final-0
---------------------
- Name Stmts Miss Cover Missing
- --------------------------------------------------
- myproj/__init__ 2 0 100%
- myproj/myproj 257 13 94% 24-26, 99, 149, 233-236,
297-298, 369-370
- myproj/feature4286 94 7 92% 183-188, 197
- --------------------------------------------------
- TOTAL 353 20 94%
-
-
-The remaining three reports output to files without showing anything on the
terminal (useful for
-when the output is going to a continuous integration server)::
-
- py.test --cov-report html
- --cov-report xml
- --cov-report annotate
- --cov myproj tests/
-
-
-Coverage Data File
-------------------
-
-The data file is erased at the beginning of testing to ensure clean data for
each test run.
-
-The data file is left at the end of testing so that it is possible to use
normal coverage tools to
-examine it.
-
-
-Coverage Config File
---------------------
-
-This plugin provides a clean minimal set of command line options that are
added to pytest. For
-further control of coverage use a coverage config file.
-
-For example if tests are contained within the directory tree being measured
the tests may be
-excluded if desired by using a .coveragerc file with the omit option set::
-
- py.test --cov-config .coveragerc
- --cov myproj
- myproj/tests/
-
-Where the .coveragerc file contains file globs::
-
- [run]
- omit = tests/*
-
-For full details refer to the `coverage config file`_ documentation.
-
-.. _`coverage config file`: http://nedbatchelder.com/code/coverage/config.html
-
-Note that this plugin controls some options and setting the option in the
config file will have no
-effect. These include specifying source to be measured (source option) and
all data file handling
-(data_file and parallel options).
-
-
-Limitations
------------
-
-For distributed testing the slaves must have the pytest-cov package installed.
This is needed since
-the plugin must be registered through setuptools / distribute for pytest to
start the plugin on the
-slave.
-
-For subprocess measurement environment variables must make it from the main
process to the
-subprocess. The python used by the subprocess must have pytest-cov installed.
The subprocess must
-do normal site initialisation so that the environment variables can be
detected and coverage
-started.
-
-
-Acknowledgements
-----------------
-
-Whilst this plugin has been built fresh from the ground up it has been
influenced by the work done
-on pytest-coverage (Ross Lawley, James Mills, Holger Krekel) and nose-cover
(Jason Pellerin) which are
-other coverage plugins.
-
-Ned Batchelder for coverage and its ability to combine the coverage results of
parallel runs.
-
-Holger Krekel for pytest with its distributed testing support.
-
-Jason Pellerin for nose.
-
-Michael Foord for unittest2.
-
-No doubt others have contributed to these tools as well.
-"""
-
-
-def pytest_addoption(parser):
- """Add options to control coverage."""
-
- group = parser.getgroup('coverage reporting with distributed testing
support')
- group.addoption('--cov', action='append', default=[], metavar='path',
- dest='cov_source',
- help='measure coverage for filesystem path
(multi-allowed)')
- group.addoption('--cov-report', action='append', default=[],
metavar='type',
- choices=['term', 'term-missing', 'annotate', 'html',
'xml'],
- dest='cov_report',
- help='type of report to generate: term, term-missing,
annotate, html, xml (multi-allowed)')
- group.addoption('--cov-config', action='store', default='.coveragerc',
metavar='path',
- dest='cov_config',
- help='config file for coverage, default: .coveragerc')
-
-
-def pytest_configure(config):
- """Activate coverage plugin if appropriate."""
-
- if config.getvalue('cov_source'):
- config.pluginmanager.register(CovPlugin(), '_cov')
-
-
-class CovPlugin(object):
- """Use coverage package to produce code coverage reports.
-
- Delegates all work to a particular implementation based on whether
- this test process is centralised, a distributed master or a
- distributed slave.
- """
-
- def __init__(self):
- """Creates a coverage pytest plugin.
-
- We read the rc file that coverage uses to get the data file
- name. This is needed since we give coverage through it's API
- the data file name.
- """
-
- # Our implementation is unknown at this time.
- self.cov_controller = None
-
- def pytest_sessionstart(self, session):
- """At session start determine our implementation and delegate to it."""
-
- import cov_core
-
- cov_source = session.config.getvalue('cov_source')
- cov_report = session.config.getvalue('cov_report') or ['term']
- cov_config = session.config.getvalue('cov_config')
-
- session_name = session.__class__.__name__
- is_master = (session.config.pluginmanager.hasplugin('dsession') or
- session_name == 'DSession')
- is_slave = (hasattr(session.config, 'slaveinput') or
- session_name == 'SlaveSession')
- nodeid = None
-
- if is_master:
- controller_cls = cov_core.DistMaster
- elif is_slave:
- controller_cls = cov_core.DistSlave
- nodeid = session.config.slaveinput.get('slaveid', getattr(session,
'nodeid'))
- else:
- controller_cls = cov_core.Central
-
- self.cov_controller = controller_cls(cov_source,
- cov_report,
- cov_config,
- session.config,
- nodeid)
-
- self.cov_controller.start()
-
- def pytest_configure_node(self, node):
- """Delegate to our implementation."""
-
- self.cov_controller.configure_node(node)
- pytest_configure_node.optionalhook = True
-
- def pytest_testnodedown(self, node, error):
- """Delegate to our implementation."""
-
- self.cov_controller.testnodedown(node, error)
- pytest_testnodedown.optionalhook = True
-
- def pytest_sessionfinish(self, session, exitstatus):
- """Delegate to our implementation."""
-
- self.cov_controller.finish()
-
- def pytest_terminal_summary(self, terminalreporter):
- """Delegate to our implementation."""
-
- self.cov_controller.summary(terminalreporter._tw)
-
-
-def pytest_funcarg__cov(request):
- """A pytest funcarg that provides access to the underlying coverage
object."""
-
- # Check with hasplugin to avoid getplugin exception in older pytest.
- if request.config.pluginmanager.hasplugin('_cov'):
- plugin = request.config.pluginmanager.getplugin('_cov')
- if plugin.cov_controller:
- return plugin.cov_controller.cov
- return None
diff --git a/rpython/annotator/builtin.py b/rpython/annotator/builtin.py
--- a/rpython/annotator/builtin.py
+++ b/rpython/annotator/builtin.py
@@ -39,8 +39,9 @@
return s_result
s_realresult = immutablevalue(realresult)
if not s_result.contains(s_realresult):
- raise Exception("%s%r returned %r, which is not contained in %s" % (
- func, args, realresult, s_result))
+ raise AnnotatorError(
+ "%s%r returned %r, which is not contained in %s" % (
+ func, args, realresult, s_result))
return s_realresult
# ____________________________________________________________
@@ -56,14 +57,14 @@
s_start, s_stop = args[:2]
s_step = args[2]
else:
- raise Exception("range() takes 1 to 3 arguments")
+ raise AnnotatorError("range() takes 1 to 3 arguments")
empty = False # so far
if not s_step.is_constant():
step = 0 # this case signals a variable step
else:
step = s_step.const
if step == 0:
- raise Exception("range() with step zero")
+ raise AnnotatorError("range() with step zero")
if s_start.is_constant() and s_stop.is_constant():
try:
if len(xrange(s_start.const, s_stop.const, step)) == 0:
@@ -285,7 +286,8 @@
else:
@analyzer_for(unicodedata.decimal)
def unicodedata_decimal(s_uchr):
- raise TypeError("unicodedate.decimal() calls should not happen at
interp-level")
+ raise AnnotatorError(
+ "unicodedate.decimal() calls should not happen at interp-level")
@analyzer_for(OrderedDict)
def analyze():
@@ -299,9 +301,9 @@
@analyzer_for(weakref.ref)
def weakref_ref(s_obj):
if not isinstance(s_obj, SomeInstance):
- raise Exception("cannot take a weakref to %r" % (s_obj,))
+ raise AnnotatorError("cannot take a weakref to %r" % (s_obj,))
if s_obj.can_be_None:
- raise Exception("should assert that the instance we take "
+ raise AnnotatorError("should assert that the instance we take "
"a weakref to cannot be None")
return SomeWeakRef(s_obj.classdef)
@@ -311,3 +313,14 @@
@analyzer_for(rpython.rlib.objectmodel.free_non_gc_object)
def robjmodel_free_non_gc_object(obj):
pass
+
+#________________________________
+# pdb
+
+import pdb
+
+@analyzer_for(pdb.set_trace)
+def pdb_set_trace(*args_s):
+ raise AnnotatorError(
+ "you left pdb.set_trace() in your interpreter! "
+ "If you want to attach a gdb instead, call rlib.debug.attach_gdb()")
diff --git a/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
b/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
new file mode 100644
--- /dev/null
+++ b/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
@@ -0,0 +1,90 @@
+
+import os, py
+from rpython.jit.backend.test.support import CCompiledMixin
+from rpython.rlib.jit import JitDriver
+from rpython.tool.udir import udir
+from rpython.translator.translator import TranslationContext
+from rpython.jit.backend.detect_cpu import getcpuclass
+
+class CompiledVmprofTest(CCompiledMixin):
+ CPUClass = getcpuclass()
+
+ def setup(self):
+ if self.CPUClass.backend_name != 'x86_64':
+ py.test.skip("vmprof only supports x86-64 CPUs at the moment")
+
+ def _get_TranslationContext(self):
+ t = TranslationContext()
+ t.config.translation.gc = 'incminimark'
+ t.config.translation.list_comprehension_operations = True
+ return t
+
+ def test_vmprof(self):
+ from rpython.rlib import rvmprof
+
+ class MyCode:
+ _vmprof_unique_id = 0
+ def __init__(self, name):
+ self.name = name
+
+ def get_name(code):
+ 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, get_unique_id=get_unique_id)
+
+ @rvmprof.vmprof_execute_code("xcode13", lambda code, num: code)
+ def main(code, num):
+ return main_jitted(code, num)
+
+ def main_jitted(code, num):
+ s = 0
+ i = 0
+ while i < num:
+ driver.jit_merge_point(code=code, i=i, s=s, num=num)
+ s += (i << 1)
+ if i % 3 == 0 and code is not code2:
+ main(code2, 100)
+ i += 1
+ return s
+
+ tmpfilename = str(udir.join('test_rvmprof'))
+
+ def f(num):
+ code = MyCode("py:x:foo:3")
+ rvmprof.register_code(code, get_name)
+ fd = os.open(tmpfilename, os.O_WRONLY | os.O_CREAT, 0666)
+ period = 0.0001
+ rvmprof.enable(fd, period)
+ res = main(code, num)
+ #assert res == 499999500000
+ rvmprof.disable()
+ os.close(fd)
+ return 0
+
+ def check_vmprof_output():
+ from vmprof import read_profile
+ tmpfile = str(udir.join('test_rvmprof'))
+ stats = read_profile(tmpfile)
+ t = stats.get_tree()
+ assert t.name == 'py:x:foo:3'
+ assert len(t.children) == 1 # jit
+
+ self.meta_interp(f, [1000000], inline=True)
+ try:
+ import vmprof
+ except ImportError:
+ pass
+ else:
+ check_vmprof_output()
diff --git a/rpython/jit/backend/test/test_rvmprof.py
b/rpython/jit/backend/test/test_rvmprof.py
new file mode 100644
--- /dev/null
+++ b/rpython/jit/backend/test/test_rvmprof.py
@@ -0,0 +1,49 @@
+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 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():
+ stack = cintf.vmprof_tl_stack.getraw()
+ if stack:
+ # not during tracing
+ visited.append(stack.c_value)
+ else:
+ visited.append(0)
+
+ llfn = llhelper(lltype.Ptr(lltype.FuncType([], lltype.Void)), helper)
+
+ driver = jit.JitDriver(greens=[], reds='auto')
+
+ def f(n):
+ i = 0
+ while i < n:
+ driver.jit_merge_point()
+ i += 1
+ llfn()
+
+ class Hooks(jit.JitHookInterface):
+ def after_compile(self, debug_info):
+ self.raw_start = debug_info.asminfo.rawstart
+
+ 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
+ # ^^^ 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
+ 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
+ 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
@@ -12,7 +12,7 @@
from rpython.jit.metainterp.compile import ResumeGuardDescr
from rpython.rtyper.lltypesystem import lltype, rffi, rstr, llmemory
from rpython.rtyper.lltypesystem.lloperation import llop
-from rpython.rtyper.annlowlevel import llhelper, cast_instance_to_gcref
+from rpython.rtyper.annlowlevel import cast_instance_to_gcref
from rpython.rtyper import rclass
from rpython.rlib.jit import AsmInfo
from rpython.jit.backend.model import CompiledLoopToken
@@ -837,11 +837,56 @@
frame_depth = max(frame_depth, target_frame_depth)
return frame_depth
+ def _call_header_vmprof(self):
+ 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)
+ # old = current value of vmprof_tl_stack
+ 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
+ self.mc.MOV_mr((eax.value, WORD), esp.value)
+ # 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, offset), eax.value)
+
+ def _call_footer_vmprof(self):
+ from rpython.rlib.rvmprof.rvmprof import cintf
+ # edx = address of pypy_threadlocal_s
+ self.mc.MOV_rs(edx.value, THREADLOCAL_OFS)
+ self.mc.AND_ri(edx.value, ~1)
+ # 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
+ 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)
self.mc.MOV_sr(PASS_ON_MY_FRAME * WORD, ebp.value)
if IS_X86_64:
self.mc.MOV_sr(THREADLOCAL_OFS, esi.value)
+ if self.cpu.translate_support_code:
+ self._call_header_vmprof() # on X86_64, this uses esi
+ if IS_X86_64:
self.mc.MOV_rr(ebp.value, edi.value)
else:
self.mc.MOV_rs(ebp.value, (FRAME_FIXED_SIZE + 1) * WORD)
@@ -873,6 +918,8 @@
def _call_footer(self):
# the return value is the jitframe
+ if self.cpu.translate_support_code:
+ self._call_footer_vmprof()
self.mc.MOV_rr(eax.value, ebp.value)
gcrootmap = self.cpu.gc_ll_descr.gcrootmap
diff --git a/rpython/jit/backend/x86/test/test_rvmprof.py
b/rpython/jit/backend/x86/test/test_rvmprof.py
new file mode 100644
--- /dev/null
+++ b/rpython/jit/backend/x86/test/test_rvmprof.py
@@ -0,0 +1,7 @@
+
+import py
+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
diff --git a/rpython/jit/backend/x86/test/test_zrpy_vmprof.py
b/rpython/jit/backend/x86/test/test_zrpy_vmprof.py
new file mode 100644
--- /dev/null
+++ b/rpython/jit/backend/x86/test/test_zrpy_vmprof.py
@@ -0,0 +1,7 @@
+
+from rpython.jit.backend.llsupport.test.zrpy_vmprof_test import
CompiledVmprofTest
+
+class TestZVMprof(CompiledVmprofTest):
+
+ gcrootfinder = "shadowstack"
+ gc = "incminimark"
\ No newline at end of file
diff --git a/rpython/jit/backend/x86/test/test_zvmprof.py
b/rpython/jit/backend/x86/test/test_zvmprof.py
new file mode 100644
--- /dev/null
+++ b/rpython/jit/backend/x86/test/test_zvmprof.py
@@ -0,0 +1,7 @@
+
+from rpython.jit.backend.llsupport.test.zrpy_vmprof_test import
CompiledVmprofTest
+
+class TestZVMprof(CompiledVmprofTest):
+
+ gcrootfinder = "shadowstack"
+ gc = "incminimark"
\ No newline at end of file
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()
diff --git a/rpython/jit/metainterp/quasiimmut.py
b/rpython/jit/metainterp/quasiimmut.py
--- a/rpython/jit/metainterp/quasiimmut.py
+++ b/rpython/jit/metainterp/quasiimmut.py
@@ -51,6 +51,7 @@
class QuasiImmut(object):
llopaque = True
compress_limit = 30
+ looptokens_wrefs = None
def __init__(self, cpu):
self.cpu = cpu
@@ -75,7 +76,7 @@
def compress_looptokens_list(self):
self.looptokens_wrefs = [wref for wref in self.looptokens_wrefs
if wref() is not None]
- # NB. we must keep around the looptoken_wrefs that are
+ # NB. we must keep around the looptokens_wrefs that are
# already invalidated; see below
self.compress_limit = (len(self.looptokens_wrefs) + 15) * 2
@@ -83,6 +84,9 @@
# When this is called, all the loops that we record become
# invalid: all GUARD_NOT_INVALIDATED in these loops (and
# in attached bridges) must now fail.
+ if self.looptokens_wrefs is None:
+ # can't happen, but helps compiled tests
+ return
wrefs = self.looptokens_wrefs
self.looptokens_wrefs = []
for wref in wrefs:
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
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
diff --git a/rpython/rlib/debug.py b/rpython/rlib/debug.py
--- a/rpython/rlib/debug.py
+++ b/rpython/rlib/debug.py
@@ -1,76 +1,41 @@
-import sys, time
+import sys
+import time
+
from rpython.rtyper.extregistry import ExtRegistryEntry
from rpython.rlib.objectmodel import we_are_translated
from rpython.rlib.rarithmetic import is_valid_int
-from rpython.rtyper.extfunc import ExtFuncEntry
+from rpython.rtyper.extfunc import register_external
from rpython.rtyper.lltypesystem import lltype
+from rpython.rtyper.lltypesystem import rffi
from rpython.translator.tool.cbuild import ExternalCompilationInfo
-
-def ll_assert(x, msg):
- """After translation to C, this becomes an RPyAssert."""
- assert type(x) is bool, "bad type! got %r" % (type(x),)
- assert x, msg
-
-class Entry(ExtRegistryEntry):
- _about_ = ll_assert
-
- def compute_result_annotation(self, s_x, s_msg):
- assert s_msg.is_constant(), ("ll_assert(x, msg): "
- "the msg must be constant")
- return None
-
- def specialize_call(self, hop):
- vlist = hop.inputargs(lltype.Bool, lltype.Void)
- hop.exception_cannot_occur()
- hop.genop('debug_assert', vlist)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit