IonMonkey: Instrument pro/epilogue for the SPS profiler

RESOLVED FIXED

Status

()

Core
JavaScript Engine
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: u443197, Assigned: u443197)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

30.66 KB, patch
dvander
: review+
Details | Diff | Splinter Review
(Assignee)

Description

5 years ago
As with JaegerMonkey, add instrumentation to IonMonkey JIT code which instruments pro/epilogue to track function entry/exits.
(Assignee)

Updated

5 years ago
Assignee: general → acrichton
Status: NEW → ASSIGNED
(Assignee)

Updated

5 years ago
Blocks: 774767
(Assignee)

Updated

5 years ago
Blocks: 736299
(Assignee)

Comment 1

5 years ago
Created attachment 644182 [details] [diff] [review]
patch

Currently running through try. Last run in try had some ARM build failures that should be fixed now, and some sporadic failures of tests which also fail if I roll back my changes.

I'll do a follow-up patch which respects the slowAssertions field of the SPSProfiler unless it's more appropriate to do here.
Attachment #644182 - Flags: review?(nicolas.b.pierron)
Attachment #644182 - Flags: review?(luke)
Comment on attachment 644182 [details] [diff] [review]
patch

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

::: js/src/ion/Bailouts.cpp
@@ +571,5 @@
> +    // When bailing out from an argument check, none of the code of the
> +    // function has run yet. When profiling, this means that the function
> +    // hasn't flagged its entry just yet. It has been "entered," however, so we
> +    // flag it here manually that the entry has happened.
> +    if (br->bailoutKind() == Bailout_ArgumentCheck) {

Drive-by comment: is it possible to move this check earlier? The less state about bailouts we have to communicate around, the better.

::: js/src/ion/arm/CodeGenerator-arm.cpp
@@ +1424,5 @@
> +bool
> +CodeGeneratorARM::generateCounterAdd(Register temp, void *addr, int32_t delta)
> +{
> +    masm.load32(AbsoluteAddress(addr), temp);
> +    masm.ma_add(Imm32(delta), temp);

drive-by comment: It looks like you can use add32 and move this function to CodeGenerator.h/cpp (and if add32 doesn't exist, feel free to add a helper to MacroAssembler)

Looks great otherwise!
(Assignee)

Comment 3

5 years ago
Created attachment 644201 [details] [diff] [review]
patch2

Added things to use add32 with an Address, and moved Probes::enterScript for when argument checking fails.
Attachment #644182 - Attachment is obsolete: true
Attachment #644182 - Flags: review?(nicolas.b.pierron)
Attachment #644182 - Flags: review?(luke)
Attachment #644201 - Flags: review?(nicolas.b.pierron)
Attachment #644201 - Flags: review?(luke)

Comment 4

5 years ago
Comment on attachment 644201 [details] [diff] [review]
patch2

I know pretty much nothing about this code so I'll defer.
Attachment #644201 - Flags: review?(luke) → review?(dvander)
Comment on attachment 644201 [details] [diff] [review]
patch2

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

Sounds good.

::: js/src/ion/CodeGenerator.cpp
@@ +3730,5 @@
> +    Register base = ToRegister(lir->temp2()->output());
> +
> +    // Check if there's still space on the stack
> +    masm.movePtr(ImmWord(profiler->size()), size);
> +    masm.load32(Address(size, 0), size);

I think you should rename your "size" function to something which map with the idea of a pointer such as sizePointer.

@@ +3732,5 @@
> +    // Check if there's still space on the stack
> +    masm.movePtr(ImmWord(profiler->size()), size);
> +    masm.load32(Address(size, 0), size);
> +    Label stackFull;
> +    masm.branch32(Assembler::GreaterThanOrEqual, size, Imm32(profiler->maxSize()),

uint32_t *size() { return size_; }
uint32_t maxSize() { return max_; }

Because here, I am lost.

::: js/src/ion/IonBuilder.cpp
@@ +2540,5 @@
>          break;
>      }
>  
> +    if (instrumentedProfiling())
> +        current->add(MInstrumentationExit::New());

You might want to look at JSOP_STOP too.

::: js/src/ion/IonFrames.cpp
@@ +307,1 @@
>                  CloseLiveIterators(cx, frames);

CloseLiveIterator is part of the frame, you might want to move it before you declare the exitScript.

::: js/src/ion/LOpcodes.h
@@ +155,5 @@
>      _(InstanceOfO)                  \
>      _(InstanceOfV)                  \
> +    _(InterruptCheck)               \
> +    _(InstrumentationEnter)         \
> +    _(InstrumentationExit)

nit: May be something like SPSProfilerPush & SPSProfilerPop would be more helpful ;)
Attachment #644201 - Flags: review?(nicolas.b.pierron) → review+
(Assignee)

Comment 6

5 years ago
Created attachment 644527 [details] [diff] [review]
patch3

Incorporates Nicolas' requested renamings and such.
Attachment #644201 - Attachment is obsolete: true
Attachment #644201 - Flags: review?(dvander)
Attachment #644527 - Flags: review?(dvander)
Attachment #644527 - Flags: review?(dvander) → review+
(Assignee)

Comment 7

5 years ago
http://hg.mozilla.org/projects/ionmonkey/rev/23a84dbb258f
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.