Closed Bug 536223 Opened 15 years ago Closed 14 years ago

Code changes to make JIT working in Symbian avmshell

Categories

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

ARM
Symbian
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Future

People

(Reporter: skekki, Assigned: skekki)

References

Details

Attachments

(3 files, 23 obsolete files)

621 bytes, patch
edwsmith
: review+
Details | Diff | Splinter Review
3.48 KB, patch
skekki
: review+
lhansen
: superreview+
Details | Diff | Splinter Review
6.05 KB, patch
skekki
: review+
Details | Diff | Splinter Review
User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB5; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727)
Build Identifier: Patch against current FlashRuntime mainline (12/20/2009)

Contains patches and new files.

Reproducible: Always
Attachment #418678 - Flags: review?(stejohns)
Attachment #418679 - Flags: review?(stejohns)
Attachment #418680 - Flags: review?(stejohns)
Attachment #418681 - Flags: review?(stejohns)
Comment on attachment 418678 [details] [diff] [review]
Patch to some files in MMgc folder.

Tommy needs to review the operator-new stuff, Rick or Edwin for the code-memory.
Attachment #418678 - Flags: review?(treilly)
Attachment #418678 - Flags: review?(stejohns)
Attachment #418678 - Flags: review?(rreitmai)
Attachment #418679 - Attachment is patch: true
Attachment #418680 - Attachment is patch: true
In addition, please also replace the whole MMgcPortSymbian.cpp with the attached file. The patch looked too big/error prone.
Attachment #418682 - Flags: review?(stejohns)
Comment on attachment 418679 [details] [diff] [review]
Patch to some files in nanojit folder.

Changes to nanojit generally need to be review by someone at both Adobe and Mozilla.
Attachment #418679 - Flags: review?(stejohns)
Attachment #418679 - Flags: review?(rreitmai)
Attachment #418679 - Flags: review?(nnethercote)
Comment on attachment 418680 [details] [diff] [review]
Patch to some files in platform folder.

delegating to Tommy because of MAP_TO_OS_NEW... otherwise looks fine to me
Attachment #418680 - Flags: review?(stejohns) → review?(treilly)
Attachment #418683 - Flags: review?(stejohns)
Attachment #418684 - Flags: review?(stejohns)
Attachment #418681 - Flags: review?(stejohns) → review-
Comment on attachment 418681 [details] [diff] [review]
Patch to some files in shell folder.

Rejecting solely because indentation style doesn't match rest of the file... please fix and resubmit. (Yes, we are picky about these things.)
Attachment #418685 - Flags: review?(stejohns)
Attachment #418683 - Flags: review?(stejohns) → review+
Attachment #418686 - Flags: review?(stejohns)
Attachment #418687 - Flags: review?(stejohns)
Comment on attachment 418682 [details] [diff] [review]
Patch to some files in VMPI folder.

Delegating to Rick due to the code-memory-allocation change.
Attachment #418682 - Flags: review?(stejohns) → review?(rreitmai)
Attachment #418684 - Attachment mime type: application/octet-stream → text/plain
Attachment #418688 - Flags: review?(stejohns)
Attachment #418684 - Flags: review?(stejohns) → review+
Attachment #418685 - Attachment mime type: application/octet-stream → text/plain
Attachment #418689 - Flags: review?(stejohns)
Attachment #418685 - Flags: review?(stejohns) → review+
Attachment #418686 - Attachment mime type: application/octet-stream → text/plain
Attachment #418686 - Flags: review?(stejohns) → review+
Attachment #418687 - Flags: review?(stejohns) → review+
Attachment #418688 - Flags: review?(stejohns) → review-
Comment on attachment 418688 [details]
New file, please put under platform/symbian

We prefer not to check in code with permanently-commented-out chunks; this file has what appears to be two empty stubs. We should either check in working code or empty stubs.
Steven originally rejected a patch to this file. This should be better.
Attachment #418690 - Flags: review?(stejohns)
Comment on attachment 418689 [details]
New file, please put under folder shell.

How can this code work? avmshell::Run is commented out.
Comment on attachment 418690 [details] [diff] [review]
New version of this patch, now indentention is better.

There's still gratuitous indentation change in unrelated code; review+ is conditional on ignoring those.
Attachment #418690 - Flags: review?(stejohns) → review+
Steven rejected the original version of this file, this should help.
Attachment #418692 - Flags: review?(stejohns)
(In reply to comment #20)
> (From update of attachment 418689 [details])
> How can this code work? avmshell::Run is commented out.

Hi Steven. Only the return value is commented out. Do you want that I clean up the file at that location?
Comment on attachment 418692 [details]
A new version of this file, now commented code has been removed.

Does your compiler complain about "unused parameters"? If so, might need to tweak this to prevent warnings.
Attachment #418692 - Flags: review?(stejohns) → review+
Comment on attachment 418689 [details]
New file, please put under folder shell.

Ah, you are correct, my bad.
Attachment #418689 - Flags: review?(stejohns) → review+
(In reply to comment #21)
> (From update of attachment 418690 [details] [diff] [review])
> There's still gratuitous indentation change in unrelated code; review+ is
> conditional on ignoring those.

You are right, the patch looks bad. I try to produce a new one, unless you can use this.
(In reply to comment #24)
> (From update of attachment 418692 [details])
> Does your compiler complain about "unused parameters"? If so, might need to
> tweak this to prevent warnings.

You are right, I do it right away.
Attached file A third version of OSDepSymbian.cpp. (obsolete) —
Unused variable names are now commented out.
Attachment #418693 - Flags: review?(stejohns)
Attachment #418693 - Flags: review?(stejohns) → review+
No only my code additions are included in the patch.
Attachment #418694 - Flags: review?(stejohns)
Attachment #418694 - Attachment is patch: true
Attachment #418694 - Flags: review?(stejohns) → review+
(In reply to comment #7)
> (From update of attachment 418679 [details] [diff] [review])
> Changes to nanojit generally need to be review by someone at both Adobe and
> Mozilla.

Do they?  Not according to https://developer.mozilla.org/en/NanojitMerge, at
least not for NJ-only changes:

"Review for a nanojit internal patch (no changes to external API or embedding
assumptions) requires at least one member of either team.
Review for a nanojit external patch (API changes or embedding / environment
changes) requires sign off from at least one member of both teams."

The "either team" wording isn't that clear, but given the following sentence I
take it to mean that only one reviewer is necessary.  Having said that, for
larger NJ-only patches I think having a reviewer from each team is a good idea.

I'm not a good person to review this patch, BTW, as I don't know much about ARM
or the allocators.  I'd suggest Graydon or Jacob.
(In reply to comment #30)
> Do they?  Not according to https://developer.mozilla.org/en/NanojitMerge, at
> least not for NJ-only changes:

I stand corrected.
CC'ing people from the other side is probably a good idea for all NJ changes.
Comment on attachment 418678 [details] [diff] [review]
Patch to some files in MMgc folder.

Not sure about the MAP_TO_OS_NEW define. 

I imagine we want to update avmfeatures.as and/or associated machinery once we start building tamarin symbian
Attachment #418678 - Flags: review?(rreitmai) → review+
Comment on attachment 418679 [details] [diff] [review]
Patch to some files in nanojit folder.

it looks like we've made the #if more restrictive.  What will be the case if ARMCC is not defined?
Comment on attachment 418682 [details] [diff] [review]
Patch to some files in VMPI folder.

I'm not sure how this is working, since CodeAlloc calls VMPI_SetPageProtection. 

I would instead suggest that you just leave the empty stubs.

Also I'm wondering if the new VMPI api should be ifdef'd SYMBIAN?

Requesting Lars to have a look; he may have suggestions on how to best factor this concept.
Attachment #418682 - Flags: review?(lhansen)
Attachment #418679 - Flags: review?(rreitmai) → review-
(In reply to comment #35)
> (From update of attachment 418682 [details] [diff] [review])
> I'm not sure how this is working, since CodeAlloc calls VMPI_SetPageProtection. 
> I would instead suggest that you just leave the empty stubs.
> Also I'm wondering if the new VMPI api should be ifdef'd SYMBIAN?
> Requesting Lars to have a look; he may have suggestions on how to best factor
> this concept.

VMPI_SetPageProtection is moved to MMgcPortSymbian.cpp. There is an empty stub.
(In reply to comment #34)
> (From update of attachment 418679 [details] [diff] [review])
> it looks like we've made the #if more restrictive.  What will be the case if
> ARMCC is not defined?

In the else case there is the same code implemented in C. This intrinsic didn't compile with RVCT 2.2. However I didn't find a list of supported intrinsics in this compiler.
(In reply to comment #33)
> (From update of attachment 418678 [details] [diff] [review])
> Not sure about the MAP_TO_OS_NEW define. 
> I imagine we want to update avmfeatures.as and/or associated machinery once we
> start building tamarin symbian

Good catch. I think it should be defined in avmhost-features.h (Flash Player file) instead of symbian-platform.h.
Comment on attachment 418682 [details] [diff] [review]
Patch to some files in VMPI folder.

I do not like the documentation for VMPI_allocCodeMemory - writable executable memory is a really bad idea, so to specify that it's impossible to change the page protection on memory allocated using this call seems wrong.  More appropriate would be to state that VMPI_setPageProtection may have no effect, but that's probably true anyway (IMO it's a bug that the docs of that function aren't better than they are).  On some platforms it may be necessary to use VMPI_allocCodeMemory but on those platforms it may also be possible to use VMPI_setPageProtection; it seems unreasonable to prevent this from working.

I would approve it with those changes and changes to the VMPI_setPageProtection documentation, except that this API needs to be factored as a separate patch (including how it ties into the rest of the VM) and needs to be reviewed by Edwin at least.  VMPI_ changes are too important to be buried inside other concerns.
Attachment #418682 - Flags: review?(lhansen) → review-
Comment on attachment 418678 [details] [diff] [review]
Patch to some files in MMgc folder.

Why do we need MAP_TO_OS_NEW exactly and what does it have to do with getting the JIT to work?
Attachment #418678 - Flags: review?(treilly) → review-
Comment on attachment 418680 [details] [diff] [review]
Patch to some files in platform folder.

is __GNUC__ not defined on symbian or something?  Still looking for explanation of MAP_TO_OS_NEW...
Comment on attachment 418680 [details] [diff] [review]
Patch to some files in platform folder.

is __GNUC__ not defined on symbian or something?  Still looking for explanation of MAP_TO_OS_NEW...
Attachment #418680 - Flags: review?(treilly) → review-
(In reply to comment #40)
> (From update of attachment 418678 [details] [diff] [review])
> Why do we need MAP_TO_OS_NEW exactly and what does it have to do with getting
> the JIT to work?

Hi Thomas. If MMGC_OVERRIDE_GLOBAL_NEW is defined MMgc wants to override global new operator. You can not do that on Symbian. MAP_TO_OS_NEW is to prevent MMgc from overriding global new. It is not required if MMGC_OVERRIDE_GLOBAL_NEW is not defined.

It is not related to JIT, just to make avm work at all.
(In reply to comment #42)
> (From update of attachment 418680 [details] [diff] [review])
> is __GNUC__ not defined on symbian or something?  Still looking for explanation
> of MAP_TO_OS_NEW...

You are right, gcc is not used in Symbian tool chain.
(In reply to comment #43)
> (In reply to comment #40)
> > (From update of attachment 418678 [details] [diff] [review] [details])
> > Why do we need MAP_TO_OS_NEW exactly and what does it have to do with getting
> > the JIT to work?
> 
> Hi Thomas. If MMGC_OVERRIDE_GLOBAL_NEW is defined MMgc wants to override global
> new operator. You can not do that on Symbian. MAP_TO_OS_NEW is to prevent MMgc
> from overriding global new. It is not required if MMGC_OVERRIDE_GLOBAL_NEW is
> not defined.
> 
> It is not related to JIT, just to make avm work at all.

Please let me know if there is a more elegant way of doing this. I'm always happy to clean up the code.
(In reply to comment #43)
> (In reply to comment #40)
> > (From update of attachment 418678 [details] [diff] [review] [details])
> > Why do we need MAP_TO_OS_NEW exactly and what does it have to do with getting
> > the JIT to work?
> 
> Hi Thomas. If MMGC_OVERRIDE_GLOBAL_NEW is defined MMgc wants to override global
> new operator. You can not do that on Symbian. MAP_TO_OS_NEW is to prevent MMgc
> from overriding global new. It is not required if MMGC_OVERRIDE_GLOBAL_NEW is
> not defined.
> 
> It is not related to JIT, just to make avm work at all.

If that's the case, then would not the simpler solution be

#ifdef MMGC_OVERRIDE_GLOBAL_NEW
    #error "configuration not supported"
#endif

in symbian-platform.h?

(There's been some discussion about whether MMGC_OVERRIDE_GLOBAL_NEW is a good idea, and whether it's needed now that we have the memory allocation macros.  I don't think that discussion is finished yet.)
Until very recently the memory allocation macros were not in place in Symbian build so I had to make the "old" code path to work also. But yes, most likely supporting MMGC_OVERRIDE_GLOBAL_NEW is not needed anymore on Symbian either, unless you want to compare the behavior between the two builds (memory macros on and off).
To summarise this review, I should
* remove MAP_TO_OS_NEW feature as Tom suggested
* change comments in VMPI.h as Lars suggested
* create a new patch that contains the new function in VMPI API and also all vm files that uses that API for Edwin's review

Then it's good to go?
Attachment #418681 - Attachment is obsolete: true
Attachment #418688 - Attachment is obsolete: true
Attachment #418692 - Attachment is obsolete: true
Attachment #418690 - Attachment is obsolete: true
(In reply to comment #34)
> (From update of attachment 418679 [details] [diff] [review])
> it looks like we've made the #if more restrictive.  What will be the case if
> ARMCC is not defined?

Hi Rick, do you think this change is OK? Originally you submitted Review-. Then I replied to your comment.
I see 4 patches that have been -'d, which means that once you've addressed the issues you'll need to re-submit the patches and have them reviewed by those that -'d or are still pending.
Attachment #418678 - Attachment is obsolete: true
Attachment #420755 - Flags: review?(treilly)
Attachment #418679 - Attachment is obsolete: true
Attachment #420756 - Flags: review?(treilly)
Attachment #418679 - Flags: review?(nnethercote)
Attachment #418680 - Attachment is obsolete: true
Attachment #420757 - Flags: review?(treilly)
Attachment #418682 - Attachment is obsolete: true
Attachment #420759 - Flags: review?(treilly)
Attachment #418682 - Flags: review?(rreitmai)
(In reply to comment #50)
> I see 4 patches that have been -'d, which means that once you've addressed the
> issues you'll need to re-submit the patches and have them reviewed by those
> that -'d or are still pending.

Thanks for the tip Rick. Could you please review patch below because you -'d it originally. It's memory related so I put Thomas to review it.

https://bug536223.bugzilla.mozilla.org/attachment.cgi?id=420756
Attachment #420757 - Flags: review?(treilly) → review+
Attachment #420755 - Flags: review?(treilly) → review+
Comment on attachment 420756 [details] [diff] [review]
Changes for handling JIT memory on Symbian plus a compilation fix 

deferring my review to edwin since this is nj code
Attachment #420756 - Flags: review?(treilly) → superreview?(edwsmith)
Comment on attachment 420759 [details] [diff] [review]
Adds new code memory allocation API that is used only on Symbian for now.

generally I'd expect to see the implementations of this new API in the same patch as the definition.  Where are they?
Attachment #420759 - Flags: review?(treilly) → review-
Attachment #420756 - Flags: superreview?(edwsmith) → superreview+
It seems odd to have VMPI_allocCodeMemory (an abstraction) which is only used on one platform.  If Lars and Tommy are okay with this, then so am I, but it seems odd.

Where is the patch that contains the Symbian specific implementation of VMPI_allocCodeMemory?  The only thing I see above was the patch that supported ICACHE flushing.
Hi Edwin, it is in MMgcPortSymbian.cpp. I decided to put all memory related functionality there.

As Lars already suggested earlier, I can open a new bug/create a new patch that only has all the files that have VMPI_allocCodeMemory in them but nothing more.

https://bugzilla.mozilla.org/attachment.cgi?id=418683&action=edit
Assignee: nobody → skekki
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: flashplayer-qrb+
Priority: -- → P2
Target Milestone: --- → flash10.1
Attachment #418683 - Attachment is obsolete: true
Attachment #418684 - Attachment is obsolete: true
Attachment #418685 - Attachment is obsolete: true
Attachment #418686 - Attachment is obsolete: true
Attachment #418687 - Attachment is obsolete: true
Attachment #418689 - Attachment is obsolete: true
Attachment #418693 - Attachment is obsolete: true
Attachment #418694 - Attachment is obsolete: true
Attachment #420755 - Attachment is obsolete: true
Attachment #420756 - Attachment is obsolete: true
Attachment #420757 - Attachment is obsolete: true
Attachment #420759 - Attachment is obsolete: true
Attachment #426144 - Flags: review?(edwsmith)
Attached patch vmpi - v1 (obsolete) — Splinter Review
Attached patch mmgc - v1 (obsolete) — Splinter Review
Depends on: 545295
Attached patch v2Splinter Review
Attachment #426145 - Attachment is obsolete: true
Attachment #427480 - Flags: superreview?(lhansen)
Attachment #427480 - Flags: review?(skekki)
Attachment #427480 - Flags: superreview?(lhansen) → superreview+
Attachment #426144 - Flags: review?(edwsmith) → review+
Attached patch mmgc - v2 (obsolete) — Splinter Review
Previous version removed some code that it was not supposed to.
Attachment #429205 - Flags: review?(rreitmai)
Hi Rick. I tried to make mmgc-v1 patch obsolete but got a message that I was not allowed to edit the bug.

I sent a new patch that should replace mmgc-v1.
Attachment #426146 - Attachment is obsolete: true
Attached patch mmgc - v3Splinter Review
- adds comment to non virtual mem sample code and provides ifdefs around it.
- convert all tabs to spaces
Attachment #427480 - Attachment is obsolete: true
Attachment #429205 - Attachment is obsolete: true
Attachment #429263 - Flags: review?(skekki)
Attachment #429205 - Flags: review?(rreitmai)
Attachment #427480 - Flags: review?(skekki)
Attachment #426145 - Attachment is obsolete: false
Attachment #427480 - Attachment is obsolete: false
Attachment #426145 - Attachment is obsolete: true
Attachment #427480 - Flags: review?(skekki)
Target Milestone: flash10.1 → flash10.1.1
Attachment #427480 - Flags: review?(skekki) → review+
Attachment #429263 - Flags: review?(skekki) → review+
Now that bug 545295 has landed, can we proceed landing these changes?
SymbianPortUtils.cpp was changed by bug 545295, you may not be able to land that patch as is.
Component: Virtual Machine → JIT Compiler (NanoJIT)
QA Contact: vm → nanojit
OS: Other → Symbian
Hardware: Other → ARM
The milestone for this bug can be set "Future".
Target Milestone: flash10.1.1 → Future
Priority: P2 → --
Marking fixed, lets open a new bug with any remaining specific changes needed.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: