GitLab will be upgraded to the 12.10.14-ce.0 on 28 Sept 2020 at 2.00pm (AEDT) to 2.30pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

Commit 28371f18 authored by John Zhang's avatar John Zhang

switch to new rewrite version of PyPy Mu back-end

parent 7725fa8c
......@@ -100,10 +100,10 @@ testjit:rpython:
script:
- git clone https://gitlab.anu.edu.au/mu/mu-client-pypy.git tests/test_jit/mu-client-pypy
- cd tests/test_jit/mu-client-pypy
- git checkout test-mu-impl-jit
- git checkout mu-rewrite-zebu-no-binop-with-flag
- cd rpython/translator/mu/rpyc; make
- cd $CI_PROJECT_DIR/tests/test_jit
- RUST_BACKTRACE=1 LD_LIBRARY_PATH=mu-client-pypy/rpython/translator/mu/rpyc PYTHONPATH=mu-client-pypy MU_RUST=$CI_PROJECT_DIR pytest test_rpython*.py -v
- RUST_BACKTRACE=1 LD_LIBRARY_PATH=. PYTHONPATH=mu-client-pypy MU_RUST=$CI_PROJECT_DIR pytest test_rpython*.py -v
cache:
key: "$CI_BUILD_STAGE/$CI_BUILD_REF_NAME"
paths:
......
from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.rlib import rmu_fast as rmu
from rpython.rlib.rmu import zebu as rmu
from rpython.translator.platform import platform
from util import fncptr_from_rpy_func, fncptr_from_py_script, may_spawn_proc
import ctypes, py, stat
......@@ -833,7 +833,6 @@ def test_throw():
"@refi64": refi64
}
from rpython.rlib import rmu_fast as rmu
(fnp, _), (mu, ctx, bldr) = fncptr_from_py_script(build_test_bundle, None, 'test_fnc', [ctypes.c_int64],
ctypes.c_int64, mode=ctypes.RTLD_GLOBAL)
mu.current_thread_as_mu_thread(rmu.null(rmu.MuCPtr))
......@@ -843,7 +842,6 @@ def test_throw():
@may_spawn_proc
def test_exception_stack_unwind():
from rpython.rlib import rmu_fast as rmu
def build_test_bundle(bldr, rmu):
"""
Builds the following test bundle.
......@@ -990,12 +988,12 @@ def test_exception_stack_unwind():
def run_boot_image(entry, output, has_c_main_sig = False, args = []):
from rpython.translator.interactive import Translation
if has_c_main_sig:
t = Translation(entry, [rffi.INT, rffi.CCHARPP], backend='mu', muimpl='fast', mucodegen='api')
t = Translation(entry, [rffi.INT, rffi.CCHARPP], backend='mu', impl='zebu', codegen='api')
t.driver.disable(['entrypoint_mu'])
else:
t = Translation(entry, None, backend='mu', muimpl='fast', mucodegen='api')
t = Translation(entry, None, backend='mu', impl='zebu', codegen='api')
t.driver.standalone = True # force standalone
t.driver.exe_name = output
......@@ -1004,8 +1002,6 @@ def run_boot_image(entry, output, has_c_main_sig = False, args = []):
exe = py.path.local(output + '.mu')
# zebu
import os
from rpython.translator.mu import dir_mu
exe.chmod(stat.S_IRWXU)
res = platform.execute(str(exe), args)
......@@ -1055,7 +1051,6 @@ def test_rpython_helloworld():
@pytest.mark.xfail(reason = "new test")
@may_spawn_proc
def test_rpython_print_number():
from rpython.translator.interactive import Translation
def main(argv):
print 233
......
......@@ -113,18 +113,14 @@ def is_ctypes(t):
def fncptr_from_py_script(py_fnc, heapinit_fnc, name, argtypes=[], restype=ctypes.c_longlong, mode=ctypes.RTLD_LOCAL, **kwargs):
import os
# NOTE: requires mu-client-pypy
from rpython.rlib import rmu_fast as rmu
from rpython.rlib.rmu import zebu as rmu
# load libmu before rffi so to load it with RTLD_GLOBAL
libmu = preload_libmu()
from rpython.translator.mu import dir_mu
loglvl = os.environ.get('MU_LOG_LEVEL', 'none')
emit_dir = kwargs.get('muemitdir', os.environ.get('MU_EMIT_DIR', 'emit'))
mu = rmu.MuVM("--log-level=%(loglvl)s --aot-emit-dir=%(emit_dir)s "
"--bootimage-external-lib=rpyc "
"--bootimage-external-libpath=%(dir_mu)s/rpyc" % locals())
mu = rmu.MuVM("--log-level=%(loglvl)s --aot-emit-dir=%(emit_dir)s" % locals())
ctx = mu.new_context()
bldr = ctx.new_ir_builder()
......@@ -166,18 +162,18 @@ def fncptr_from_rpy_func(rpy_fnc, llargtypes, llrestype, mode=ctypes.RTLD_LOCAL,
from rpython.config.translationoption import set_opt_level
preload_libmu()
emit_dir = os.environ.get('MU_EMIT_DIR', 'emit')
kwargs.setdefault('backend', 'mu')
kwargs.setdefault('muimpl', 'fast')
kwargs.setdefault('mucodegen', 'api')
kwargs.setdefault('mutestjit', True)
kwargs.setdefault('muemitdir', os.environ.get('MU_EMIT_DIR', 'emit'))
kwargs.setdefault('impl', 'zebu')
kwargs.setdefault('codegen', 'api')
kwargs.setdefault('testjit', True)
kwargs.setdefault('vmargs', "--aot-emit-dir=" + emit_dir)
t = Translation(rpy_fnc, llargtypes, **kwargs)
set_opt_level(t.config, '3')
if kwargs['backend'] == 'mu':
db, bdlgen, fnc_name = t.compile_mu()
emit_dir = py.path.local(kwargs['muemitdir'])
emit_dir = py.path.local(emit_dir)
libpath = emit_dir.join('lib%(fnc_name)s' % locals() + libext)
bdlgen.mu.compile_to_sharedlib(libpath.strpath, [])
extras = (db, bdlgen)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment