Add notes to disassembler for shared binary tables

This commit is contained in:
Yoshi Askharoun
2024-12-30 11:04:45 -06:00
parent cbc4d6149f
commit 1e43ec3257
+11 -4
View File
@@ -184,12 +184,13 @@ public class Disassembler
public IEnumerable<ConstantDirective> GetConstants()
{
var constantsTable = _loadResult.ConstantsTable;
List<(int c, TypeSchema typeSchema, object constantValue)> constants = new();
bool canUsePersistList = constantsTable.PersistList is not null;
if (canUsePersistList)
var constantsTable = _loadResult.ConstantsTable;
bool hasPersistList = constantsTable.PersistList is not null;
bool hasSharedBinaryTable = _loadResult.BinaryDataTable?.SharedDependenciesTableWithBinaryDataTable is not null;
if (hasPersistList)
{
var persistedList = _loadResult.ConstantsTable.PersistList;
@@ -201,6 +202,11 @@ public class Disassembler
constants.Add((c, typeSchema, persistedConstant.Data));
}
}
else if (hasSharedBinaryTable)
{
// Constants need to be imported from the shared binary table
}
else
{
// UIB doesn't persist constants, so we have to use an alternate, slower method
@@ -260,6 +266,7 @@ public class Disassembler
// Refer to the constant by name rather than index
var constantIndex = reader.ReadUInt16();
// TODO: Only generate name if not using a shared binary table
operand = new OperandReference($"const{constantIndex}");
}
else