Skip to content

Conversation

@nhat-nguyen
Copy link
Contributor

Since bailing in happens in the jit'd code, we have to generate code to output the trace. If tracing is enabled, we will fill the array of bail-in symbols in the generator instance (bailInSymbolsTraceArray) with their ids and values and finally output them with a call to a runtime helper.

-trace:bailin together with -trace:bailout -verbose can help us easily debug jit'd generators by comparing the values when bailing out for yield and bailing in:

BailOut: function: func68 ( (#1.1), #2) offset: #003f Opcode: Yield Kind: BailOutForGeneratorYield
BailOut:   Register #  0: Not live
BailOut:   Register #  1: Constant table
BailOut:   Register #  2: Register r15     16, value: 0x0000023CE132EEA0 (Yield Return Value)
BailOut:   Register #  3: Register r12     13, value: 0x0001000000000004
BailOut:   Return Value: 0x0000023CE132EEA0

BailIn: function: func68 ( (#1.1), #2) offset: #0042
BailIn: Register #   3, value: 0x0001000000000004
BailOut: function: func68 ( (#1.1), #2) offset: #006b Opcode: Yield Kind: BailOutForGeneratorYield
BailOut:   Register #  0: Not live
BailOut:   Register #  1: Constant table
BailOut:   Register #  3: Register r15     16, value: 0x0000023CE133E060 (Yield Return Value)
BailOut:   Return Value: 0x0000023CE133E060

BailIn: function: func68 ( (#1.1), #2) offset: #006e
BailIn: No symbols reloaded

@nhat-nguyen nhat-nguyen changed the base branch from builtins to master June 26, 2019 23:15
@nhat-nguyen nhat-nguyen requested a review from MikeHolman June 27, 2019 18:42
Since bailing in happens in the jit'd code, we have to generate code to output the trace. If tracing is enabled, we will fill the array of bail-in symbols in the generator instance (`bailInSymbolsTraceArray`) with their ids and values and finally output them with a call to a runtime helper.

`-trace:bailin` together with `-trace:bailout -verbose` can help us easily debug jit'd generators by comparing the values when bailing out for `yield` and bailing in:

```
BailOut: function: func68 ( (chakra-core#1.1), chakra-core#2) offset: #003f Opcode: Yield Kind: BailOutForGeneratorYield
BailOut: Register # 0: Not live
BailOut: Register # 1: Constant table
BailOut: Register # 2: Register r15 16, value: 0x0000023CE132EEA0 (Yield Return Value)
BailOut: Register # 3: Register r12 13, value: 0x0001000000000004
BailOut: Return Value: 0x0000023CE132EEA0

BailIn: function: func68 ( (chakra-core#1.1), chakra-core#2) offset: chakra-core#42
BailIn: Register # 3, value: 0x0001000000000004
```

```
BailOut: function: func68 ( (chakra-core#1.1), chakra-core#2) offset: #006b Opcode: Yield Kind: BailOutForGeneratorYield
BailOut: Register # 0: Not live
BailOut: Register # 1: Constant table
BailOut: Register # 3: Register r15 16, value: 0x0000023CE133E060 (Yield Return Value)
BailOut: Return Value: 0x0000023CE133E060

BailIn: function: func68 ( (chakra-core#1.1), chakra-core#2) offset: #006e
BailIn: No symbols reloaded
```
Copy link
Contributor

@MikeHolman MikeHolman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@chakrabot chakrabot merged commit 38df3a6 into chakra-core:master Jul 2, 2019
chakrabot pushed a commit that referenced this pull request Jul 2, 2019
…l-in

Merge pull request #6183 from nhat-nguyen:trace

Since bailing in happens in the jit'd code, we have to generate code to output the trace. If tracing is enabled, we will fill the array of bail-in symbols in the generator instance (`bailInSymbolsTraceArray`) with their ids and values and finally output them with a call to a runtime helper.

`-trace:bailin` together with `-trace:bailout -verbose` can help us easily debug jit'd generators by comparing the values when bailing out for `yield` and bailing in:

```
BailOut: function: func68 ( (#1.1), #2) offset: #003f Opcode: Yield Kind: BailOutForGeneratorYield
BailOut:   Register #  0: Not live
BailOut:   Register #  1: Constant table
BailOut:   Register #  2: Register r15     16, value: 0x0000023CE132EEA0 (Yield Return Value)
BailOut:   Register #  3: Register r12     13, value: 0x0001000000000004
BailOut:   Return Value: 0x0000023CE132EEA0

BailIn: function: func68 ( (#1.1), #2) offset: #42
BailIn: Register #   3, value: 0x0001000000000004
```

```
BailOut: function: func68 ( (#1.1), #2) offset: #006b Opcode: Yield Kind: BailOutForGeneratorYield
BailOut:   Register #  0: Not live
BailOut:   Register #  1: Constant table
BailOut:   Register #  3: Register r15     16, value: 0x0000023CE133E060 (Yield Return Value)
BailOut:   Return Value: 0x0000023CE133E060

BailIn: function: func68 ( (#1.1), #2) offset: #006e
BailIn: No symbols reloaded
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants