Mercurial > hg > graal-compiler
comparison pytools/gl.py @ 3627:c773cc740d4a
Improved error messages in gl.py.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 09 Nov 2011 22:37:44 +0100 |
parents | e81927755129 |
children | 61f10abeb25a |
comparison
equal
deleted
inserted
replaced
3626:77ae87a2dd04 | 3627:c773cc740d4a |
---|---|
68 | 68 |
69 self.add_argument('commandAndArgs', nargs=REMAINDER, metavar='command args...') | 69 self.add_argument('commandAndArgs', nargs=REMAINDER, metavar='command args...') |
70 | 70 |
71 self.parse_args(namespace=self) | 71 self.parse_args(namespace=self) |
72 | 72 |
73 if self.jdk7 is None or not isdir(self.jdk7): | 73 if self.jdk7 is None: |
74 self.log('JDK7 is required. Use --jdk7 option or set JDK7 environment variable (in ' + configFile + ')') | 74 self.abort('JDK7 is required. Use --jdk7 option or set JDK7 environment variable (in ' + configFile + ')') |
75 self.abort(1) | 75 |
76 if not isdir(self.jdk7): | |
77 self.abort('Specified JDK7 path is not a directory: ' + self.jdk7) | |
76 | 78 |
77 self.graal_home = dirname(abspath(dirname(sys.argv[0]))) | 79 self.graal_home = dirname(abspath(dirname(sys.argv[0]))) |
78 | 80 |
79 def load_config_file(self, configFile): | 81 def load_config_file(self, configFile): |
80 """ adds attributes to this object from a file containing key=value lines """ | 82 """ adds attributes to this object from a file containing key=value lines """ |
96 elif sys.platform.startswith('sunos'): | 98 elif sys.platform.startswith('sunos'): |
97 return 'solaris' | 99 return 'solaris' |
98 elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): | 100 elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): |
99 return 'windows' | 101 return 'windows' |
100 else: | 102 else: |
101 print 'Supported operating system could not be derived from', sys.platform | 103 self.abort('Supported operating system could not be derived from ' + sys.platform) |
102 self.abort(1) | |
103 | 104 |
104 | 105 |
105 def exe(self, name): | 106 def exe(self, name): |
106 if self.get_os() == 'windows': | 107 if self.get_os() == 'windows': |
107 return name + '.exe' | 108 return name + '.exe' |
108 return name | 109 return name |
109 | 110 |
110 def run_dacapo(self, args): | 111 def run_dacapo(self, args): |
111 if not isfile(self.dacapo) or not self.dacapo.endswith('.jar'): | 112 if not isfile(self.dacapo) or not self.dacapo.endswith('.jar'): |
112 self.log('Specified DaCapo jar file does not exist or is not a jar file: ' + self.dacapo) | 113 self.abort('Specified DaCapo jar file does not exist or is not a jar file: ' + self.dacapo) |
113 self.abort(1) | |
114 return self.run_vm(['-Xms1g', '-Xmx2g', '-esa', '-XX:-GraalBailoutIsFatal', '-G:-QuietBailout', '-cp', self.dacapo] + args) | 114 return self.run_vm(['-Xms1g', '-Xmx2g', '-esa', '-XX:-GraalBailoutIsFatal', '-G:-QuietBailout', '-cp', self.dacapo] + args) |
115 | 115 |
116 def run_vm(self, args): | 116 def run_vm(self, args): |
117 if self.maxine is None: | 117 if self.maxine is None: |
118 configFile = join(dirname(sys.argv[0]), 'glrc') | 118 configFile = join(dirname(sys.argv[0]), 'glrc') |
119 self.log('Path to Maxine code base must be specified with -M option or MAXINE environment variable (in ' + configFile + ')') | 119 self.abort('Path to Maxine code base must be specified with -M option or MAXINE environment variable (in ' + configFile + ')') |
120 self.abort(1) | |
121 if not exists(join(self.maxine, 'com.oracle.max.graal.hotspot', 'bin', 'com', 'oracle', 'max', 'graal', 'hotspot', 'VMEntriesNative.class')): | 120 if not exists(join(self.maxine, 'com.oracle.max.graal.hotspot', 'bin', 'com', 'oracle', 'max', 'graal', 'hotspot', 'VMEntriesNative.class')): |
122 self.log('Maxine code base path specified -M option or MAXINE environment variable does not contain com.oracle.max.graal.hotspot/bin/com/oracle/max/graal/hotspot/VMEntriesNative.class: ' + self.maxine) | 121 self.abort('Maxine code base path specified -M option or MAXINE environment variable does not contain com.oracle.max.graal.hotspot/bin/com/oracle/max/graal/hotspot/VMEntriesNative.class: ' + self.maxine) |
123 self.abort(1) | |
124 | 122 |
125 os.environ['MAXINE'] = self.maxine | 123 os.environ['MAXINE'] = self.maxine |
126 exe = join(self.jdk7, 'bin', self.exe('java')) | 124 exe = join(self.jdk7, 'bin', self.exe('java')) |
127 return self.run([exe, '-graal'] + args) | 125 return self.run([exe, '-graal'] + args) |
128 | 126 |
138 """ | 136 """ |
139 | 137 |
140 assert isinstance(args, types.ListType), "'args' must be a list: " + str(args) | 138 assert isinstance(args, types.ListType), "'args' must be a list: " + str(args) |
141 for arg in args: | 139 for arg in args: |
142 if not isinstance(arg, types.StringTypes): | 140 if not isinstance(arg, types.StringTypes): |
143 self.log('argument is not a string: ' + str(arg)) | 141 self.abort('argument is not a string: ' + str(arg)) |
144 self.abort(1) | |
145 | 142 |
146 if self.verbose: | 143 if self.verbose: |
147 self.log(' '.join(args)) | 144 self.log(' '.join(args)) |
148 | 145 |
149 try: | 146 try: |