Bug 1733810 Comment 5 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

And you're totally right, if there's inlining, we do not currently have enough information to get the ordering correct.

Here's one way we could get it correct:

 1. When pushing a profiler label, also record the current instruction pointer value. (This will increase the label frame size by one pointer, and might have some effect on code size as well.)
 2. Put this instruction pointer value into the profile JSON, associated with the label frame.
 3. During symbolication, get the inline stack for "the place where the label frame was pushed". Then, have a merging step where the stacks get reordered in such a way that everything looks correct.

For example, if we have the following stack, from inside to outside:

```
0x1234
"Label frame" (pushed at 0x1200)
...
```

Symbolication gives us the following inline stack for those two addresses:

0x1234: InnerInlinedFunction, MidLevelInlinedFunction, OuterFunction
0x1200: MidLevelInlinedFunction, OuterFunction

Then we could create a stack like this, from inside to outside:

```
InnerInlinedFunction
Label frame
MidLevelInlinedFunction
OuterFunction
```
And you're totally right, if there's inlining, we do not currently have enough information to get the ordering correct.

Here's one way we could get it correct:

 1. When pushing a profiler label, also record the current instruction pointer value. (This will increase the label frame size by one pointer, and might have some effect on code size as well.)
 2. Put this instruction pointer value into the profile JSON, associated with the label frame.
 3. During symbolication, get the inline stack for "the place where the label frame was pushed". Then, have a merging step where the stacks get reordered in such a way that everything looks correct.

For example, if we have the following stack, from inside to outside:

```
0x1234
"Label frame" (pushed at 0x1200)
...
```

Symbolication gives us the following inline stack for those two addresses:

0x1234: InnerInlinedFunction, MidLevelInlinedFunction, OuterFunction
0x1200: MidLevelInlinedFunction, OuterFunction

Then we could create a stack like this, from inside to outside:

```
InnerInlinedFunction
Label frame
MidLevelInlinedFunction
OuterFunction
...
```

Back to Bug 1733810 Comment 5