Skip to content

Commit 7e9579b

Browse files
committed
no warmup supported for pypy vm as well
1 parent 7c13bce commit 7e9579b

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

mx.graalpython/mx_graalpython_benchmark.py

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,13 @@ def run(self, cwd, args):
122122
return ret_code, out.data
123123

124124

125-
class CPythonVm(AbstractPythonVm):
126-
PYTHON_INTERPRETER = "python3"
125+
class AbstractPythonNoWarmupVm(AbstractPythonVm):
126+
__metaclass__ = ABCMeta
127127

128-
def __init__(self, config_name, options=None, virtualenv=None, no_warmup=False):
129-
super(CPythonVm, self).__init__(config_name, options)
130-
self._virtualenv = virtualenv
128+
def __init__(self, config_name, options=None, no_warmup=False):
129+
super(AbstractPythonNoWarmupVm, self).__init__(config_name, options)
131130
self._no_warmup = no_warmup
132131

133-
@property
134-
def interpreter(self):
135-
if self._virtualenv:
136-
return os.path.join(self._virtualenv, CPythonVm.PYTHON_INTERPRETER)
137-
return CPythonVm.PYTHON_INTERPRETER
138-
139-
def name(self):
140-
return VM_NAME_CPYTHON
141-
142132
@staticmethod
143133
def remove_warmup_runs(args):
144134
_args = []
@@ -154,20 +144,39 @@ def remove_warmup_runs(args):
154144

155145
def run(self, cwd, args):
156146
if self._no_warmup:
157-
args = CPythonVm.remove_warmup_runs(args)
158-
return super(CPythonVm, self).run(cwd, args)
147+
args = AbstractPythonNoWarmupVm.remove_warmup_runs(args)
148+
return super(AbstractPythonNoWarmupVm, self).run(cwd, args)
159149

160150

161-
class PyPyVm(AbstractPythonVm):
162-
def __init__(self, config_name, options=None):
163-
super(PyPyVm, self).__init__(config_name, options=options)
151+
class CPythonVm(AbstractPythonNoWarmupVm):
152+
PYTHON_INTERPRETER = "python3"
153+
154+
def __init__(self, config_name, options=None, virtualenv=None, no_warmup=False):
155+
super(CPythonVm, self).__init__(config_name, options=options, no_warmup=no_warmup)
156+
self._virtualenv = virtualenv
157+
158+
@property
159+
def interpreter(self):
160+
if self._virtualenv:
161+
return os.path.join(self._virtualenv, CPythonVm.PYTHON_INTERPRETER)
162+
return CPythonVm.PYTHON_INTERPRETER
163+
164+
def name(self):
165+
return VM_NAME_CPYTHON
166+
167+
168+
class PyPyVm(AbstractPythonNoWarmupVm):
169+
PYPY_INTERPRETER = "pypy3"
170+
171+
def __init__(self, config_name, options=None, no_warmup=False):
172+
super(PyPyVm, self).__init__(config_name, options=options, no_warmup=no_warmup)
164173

165174
@property
166175
def interpreter(self):
167176
home = mx.get_env(ENV_PYPY_HOME)
168177
if not home:
169178
mx.abort("{} is not set!".format(ENV_PYPY_HOME))
170-
return join(home, 'bin', 'pypy3')
179+
return join(home, 'bin', PyPyVm.PYPY_INTERPRETER)
171180

172181
def name(self):
173182
return VM_NAME_PYPY

0 commit comments

Comments
 (0)