Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ private void PublishCode()
_compilation.NodeFactory.Target.MinimumFunctionAlignment :
_compilation.NodeFactory.Target.OptimumFunctionAlignment;

alignment = Math.Max(alignment, _codeAlignment);

var objectData = new ObjectNode.ObjectData(_code,
relocs,
alignment,
Expand Down Expand Up @@ -2516,6 +2518,7 @@ private void MethodCompileComplete(CORINFO_METHOD_STRUCT_* methHnd)

private byte[] _code;
private byte[] _coldCode;
private int _codeAlignment;

private byte[] _roData;

Expand All @@ -2535,11 +2538,25 @@ private void allocMem(uint hotCodeSize, uint coldCodeSize, uint roDataSize, uint
if (coldCodeSize != 0)
coldCodeBlock = (void*)GetPin(_coldCode = new byte[coldCodeSize]);

_codeAlignment = -1;
if ((flag & CorJitAllocMemFlag.CORJIT_ALLOCMEM_FLG_32BYTE_ALIGN) != 0)
{
_codeAlignment = 32;
}
else if ((flag & CorJitAllocMemFlag.CORJIT_ALLOCMEM_FLG_16BYTE_ALIGN) != 0)
{
_codeAlignment = 16;
}

if (roDataSize != 0)
{
int alignment = 8;

if ((flag & CorJitAllocMemFlag.CORJIT_ALLOCMEM_FLG_RODATA_16BYTE_ALIGN) != 0)
if ((flag & CorJitAllocMemFlag.CORJIT_ALLOCMEM_FLG_RODATA_32BYTE_ALIGN) != 0)
{
alignment = 32;
}
else if ((flag & CorJitAllocMemFlag.CORJIT_ALLOCMEM_FLG_RODATA_16BYTE_ALIGN) != 0)
{
alignment = 16;
}
Expand Down