addressed comment, assign previously unassigned address field

This commit is contained in:
emmaus 2020-01-19 12:14:31 +00:00 committed by emmauss
commit 4e807fb612
3 changed files with 8 additions and 7 deletions

View file

@ -93,9 +93,9 @@ namespace ARMeilleure.Translation
return allocOffset; return allocOffset;
} }
public static void Free(ulong address) public static void Free(IntPtr address)
{ {
ulong offset = address - (ulong)_basePointer; ulong offset = (ulong)address - (ulong)_basePointer;
lock (_lock) lock (_lock)
{ {
@ -119,7 +119,7 @@ namespace ARMeilleure.Translation
{ {
lock (_lock) lock (_lock)
{ {
if(_cacheEntries.TryGetValue(offset, out entry)) if (_cacheEntries.TryGetValue(offset, out entry))
{ {
return true; return true;
} }

View file

@ -77,7 +77,7 @@ namespace ARMeilleure.Translation
{ {
if ((uint)offset >= (ulong)_size) if ((uint)offset >= (ulong)_size)
{ {
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException("offset");
} }
var node = _memoryRanges.First; var node = _memoryRanges.First;
@ -86,7 +86,7 @@ namespace ARMeilleure.Translation
{ {
if (node == null) if (node == null)
{ {
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException("offset");
} }
if (offset <= node.Value.End) if (offset <= node.Value.End)

View file

@ -6,7 +6,7 @@ namespace ARMeilleure.Translation
{ {
class TranslatedFunction class TranslatedFunction
{ {
public ulong Pointer => (ulong)Marshal.GetFunctionPointerForDelegate(_func); public IntPtr Pointer => Marshal.GetFunctionPointerForDelegate(_func);
public int EntryCount; public int EntryCount;
@ -20,8 +20,9 @@ namespace ARMeilleure.Translation
public TranslatedFunction(GuestFunction func, ulong address, bool rejit) public TranslatedFunction(GuestFunction func, ulong address, bool rejit)
{ {
_func = func; _func = func;
_rejit = rejit; _rejit = rejit;
_address = address;
} }
public ulong Execute(State.ExecutionContext context) public ulong Execute(State.ExecutionContext context)