Closed Bug 506138 Opened 15 years ago Closed 15 years ago

Merge tracemonkey NativeARM changes into tamarin-redux

Categories

(Tamarin Graveyard :: Baseline JIT (CodegenLIR), defect, P1)

ARM
All
defect

Tracking

(Not tracked)

VERIFIED FIXED
flash10.1

People

(Reporter: rreitmai, Assigned: rreitmai)

References

Details

Attachments

(17 files, 7 obsolete files)

59.07 KB, patch
edwsmith
: superreview+
Details | Diff | Splinter Review
25.29 KB, patch
edwsmith
: superreview+
Details | Diff | Splinter Review
9.82 KB, patch
edwsmith
: superreview+
Details | Diff | Splinter Review
18.24 KB, patch
edwsmith
: superreview+
Details | Diff | Splinter Review
18.06 KB, patch
Details | Diff | Splinter Review
36.52 KB, patch
Details | Diff | Splinter Review
4.18 KB, patch
Details | Diff | Splinter Review
4.32 KB, patch
n.nethercote
: review+
Details | Diff | Splinter Review
24.41 KB, patch
edwsmith
: review+
Details | Diff | Splinter Review
949 bytes, patch
edwsmith
: review+
Details | Diff | Splinter Review
5.83 KB, patch
edwsmith
: superreview+
Details | Diff | Splinter Review
2.07 KB, patch
Details | Diff | Splinter Review
2.60 KB, patch
Details | Diff | Splinter Review
12.66 KB, patch
Details | Diff | Splinter Review
1.09 KB, patch
Details | Diff | Splinter Review
646 bytes, patch
Details | Diff | Splinter Review
2.31 KB, patch
Details | Diff | Splinter Review
Bring on the goodness
Blocks: 503556
Attached patch ver 1 - code movement (obsolete) — Splinter Review
This first patch simply moves code around so it better lines up with the tracemonkey source.

There should be no other differences (except maybe for a function or two added).
This patch is code rearrangement, which eases merging with TM and makes follow-on patches easier to digest.
Attachment #390394 - Attachment is obsolete: true
Attachment #390405 - Flags: superreview?(edwsmith)
Attachment #390405 - Flags: superreview?(edwsmith) → superreview+
Brings over the following from tracemonkey:
(1) CountLeadingZero's used in regalloc and asm_mmq
(2) asm_mmq code 
(3) nFragExit asm_loop directory copied over
(4) imm64_x usage
(5) asm_ld / asm_param / asm_int optimizations
Attachment #390527 - Flags: superreview?(edwsmith)
introduce asm_arg and consolidate the the EABI code.
Attachment #390597 - Flags: superreview?
Attachment #390597 - Attachment is patch: true
Attachment #390597 - Attachment mime type: application/octet-stream → text/plain
Attachment #390597 - Flags: superreview? → superreview?(edwsmith)
Includes: 

(1) shuffle EABI code from asm_call to asm_arg
(2) imm64_x usage
(3) LD32_nochk / asm_ld_chk optimizations
(4) asm_branch comments from TM added
Attachment #390605 - Flags: superreview?(edwsmith)
Pushed p5v1 (attachment #390982 [details] [diff] [review]) - no + review, pre-approved from edwin.
Pushed p6v1 (attachment #390983 [details] [diff] [review]) - http://hg.mozilla.org/tamarin-redux/rev/4179457f88d9.

no + review ; pre-approved from edwin.
+// NB the thumb2 check (i.e using > v6) is technically 
+// not correct, but its close enough for now).

In Trace Monkey, AvmCore.thumb2 is set based on some tests. For Linux, the test uses auxv, and there is no way to detect ARMv6T2 that I know of. Thus, we ignore ARMv6T2 and go with ARMv7+. This is reasonable as ARMv6T2 cores are rare in practice.

For WinCE, however, the detection mechanism uses undefined instruction aborts to detect features, so it will catch ARMv6T2 correctly. We may be able to do something similar for Linux, but I didn't think it worth investigating in detail, given the rarity of ARMv6T2 in the kind of device we're targetting.
Attached patch p7v1Splinter Review
more cleanup
This merges Trace Monkey's asm_call and asm_arg with that in Tamarin.

There is still some divergence where Tamarin uses static feature detection and Trace Monkey uses run-time feature detection, but that will be the subject of a future patch.

In addition, there are several TODOs in the code as there are a few outstanding questions about which features we want to merge and that kind of thing.

This patch is linked with p8v1 in bug 507117, which makes similar changes to Trace Monkey.

----

I'm not entirely sure how to test Tamarin as the stuff in the "test" directory doesn't seem to work for me. I've checked the patch using a simple "hello world"-type program and -Djitordie, and it seems to be Ok. In addition, it works in Trace Monkey with trace-test.js, though there are bits in Tamarin that this won't catch.

Rick: I worked from you work-in-progress repository, but this also applies and works on tamarin-redux.

----

I can't test this on WinCE, so I don't know if the legacy ABI code works.
Attachment #391626 - Flags: review?(rreitmai)
Comment on attachment 391626 [details] [diff] [review]
p8v1: Merge asm_call and asm_arg.

'-'ing only because there are a few issues with the patch, but overall it is how we want the code to evolve.

- builds* on runs on beagle-board (gcc/debian 4.3.2) with --enable-arm-fpu but fails a few of the acceptance tests:
 ecma3/GlobalObject/e15_1_2_2_1
 ecma3/String/e15_5_4_5_4
 ecma3/String/e15_5_3_2_1
 ecma3/Math/e15_8_2_11

- fails to build on winmo 

* after adding a missing IS_ARM_ARCH_VFP() 

I'm investigating the build failure on winmo and the test failures.  

Will post a follow-up with findings.
Attachment #391626 - Flags: review?(rreitmai) → review-
This addresses the issues you mentioned and fixes the regressions.

I've run the test suite without --enable-arm-vfp, but I haven't yet run it with that flag as the test suite takes a long time to run on my ARM platform. I will run it overnight and report back if there were any problems, but the code is now pretty much identical to that in Trace Monkey and it works there. (The regressions were not in the VFP code.)

I don't know if it fixes the Windows Mobile build. I've moved some code around, so it may now work. If it doesn't could you post the build error please? (I don't have a WinCE build environment.)
Attachment #391626 - Attachment is obsolete: true
Attachment #392960 - Flags: review?(edwsmith)
Sorry, I missed a bit. My updated patch did not check the alignment for 64-bit arguments on the stack (for EABI).

This isn't hit by any test case, but it would almost certinaly cause a crash if ever encountered.
Attachment #392960 - Attachment is obsolete: true
Attachment #392966 - Flags: review?(edwsmith)
Attachment #392960 - Flags: review?(edwsmith)
Comment on attachment 392966 [details] [diff] [review]
 p8v3: Fixes alignment of 64-bit EABI arguments.

Nothing obviously wrong jumps out, so marking this + on the evidence that it's matching TM and passing both test suites.

I will test this on WinMo and if things look good, push it into tamarin-redux.  (we're about to cut a release to tamarin-central so this will go in after that release).
Attachment #392966 - Flags: review?(edwsmith) → review+
Attachment #390527 - Flags: superreview?(edwsmith) → superreview+
Attachment #390597 - Flags: superreview?(edwsmith) → superreview+
Attachment #390605 - Flags: superreview?(edwsmith) → superreview+
comments on attachment 392966 [details] [diff] [review]:

(1) asm_arg_64() doesn't preserve NJ_SOFTFLOAT.  Do we want to remove this as a compilation option?  While the logic may be correct (I haven't reviewed it in detail yet) I believe it will add to the size.

(2) asm_stk_arg() similarly removes NJ_ARM_VFP .  I wonder if we could simply change if (!isQuad) to (!isQuad || !IS_ARM_ARCH_VFP())  or somesuch.

(3) V4T and V5 support existed in the old branch logic.  It looks like it has been removed.
(In reply to comment #22)
> comments on attachment 392966 [details] [diff] [review]:
> 
> (1) asm_arg_64() doesn't preserve NJ_SOFTFLOAT.  Do we want to remove this as a
> compilation option?  While the logic may be correct (I haven't reviewed it in
> detail yet) I believe it will add to the size.

Indeed. This comes back to the discussion or whether to use runtime-detection (as in Trace Monkey) or build-time-detection (as in Tamarin). Personally, I prefer the former; one of the primary benefits of a JIT compiler is that it can generate code that suits the target platform, regardless of the compile-time options. We can, for example, build an ARMv5 non-VFP VM that we can distribute to everyone, and still have the JIT compiler take advantage of VFP at run-time.

Yes, the price for this is that the code size increases, but it isn't really a significant increase. In addition, _most_ (but not all) target platforms will have VFP support, so in the majority of cases the code will actually be used.

> (2) asm_stk_arg() similarly removes NJ_ARM_VFP .  I wonder if we could simply
> change if (!isQuad) to (!isQuad || !IS_ARM_ARCH_VFP())  or somesuch.

Again, the proper way to proceed here depends heavily on the decisions taken for the configuration mechanism.

> (3) V4T and V5 support existed in the old branch logic.  It looks like it has
> been removed.

It still supports ARMv5, but not ARMv4 or ARMv4T. We removed this from Trace Monkey some time ago, and I think we agreed to remove it from Tamarin too. (I don't think I would have intentionally removed it without discussing it first, but it was a while back now so I can't be sure without looking at IRC logs and the like.)

If you want it to remain, that's fine, but we'll need to find a way of testing it, and I'd argue that the value of ARMv4(T) support is limited as no-one is going to want to run Trace Monkey on such devices, let alone Firefox.
ARMv5 as a minimum is okay for Tamarin

with respect to cpu detection (ARMv5/6/7) it seems fine to do runtime detection, and we can add additional code to optimize it out when we want both a) compile-time decision, and b) to reduce code footprint.

regarding softfloat, runtime detection seems fine, to get us merged.

we will certianly want to have some kind of ability to compile in the decision to use VFP however, because when VFP is available, the hosts we embed in will want to take advantage of it in their C/C++ code.  and if it's compiled into C/C++ i see no reason for it not to be compiled into the jit, too.  the same is true for interworking -- if its something you must enable/disable in the C/C++ compiler then having it be a runtime decision in the jit doesn't seem to have a scenario where it pays off.  (maybe interworking is already done this way.. not checking, just making the point).
Attached patch asm_arg/stk changes (obsolete) — Splinter Review
This is a partial merge/recoding of some of the changes residing in TM.   It pulls apart asm_arg into asm_arg_64 and removes many ifdefs for vfp, replacing them with IS_ARM_ARCH_VFP() which for tamarin is a constant but for tracemonkey its a dynamic access.
can we have a declaration somewhere in NativeARM.h that is "const" in TM and not in TR, but just plainly access the variable in code?  cleans things up and should produce the same code if the C++ compiler is any good.
(In reply to comment #26)
> if the C++ compiler is any good.

Ha ha ha! Edwin, you're so funny :-)
Attached patch applies to TM Splinter Review
This patch applies to nanojit-central and cleans up the macros in NativeARM.h so that gcc no longer complains about them being empty in their 'else' statements.

Please land on the tracemonkey side assuming no ill effects.
Attachment #403922 - Flags: review?
Attachment #403922 - Flags: review? → review?(graydon)
Oop, I'm just finishing up for the evening; handing to njn if he wants it.
Attachment #403922 - Flags: review?(graydon) → review?(nnethercote)
Comment on attachment 403922 [details] [diff] [review]
applies to TM 

I've filed bug 519876 for the TM patch so it can be tracked separately.  Thanks.
Attachment #403922 - Flags: review?(nnethercote) → review+
Attachment #403842 - Attachment is obsolete: true
Attached patch call - patch 2 (obsolete) — Splinter Review
Attachment #404194 - Flags: review?(edwsmith)
Attachment #404196 - Flags: review?(edwsmith)
Depends on: 520688
keeps the existing logic rather than replacing with TM logic which fails regressions.  Need to circle back to this issue (bug 520688).
Attachment #404195 - Attachment is obsolete: true
Attachment #404730 - Flags: superreview?(edwsmith)
Comment on attachment 404194 [details] [diff] [review]
arg stack - patch 1

asm_fcmp shouldn't even be in Assembler.h, its specific to each backend.

NativeARM.cpp:204 whitespace deleted, presumably to converge, but it messes up indentation.

line 514: check for LC_Assembly removed.  not sure why, just convergence with TM?

line 549, the comment would be nice to keep unless its just a blatant lie, in which case we should fix it instead of deleting it

line 567: comment should be NJ_MERGE instead of TM_MERGE
Attachment #404194 - Flags: review?(edwsmith) → review+
Attachment #404196 - Flags: review?(edwsmith) → review+
Attachment #404730 - Flags: superreview?(edwsmith) → superreview+
Depends on: 520905
re: 
 asm_fcmp() - ok, i'll remove it in an upcoming patch
 whitespace - yes, the whitespace issue is temporary
 LC_Assembly - yes matches TM
 comment - ok, i'll add it back before landing
 NJ_MERGE - ok its just a temporary placeholder anyways
Attached patch asm_load64Splinter Review
Attachment #405067 - Flags: superreview?(edwsmith)
Attached patch asm_store64Splinter Review
Attachment #405068 - Flags: superreview?(edwsmith)
Attached patch BranchWithLinkSplinter Review
Attachment #405069 - Flags: superreview?(edwsmith)
Attached patch genPrologue (obsolete) — Splinter Review
Attachment #405071 - Flags: superreview?(edwsmith)
Attached patch genEpilogueSplinter Review
Attachment #405072 - Flags: superreview?(edwsmith)
Attached patch nFragExitSplinter Review
marking p8v3 obsolete as the following patches contain the remaining deltas
Attachment #392966 - Attachment is obsolete: true
Attachment #405073 - Flags: superreview?(edwsmith)
Attached patch genPrologueSplinter Review
previous genPrologue patch was incorrect.
Attachment #405071 - Attachment is obsolete: true
Attachment #405074 - Flags: superreview?(edwsmith)
Attachment #405071 - Flags: superreview?(edwsmith)
Depends on: 522341
Depends on: 522377
Attachment #405067 - Flags: superreview?(edwsmith)
Attachment #405068 - Flags: superreview?(edwsmith)
Attachment #405069 - Flags: superreview?(edwsmith)
Attachment #405072 - Flags: superreview?(edwsmith)
Attachment #405073 - Flags: superreview?(edwsmith)
Attachment #405074 - Flags: superreview?(edwsmith)
Priority: -- → P1
Target Milestone: --- → flash10.1
marking this fixed since the merge is done as of last night.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
removing bug 520905 as dependency ... bug 526914 now tracks it.
No longer depends on: 520905
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: