Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Support for CFI Unwind#1011

Merged
kyulee1 merged 1 commit intodotnet:masterfrom
kyulee1:cfi
Jan 29, 2016
Merged

Support for CFI Unwind#1011
kyulee1 merged 1 commit intodotnet:masterfrom
kyulee1:cfi

Conversation

@kyulee1
Copy link
Contributor

@kyulee1 kyulee1 commented Jan 26, 2016

This adds the following CFI unwind emission.
EmitCFIStart
EmitCFIEnd
EmitCFIBlob

The first two sets the range of the code that the frame covers.
The last one should be invoked for each offset of the code, if any.
The blob data format is shared by the one RyuJit layouts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Offset is not used, instead MC API will create/insert label to the code directly. But I'd like to keep this on purpose in case we need offset information later. The same thing applies to the following APIs.

@kyulee1
Copy link
Contributor Author

kyulee1 commented Jan 26, 2016

The corresponding RyuJit change is -- dotnet/coreclr#2868
@AndyAyersMS @pgavlin PTAL

@AndyAyersMS
Copy link
Member

LGTM.

Is it the case that callers should always invoke these methods in a particular sequence eg: start, blob, [blob,] end? It would be nice to add checks for this but it doesn't look like there is any convenient place to record a bit of state.

@kyulee1
Copy link
Contributor Author

kyulee1 commented Jan 26, 2016

That's right although such assertion is done in CoreRT or LLVM backend.
I added checks.

@kyulee1
Copy link
Contributor Author

kyulee1 commented Jan 28, 2016

Updated the code to consume cfi.h from CoreCLR.

Copy link
Contributor

Choose a reason for hiding this comment

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

So is the idea here that CoreRT will do something like:

EmitCFIStart(ow, ...);

uint8_t *cfiBlob = ...; uint32_t cfiBlobSize = ...;
for (int offset = 0; offset < cfiBlobSize; offset += ?) {
    EmitCFIBlock(ow, &cfiBlob[offset]);
}
EmitCFIEnd(ow);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is full code for it -- dotnet/corert#752

Copy link
Contributor

Choose a reason for hiding this comment

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

I might call this "EmitCFICode" instead of "EmitCFIBlob", then. IMO "EmitCFIBlob" implies that this function may process multiple CFI instructions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. Will update it.

This adds the following CFI unwind emission.
EmitCFIStart
EmitCFIEnd
EmitCFICode

The first two sets the range of the code that the frame covers.
The last one should be invoked for each offset of the code, if any.
The blob data format is shared by the one RyuJit layouts.
kyulee1 added a commit that referenced this pull request Jan 29, 2016
@kyulee1 kyulee1 merged commit 4da2a19 into dotnet:master Jan 29, 2016
@kyulee1 kyulee1 deleted the cfi branch January 29, 2016 15:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants