Avoid buffer allocations in CodeGenContext.GetCode(). Avoid stream allocations in PTC.PtcInfo.
Refactoring/nits.
This commit is contained in:
parent
b767d1a6b0
commit
f44271a617
6 changed files with 78 additions and 90 deletions
|
@ -9,7 +9,8 @@ namespace ARMeilleure.Translation.PTC
|
|||
private readonly BinaryWriter _relocWriter;
|
||||
private readonly BinaryWriter _unwindInfoWriter;
|
||||
|
||||
public MemoryStream CodeStream { get; }
|
||||
public byte[] Code { get; set; }
|
||||
|
||||
public MemoryStream RelocStream { get; }
|
||||
public MemoryStream UnwindInfoStream { get; }
|
||||
|
||||
|
@ -17,7 +18,6 @@ namespace ARMeilleure.Translation.PTC
|
|||
|
||||
public PtcInfo()
|
||||
{
|
||||
CodeStream = new MemoryStream();
|
||||
RelocStream = new MemoryStream();
|
||||
UnwindInfoStream = new MemoryStream();
|
||||
|
||||
|
@ -27,11 +27,6 @@ namespace ARMeilleure.Translation.PTC
|
|||
RelocEntriesCount = 0;
|
||||
}
|
||||
|
||||
public void WriteCode(MemoryStream codeStream)
|
||||
{
|
||||
codeStream.WriteTo(CodeStream);
|
||||
}
|
||||
|
||||
public void WriteRelocEntry(RelocEntry relocEntry)
|
||||
{
|
||||
_relocWriter.Write((int)relocEntry.Position);
|
||||
|
@ -60,7 +55,6 @@ namespace ARMeilleure.Translation.PTC
|
|||
_relocWriter.Dispose();
|
||||
_unwindInfoWriter.Dispose();
|
||||
|
||||
CodeStream.Dispose();
|
||||
RelocStream.Dispose();
|
||||
UnwindInfoStream.Dispose();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue