Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Node byte data emission #1648

Merged
merged 1 commit into from
Aug 22, 2016
Merged

Node byte data emission #1648

merged 1 commit into from
Aug 22, 2016

Conversation

A-And
Copy link
Contributor

@A-And A-And commented Aug 12, 2016

Emitting the byte data of a node instead of generating contents "by hand".

@nattress @MichalStrehovsky @jkotas

case RelocType.IMAGE_REL_BASED_DIR64:
size = 8;
break;
case RelocType.IMAGE_REL_BASED_REL32:
Copy link
Member

Choose a reason for hiding this comment

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

I do not think IMAGE_REL_BASED_REL32 relocs are going to work for CppCodeGen.

I think you should just assert here that you are only getting pointer reloc here, something like:
Debug.Assert(reloc.RelocType == (PointerSize == 8) ? RelocType.IMAGE_REL_BASED_DIR64 : RelocType.IMAGE_REL_BASED_HIGHLOW);

@A-And A-And changed the title Node byte data emission [WIP] Node byte data emission Aug 12, 2016
@A-And A-And force-pushed the NodeByteEmission branch 2 times, most recently from d900ba1 to d4235db Compare August 13, 2016 00:17
@@ -70,6 +70,7 @@ struct RawEEType
uint16_t m_usNumVtableSlots;
uint16_t m_usNumInterfaces;
uint32_t m_uHashCode;
void* m_pIndirectionModule;
Copy link
Contributor

@nattress nattress Aug 15, 2016

Choose a reason for hiding this comment

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

Nit: the indentation looks messed up here - please convert the tabs to spaces

@A-And A-And force-pushed the NodeByteEmission branch from 305087a to 0dadfea Compare August 17, 2016 00:15
@A-And A-And closed this Aug 17, 2016
@A-And A-And reopened this Aug 17, 2016
@A-And A-And changed the title [WIP] Node byte data emission Node byte data emission Aug 17, 2016
@A-And A-And force-pushed the NodeByteEmission branch from b8bc632 to d3e844c Compare August 17, 2016 18:00
{
var sb = new CppGenerationBuffer();
List<Tuple<bool, int>> nodeDataDivs = new List<Tuple<bool, int>>();
byte[] actualData = new byte[nodeData.Data.Length];
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you look into reducing the need for a copy of the bytes here? Ideally we only ever read bytes from nodeData.Data and don't copy them into actualData

@A-And
Copy link
Contributor Author

A-And commented Aug 17, 2016

@MichalStrehovsky @jkotas Could you take another look at this?

@jkotas
Copy link
Member

jkotas commented Aug 18, 2016

@dotnet-bot test Windows_NT Debug please

private String GetCodeForType(TypeDesc type)
{
var sb = new CppGenerationBuffer();
List<Tuple<bool, int>> nodeDataDivs = new List<Tuple<bool, int>>();
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Tuple<bool,int> is kind of hard to read - you have to keep in your head what Item1 and Item2 means. I think it would look better to define a helper struct with actual field names for it, like we do everywhere else (e.g. take struct Relocation as an example).

@jkotas
Copy link
Member

jkotas commented Aug 18, 2016

LGTM modulo a few minor comments

if (baseType != null)
AppendVirtualSlots(sb, implType, baseType);
// virtual slots
var nodeData = (node as ObjectNode).GetData(factory, false);
Copy link
Member

Choose a reason for hiding this comment

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

If ObjectNode is the only node type this method can handle, make the method take ObjectNode instead of DependencyNode?

Emitting the byte data of a node instead of generating contents "by hand". Added emission of optional type fields.
@A-And A-And force-pushed the NodeByteEmission branch from 22381e0 to 07657b2 Compare August 22, 2016 21:48
@jkotas jkotas merged commit 78347f0 into dotnet:master Aug 22, 2016
@jkotas
Copy link
Member

jkotas commented Aug 22, 2016

Thanks!

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.

5 participants