Closed Bug 1424978 Opened 7 years ago Closed 6 years ago

Fix some function about mips jit.

Categories

(Core :: JavaScript Engine: JIT, defect, P5)

58 Branch
defect

Tracking

()

RESOLVED FIXED
Tracking Status
firefox59 --- fix-optional

People

(Reporter: yuyin-hf, Assigned: yuyin-hf)

Details

Attachments

(3 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0.2 Safari/604.4.7

Steps to reproduce:

run jit-test and mach jstestbrowser


Actual results:

some tests failed


Expected results:

all pass
Attachment #8936545 - Flags: review?(lhansen)
Attachment #8936547 - Flags: review?(lhansen)
Attached file test-sort-basics-2.js
0001 patch fix some jit-test tests, such as wasm/conversion.js
0002 patch fix test-sort-basics-2.js which is extract from ecma_6/TypedArray/sort_bacics.js
Component: Untriaged → JavaScript Engine: JIT
Product: Firefox → Core
Sorry I am missing clear bit32--bit47 in function boxValue, this change does not attach the result of this tests, but it should be fix also.
Attachment #8936547 - Attachment is obsolete: true
Attachment #8936547 - Flags: review?(lhansen)
Attachment #8936725 - Flags: review?(lhansen)
Comment on attachment 8936545 [details] [diff] [review]
0001-MIPS-Fix-some-function-implement.patch

Review of attachment 8936545 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jit/mips64/Trampoline-mips64.cpp
@@ -64,4 @@
>  static void
>  GenerateReturn(MacroAssembler& masm, int returnCode)
>  {
> -    MOZ_ASSERT(masm.framePushed() == sizeof(EnterJITRegs));

I believe that since Bug 1417595 this assert will no longer fail ?
Attachment #8936545 - Flags: review?(lhansen) → review+
Comment on attachment 8936725 [details] [diff] [review]
0002-MIPS64-Fix-tag-unbox-int32-value.patch

Review of attachment 8936725 [details] [diff] [review]:
-----------------------------------------------------------------

Redirecting review, this is not really something I know much about.
Attachment #8936725 - Flags: review?(lhansen) → review?(nicolas.b.pierron)
Priority: -- → P5
Comment on attachment 8936725 [details] [diff] [review]
0002-MIPS64-Fix-tag-unbox-int32-value.patch

Review of attachment 8936725 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jit/mips64/MacroAssembler-mips64.cpp
@@ +1487,5 @@
>  MacroAssemblerMIPS64Compat::unboxNonDouble(const ValueOperand& operand, Register dest)
>  {
> +    Label isInt32, done;
> +    Register tag = splitTagForTest(operand);
> +    asMasm().branchTestInt32(Assembler::Equal, tag, &isInt32);

I do not see anything similar in other implementations of ARM, x64:

https://searchfox.org/mozilla-central/source/js/src/jit/arm/MacroAssembler-arm.cpp#3042
https://searchfox.org/mozilla-central/source/js/src/jit/x64/MacroAssembler-x64.h#842
Attachment #8936725 - Flags: review?(nicolas.b.pierron) → review-
(In reply to Nicolas B. Pierron [:nbp] from comment #8)
> Comment on attachment 8936725 [details] [diff] [review]
> 0002-MIPS64-Fix-tag-unbox-int32-value.patch
> 
> Review of attachment 8936725 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: js/src/jit/mips64/MacroAssembler-mips64.cpp
> @@ +1487,5 @@
> >  MacroAssemblerMIPS64Compat::unboxNonDouble(const ValueOperand& operand, Register dest)
> >  {
> > +    Label isInt32, done;
> > +    Register tag = splitTagForTest(operand);
> > +    asMasm().branchTestInt32(Assembler::Equal, tag, &isInt32);
> 
> I do not see anything similar in other implementations of ARM, x64:
> 
> https://searchfox.org/mozilla-central/source/js/src/jit/arm/MacroAssembler-
> arm.cpp#3042
> https://searchfox.org/mozilla-central/source/js/src/jit/x64/MacroAssembler-
> x64.h#842


this is a 64-bit specific issue, 

see the comment :
https://searchfox.org/mozilla-central/source/js/src/jit/x64/MacroAssembler-x64.h#842

   // Unbox any non-double value into dest. Prefer unboxInt32 or unboxBoolean
    // instead if the source type is known.
    void unboxNonDouble(const ValueOperand& src, Register dest) {
---------------------------
we focus this on a box value about a negative 32-bit value, for example -1(int32).

we can see:
static constexpr Value 
fromInt32(int32_t i) {
     fromTagAndPayload(JSVAL_TAG_INT32, uint32_t(i));
}

so the tagged value of -1 should be 0xfff88000 ffffffff  // I remember fff88 is the int32 tag? 

the original code will unbox this to a value :  0x00000000 ffffffff, this is not -1 on mips64. so it must be wrong.


------------------------------

this bug is triggered when execute visitCompare, mips64 dose have a 32-bit compare instruction like cmpl on x64, it always use sltu/slt, which use both mips32/mips64, so the opreand must always a right 64-bit value on mips64.

So I think this is a bug but it has not been triggered yet on x64.
see my last comment, do you have any suggestions?
Flags: needinfo?(nicolas.b.pierron)
I just find this,
https://bugzilla.mozilla.org/show_bug.cgi?id=1432207#c0

looks like this bug fix the issue. but it did not change the code on mips platform. I will create a patch in that bug.

about this bug please checkin the 0001-**.patch which was already reviewed.

thank you.
Flags: needinfo?(nicolas.b.pierron)
Keywords: checkin-needed
Keywords: leave-open
Pushed by nerli@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/7da8287a6c2a
MIPS: Fix some function implement. r=lth
Keywords: checkin-needed
The leave-open keyword is there and there is no activity for 6 months.
:sdetar, maybe it's time to close this bug?
Flags: needinfo?(sdetar)
Nicolas, should we close this bug?
Flags: needinfo?(sdetar) → needinfo?(nicolas.b.pierron)
I suggest to close it and open a follow-up bug once the new patch comes up.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Flags: needinfo?(nicolas.b.pierron)
Keywords: leave-open
Resolution: --- → FIXED
Assignee: nobody → yuyin-hf
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: