Skip to content

Handle invokeSuspend edge case in the Weaver #2201

Open
@kanderson250

Description

In an effort to support Kotlin Coroutines instrumentation, modify the weaver to support the edge case presented by Kotlin bytecode for invokeSuspend.

The issue was investigated as a spike in #2002 , where errors were thrown during weaving of invokeSuspend. The investigation found that the Kotlin compiler intentionally duplicates operands on the stack prior to return instructions in the body of invokeSuspend. Though innocuous for return instructions, these extra operands cause bytecode verification to fail when return is replaced with goto (which is how the agent performs its bytecode modification).

We should update the weaver to handle this edge case, so that weaving for invokeSuspend succeeds. This fix should be wrapped in a feature flag/some kind of blocker to prevent the fix from applying to any other methods at this time.

Metadata

Assignees

Labels

3Story Point Estimatejan-mar qtrRepresents proposed work item for the Jan-Mar quarter

Type

No type

Projects

  • Status

    In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions