Open Bug 1639895 Opened 11 months ago Updated 4 days ago

[meta] MIPS support in SpiderMonkey

Categories

(Core :: JavaScript Engine, task, P5)

Other
Unspecified
task

Tracking

()

People

(Reporter: tcampbell, Unassigned)

References

(Depends on 8 open bugs)

Details

(Keywords: meta)

MIPS is not an officially supported platform, but we still receive contributed bug fixes and reports for it. This meta bug is to keep track of those issues.

This includes both 32 and 64 bit MIPS.

Depends on: 1639896
Depends on: 1641471
Depends on: 1642265
Depends on: 1638246
Depends on: 1642332
Depends on: 1642915
Depends on: 1645968
Depends on: 1649655
Depends on: 1671534
Depends on: 1671871
Depends on: 1673208
Depends on: 1679010
Depends on: 1685662

Currently neither mips32 nor mips64 compile (with emulator support). I am increasingly of the opinion that this is dead code.

(In reply to Lars T Hansen [:lth] from comment #1)

Currently neither mips32 nor mips64 compile (with emulator support). I am increasingly of the opinion that this is dead code.

Currently the js could compile and run on my mips64el machine, and pass almost all tests, but the mips32 port may be broken a long time ago.

The mips64el emulator will crash due to unaligned load/store, and some of these instructions seem to be emitted by baseline compiler.
Such as: https://searchfox.org/mozilla-central/source/js/src/jit/BaselineCodeGen.cpp#384, it use a load32() on an unaligned address, and mips' emulator requires the address to be aligned , other platforms seem to be fine with such unaligned operations.

Since the code is shared by all platforms, I'm not sure how to fix it.

  1. If the unaligned operation is a bug, then the fix will help to fix mips emulator too.
  2. If the unaligned operation is supposed to emitted, then could we change the load32() here to load32Unaligned()?
  3. Or we can just remove the mips emulator's address check? Since the code currently could run my mips64el machine, but not in emulator. But it may affect the performance on mips machines that without hardware level unaligned operations support.

Thanks!

(In reply to Zhao Jiazhong from comment #2)

it use a load32() on an unaligned address, and mips' emulator requires the address to be aligned , other platforms seem to be fine with such unaligned operations.

We could change it to load32Unaligned?

Depends on: 1699363

I filed a bug to fix MIPS64 compilation. There are some warnings too but I ignored them for now.

(In reply to Jan de Mooij [:jandem] from comment #3)

We could change it to load32Unaligned?

Okay, I will find out other unaligned operations like load32 here and see if I can fix the mips64 emulator.

(In reply to Lars T Hansen [:lth] from comment #4)

I filed a bug to fix MIPS64 compilation. There are some warnings too but I ignored them for now.

Thanks! I only tried the release mode, and missed this bug.

Depends on: 1699686
Depends on: 1699689
Depends on: 1699696

So, with fixes for bug 1699686, bug 1699689, and bug 1699696 i'm to the point where the mips64 simulator runs the wasm jit-tests. I still hit some assertions (when running with MIPS_UNALIGNED=1 to filter out alignment issues):

Hit MOZ_CRASH(call) at /home/lhansen/m-u/js/src/jit/mips64/Simulator-mips64.cpp:2224 results from unsupported simulator ABI, there are very many of these errors, and after a little investigation, Clang reports that 20 signature types are not supported.

Assertion failure: rt != scratch, at /home/lhansen/m-u/js/src/jit/mips64/MacroAssembler-mips64.cpp:439 is some register management problem but I haven't looked deeper. There are very many of these too, especially when running the spec tests. They seem to be caused by the ScratchRegister being used without the ScratchRegisterScope (or the bugs would have been noticed a long time ago); this problem seems to be widespread in the MIPS macroassembler files.

There are also several segfaults.

Altogether, 674 tests failed, 1510 tests passed (69% pass rate), 16 timeouts.

It would be good to have these problems addressed so that we have a stable test bed for MIPS64 too. We try to account for MIPS in the wasm compilers, but without any way of testing what we do it's hard to say that that's worth the effort.

(In reply to Zhao Jiazhong from comment #2)

(In reply to Lars T Hansen [:lth] from comment #1)

Currently neither mips32 nor mips64 compile (with emulator support). I am increasingly of the opinion that this is dead code.

Currently the js could compile and run on my mips64el machine, and pass almost all tests, ...

The mips64el emulator will crash due to unaligned load/store, ...

Even with the unalign problems bypassed and some other problems fixed there are a number of additional problems here, see comment 6. Some of these (the assertion on the call instruction) are emulator-only issues that it would be good to have fixed (so that we can test with the emulator), but others (the assembler assertions) are possibly bugs in native builds too, and probably higher priority to fix.

Thanks for your infomation, I will test the native debug build.

Depends on: 1701159

Note: the branchTestValue changes in this patch will also have to be ported to MIPS.

Depends on: 1703434

(In reply to Iain Ireland [:iain] from comment #9)

Note: the branchTestValue changes in this patch will also have to be ported to MIPS.

Thanks for your information! I ported the patch to mips64 at https://phabricator.services.mozilla.com/D111234.

You need to log in before you can comment on or make changes to this bug.