TranslatedFunction.cs 849 B

1234567891011121314151617181920212223242526272829
  1. using ARMeilleure.Common;
  2. using System;
  3. namespace ARMeilleure.Translation
  4. {
  5. class TranslatedFunction
  6. {
  7. private readonly GuestFunction _func; // Ensure that this delegate will not be garbage collected.
  8. public IntPtr FuncPointer { get; }
  9. public Counter<uint> CallCounter { get; }
  10. public ulong GuestSize { get; }
  11. public bool HighCq { get; }
  12. public TranslatedFunction(GuestFunction func, IntPtr funcPointer, Counter<uint> callCounter, ulong guestSize, bool highCq)
  13. {
  14. _func = func;
  15. FuncPointer = funcPointer;
  16. CallCounter = callCounter;
  17. GuestSize = guestSize;
  18. HighCq = highCq;
  19. }
  20. public ulong Execute(State.ExecutionContext context)
  21. {
  22. return _func(context.NativeContextPtr);
  23. }
  24. }
  25. }