Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Node byte data emission - #1648

Merged
jkotas merged 1 commit into
dotnet:masterfrom
A-And:NodeByteEmission
Aug 22, 2016
Merged

jkotas merged 1 commit into
dotnet:masterfrom
A-And:NodeByteEmission

Conversation

@A-And

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Comment thread src/Native/Bootstrap/common.h Outdated
uint16_t m_usNumVtableSlots;
uint16_t m_usNumInterfaces;
uint32_t m_uHashCode;
void* m_pIndirectionModule;

@nattress nattress Aug 15, 2016 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

A-And commented Aug 17, 2016

Copy link
Copy Markdown
Contributor Author

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

@jkotas

jkotas commented Aug 18, 2016

Copy link
Copy Markdown
Member

@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
Copy Markdown
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

jkotas commented Aug 18, 2016

Copy link
Copy Markdown
Member

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
Copy Markdown
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.
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