Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 1 addition & 8 deletions source/MetadataProcessor.Core/Tables/nanoSignaturesTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public int GetHashCode(byte[] that)

static nanoSignaturesTable()
{
PrimitiveTypes.Add(typeof(void).FullName, nanoCLR_DataType.DATATYPE_VALUETYPE);
PrimitiveTypes.Add(typeof(void).FullName, nanoCLR_DataType.DATATYPE_VOID);

PrimitiveTypes.Add(typeof(sbyte).FullName, nanoCLR_DataType.DATATYPE_I1);
PrimitiveTypes.Add(typeof(short).FullName, nanoCLR_DataType.DATATYPE_I2);
Expand All @@ -69,13 +69,6 @@ static nanoSignaturesTable()
PrimitiveTypes.Add(typeof(IntPtr).FullName, nanoCLR_DataType.DATATYPE_VALUETYPE);
//PrimitiveTypes.Add(typeof(UIntPtr).FullName, nanoCLR_DataType.DATATYPE_U4);

PrimitiveTypes.Add("System.DateTime", nanoCLR_DataType.DATATYPE_DATETIME);
PrimitiveTypes.Add("System.TimeSpan", nanoCLR_DataType.DATATYPE_TIMESPAN);

PrimitiveTypes.Add("System.RuntimeTypeHandle", nanoCLR_DataType.DATATYPE_REFLECTION);
PrimitiveTypes.Add("System.RuntimeFieldHandle", nanoCLR_DataType.DATATYPE_REFLECTION);
PrimitiveTypes.Add("System.RuntimeMethodHandle", nanoCLR_DataType.DATATYPE_REFLECTION);

PrimitiveTypes.Add("System.WeakReference", nanoCLR_DataType.DATATYPE_WEAKCLASS);
}

Expand Down
21 changes: 20 additions & 1 deletion source/MetadataProcessor.Core/Utility/NativeMethodsCrc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,26 @@ internal static string GetnanoClrTypeName(TypeReference parameterType)
nanoCLR_DataType myType;
if(nanoSignaturesTable.PrimitiveTypes.TryGetValue(parameterType.FullName, out myType))
{
return myType.ToString();
if (myType == nanoCLR_DataType.DATATYPE_LAST_PRIMITIVE)
{
return "DATATYPE_STRING";
}
else if (myType == nanoCLR_DataType.DATATYPE_LAST_NONPOINTER)
{
return "DATATYPE_TIMESPAN";
}
else if (myType == nanoCLR_DataType.DATATYPE_LAST_PRIMITIVE_TO_MARSHAL)
{
return "DATATYPE_TIMESPAN";
}
else if (myType == nanoCLR_DataType.DATATYPE_LAST_PRIMITIVE_TO_PRESERVE)
{
return "DATATYPE_R8";
}
else
{
return myType.ToString();
}
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion source/MetadataProcessor.Core/Utility/nanoCLR_DataType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public enum nanoCLR_DataType : byte

// All the above types can be marshaled by assignment.
#if NANOCLR_NO_ASSEMBLY_STRINGS
DATATYPE_LAST_PRIMITIVE_TO_MARSHAL = DATATYPE_STRING,
DATATYPE_LAST_PRIMITIVE_TO_MARSHAL = DATATYPE_STRING,
#else
DATATYPE_LAST_PRIMITIVE_TO_MARSHAL = DATATYPE_TIMESPAN,
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal enum nanoSerializationType : byte
ELEMENT_TYPE_STRING = 0xe,

// every type above PTR will be simple type
ELEMENT_TYPE_PTR = 0xf, // PTR <type>
ELEMENT_TYPE_PTR = 0x0F, // PTR <type>
ELEMENT_TYPE_BYREF = 0x10, // BYREF <type>

// Please use ELEMENT_TYPE_VALUETYPE. ELEMENT_TYPE_VALUECLASS is deprecated.
Expand Down
7 changes: 6 additions & 1 deletion source/MetadataProcessor.Core/nanoDumperGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,15 @@ private string PrintSignatureForType(TypeReference type)
case nanoCLR_DataType.DATATYPE_U8:
case nanoCLR_DataType.DATATYPE_R4:
case nanoCLR_DataType.DATATYPE_R8:
case nanoCLR_DataType.DATATYPE_STRING:
case nanoCLR_DataType.DATATYPE_BYREF:
case nanoCLR_DataType.DATATYPE_OBJECT:
return dataType.ToString().Replace("DATATYPE_", "");

case nanoCLR_DataType.DATATYPE_LAST_PRIMITIVE:
return "STRING";

case nanoCLR_DataType.DATATYPE_REFLECTION:
return type.FullName.Replace(".", "");
}
}

Expand Down
40 changes: 32 additions & 8 deletions source/native/Tools.Parser/AssemblyParserDump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,36 +493,60 @@ void MetaData::Parser::Dump_EnumTypeDefs( bool fNoByteCode )
const CLR_UINT8* IP = il.Code;
const CLR_UINT8* IPend = IP + il.GetCodeSize();

CLR_UINT16 ilCount = 0;

// 1st pass: count the number of instructions
while(IP < IPend)
{
CLR_OPCODE op = CLR_ReadNextOpcode( IP );

fwprintf( m_output, L" %-12S", c_CLR_RT_OpcodeLookup[op].m_name );

if(IsOpParamToken( c_CLR_RT_OpcodeLookup[op].m_opParam ))
{
CLR_UINT32 arg; NANOCLR_READ_UNALIGNED_UINT32( arg, IP );

fwprintf( m_output, L"[%08x]", arg );
}
else
{
IP = CLR_SkipBodyOfOpcode( IP, op );
}

fwprintf( m_output, L"\n" );
ilCount++;
}

fwprintf(m_output, L" IL count: %d\n", ilCount);

IP = il.Code;
IPend = IP + il.GetCodeSize();

// 2nd pass: output the instructions
while (IP < IPend)
{
CLR_OPCODE op = CLR_ReadNextOpcode(IP);

fwprintf(m_output, L" %-12S", c_CLR_RT_OpcodeLookup[op].m_name);

if (IsOpParamToken(c_CLR_RT_OpcodeLookup[op].m_opParam))
{
CLR_UINT32 arg; NANOCLR_READ_UNALIGNED_UINT32(arg, IP);

fwprintf(m_output, L"[%08x]", arg);
}
else
{
IP = CLR_SkipBodyOfOpcode(IP, op);
}

fwprintf(m_output, L"\n");
}

}
}

fwprintf( m_output, L"\n" );
}

for(mdInterfaceImplListIter it3 = td.m_interfaces.begin(); it3 != td.m_interfaces.end(); it3++)
{
InterfaceImpl& ii = m_mapDef_Interface[*it3];

fwprintf( m_output, L" InterfaceImplProps [%08x]: Itf: %08x\n", ii.m_td, ii.m_itf );
fwprintf( m_output, L" InterfaceImplProps [%08x]: Itf: %08x\n", *it3, ii.m_itf );
}

fwprintf( m_output, L"\n" );
Expand Down