InterpreterModule.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. #include "os/ThreadLocalValue.h"
  3. #include "../CommonDef.h"
  4. #include "MethodBridge.h"
  5. #include "Engine.h"
  6. #include "../metadata/Image.h"
  7. namespace hybridclr
  8. {
  9. namespace interpreter
  10. {
  11. class InterpreterModule
  12. {
  13. public:
  14. static void Initialize();
  15. static MachineState& GetCurrentThreadMachineState();
  16. static void FreeThreadLocalMachineState();
  17. static InterpMethodInfo* GetInterpMethodInfo(const MethodInfo* methodInfo);
  18. static Il2CppMethodPointer GetMethodPointer(const Il2CppMethodDefinition* method);
  19. static Il2CppMethodPointer GetMethodPointer(const MethodInfo* method);
  20. static Il2CppMethodPointer GetAdjustThunkMethodPointer(const Il2CppMethodDefinition* method);
  21. static Il2CppMethodPointer GetAdjustThunkMethodPointer(const MethodInfo* method);
  22. static Managed2NativeCallMethod GetManaged2NativeMethodPointer(const MethodInfo* method, bool forceStatic);
  23. static Managed2NativeCallMethod GetManaged2NativeMethodPointer(const metadata::ResolveStandAloneMethodSig& methodSig);
  24. static InvokerMethod GetMethodInvoker(const Il2CppMethodDefinition* method);
  25. static InvokerMethod GetMethodInvoker(const MethodInfo* method);
  26. static bool IsImplementsByInterpreter(const MethodInfo* method);
  27. static bool HasImplementCallNative2Managed(const MethodInfo* method)
  28. {
  29. IL2CPP_ASSERT(method->methodPointerCallByInterp != NotSupportAdjustorThunk);
  30. return method->methodPointerCallByInterp != (Il2CppMethodPointer)NotSupportNative2Managed;
  31. }
  32. static bool HasImplementCallVirtualNative2Managed(const MethodInfo* method)
  33. {
  34. IL2CPP_ASSERT(method->virtualMethodPointerCallByInterp != NotSupportNative2Managed);
  35. return method->virtualMethodPointerCallByInterp != (Il2CppMethodPointer)NotSupportAdjustorThunk;
  36. }
  37. static void Managed2NativeCallByReflectionInvoke(const MethodInfo* method, uint16_t* argVarIndexs, StackObject* localVarBase, void* ret);
  38. static void NotSupportNative2Managed();
  39. static void NotSupportAdjustorThunk();
  40. static const char* GetValueTypeSignature(const char* fullName);
  41. private:
  42. static il2cpp::os::ThreadLocalValue s_machineState;
  43. };
  44. }
  45. }