public override string Convert(ASM.ASMBlock theBlock) { StringBuilder ASMResult = new StringBuilder(); ASMResult.AppendLine("# Method Table - " + CurrentTypeName); ASMResult.AppendLine(".globl " + CurrentTypeId + "_MethodTable"); ASMResult.AppendLine(".align 2"); ASMResult.AppendLine(CurrentTypeId + "_MethodTable:"); foreach (Tuple <string, string> aMethodInfo in AllMethodInfos) { string MethodID = aMethodInfo.Item1; string MethodIDValue = aMethodInfo.Item2; foreach (Tuple <string, int> anEntryFieldInfo in TableEntryFieldInfos) { string allocString = ASMUtilities.GetAllocStringForSize(anEntryFieldInfo.Item2); switch (anEntryFieldInfo.Item1) { case "MethodID": ASMResult.AppendLine(allocString + " " + MethodIDValue); break; case "MethodPtr": ASMResult.AppendLine(allocString + " " + MethodID); break; } } } ASMResult.AppendLine("# Method Table End - " + CurrentTypeName); return(ASMResult.ToString()); }
public override string Convert(ASM.ASMBlock theBlock) { StringBuilder ASMResult = new StringBuilder(); ASMResult.AppendLine(".globl " + TypeId); ASMResult.AppendLine(".align 2"); ASMResult.AppendLine(TypeId + ":"); foreach (Tuple <string, Types.TypeInfo> aFieldInfo in FieldInformation) { string allocStr = ASMUtilities.GetAllocStringForSize( aFieldInfo.Item2.IsValueType ? aFieldInfo.Item2.SizeOnHeapInBytes : aFieldInfo.Item2.SizeOnStackInBytes); switch (aFieldInfo.Item1) { case "Size": ASMResult.AppendLine(allocStr + " " + SizeVal); break; case "Id": ASMResult.AppendLine(allocStr + " " + IdVal); break; case "StackSize": ASMResult.AppendLine(allocStr + " " + StackSizeVal); break; case "IsValueType": ASMResult.AppendLine(allocStr + " " + IsValueTypeVal); break; case "MethodTablePtr": ASMResult.AppendLine(allocStr + " " + MethodTablePointer); break; case "IsPointer": ASMResult.AppendLine(allocStr + " " + IsPointerTypeVal); break; case "TheBaseType": ASMResult.AppendLine(allocStr + " " + BaseTypeIdVal); break; case "FieldTablePtr": ASMResult.AppendLine(allocStr + " " + FieldTablePointer); break; case "Signature": ASMResult.AppendLine(allocStr + " " + TypeSignatureLiteralLabel); break; case "IdString": ASMResult.AppendLine(allocStr + " " + TypeIdLiteralLabel); break; } } ASMResult.AppendLine(); return(ASMResult.ToString()); }
public override string Convert(ASM.ASMBlock theBlock) { StringBuilder ASMResult = new StringBuilder(); ASMResult.AppendLine("# Field Table - " + CurrentTypeName); ASMResult.AppendLine(".globl " + CurrentTypeId + "_FieldTable"); ASMResult.AppendLine(".align 2"); ASMResult.AppendLine(CurrentTypeId + "_FieldTable:"); foreach (Tuple <string, string, string> aFieldInfo in AllFieldInfos) { string fieldOffsetVal = aFieldInfo.Item1; string fieldSizeVal = aFieldInfo.Item2; string fieldTypeIdVal = aFieldInfo.Item3; foreach (Tuple <string, int> anEntryFieldInfo in TableEntryFieldInfos) { string allocStr = ASMUtilities.GetAllocStringForSize(anEntryFieldInfo.Item2); switch (anEntryFieldInfo.Item1) { case "Offset": ASMResult.AppendLine(allocStr + " " + fieldOffsetVal); break; case "Size": ASMResult.AppendLine(allocStr + " " + fieldSizeVal); break; case "FieldType": ASMResult.AppendLine(allocStr + " " + fieldTypeIdVal); break; } } } ASMResult.AppendLine("# Field Table End - " + CurrentTypeName); return(ASMResult.ToString()); }