少年修仙传客户端基础资源
hch
2024-04-01 d01413b00ef631ac20347716b23818b0b811f65f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "Engine.h"
 
#include "codegen/il2cpp-codegen.h"
 
#include "Interpreter.h"
#include "MemoryUtil.h"
 
namespace hybridclr
{
namespace interpreter
{
    InterpFrame* InterpFrameGroup::EnterFrameFromInterpreter(const InterpMethodInfo* imi, StackObject* argBase)
    {
#if IL2CPP_ENABLE_PROFILER
        il2cpp_codegen_profiler_method_enter(imi->method);
#endif
        int32_t oldStackTop = _machineState.GetStackTop();
        StackObject* stackBasePtr = _machineState.AllocStackSlot(imi->maxStackSize - imi->argStackObjectSize);
        InterpFrame* newFrame = _machineState.PushFrame();
        *newFrame = { imi, argBase, oldStackTop, nullptr, nullptr, nullptr, 0, 0, _machineState.GetLocalPoolBottomIdx() };
        PUSH_STACK_FRAME(imi->method);
        return newFrame;
    }
 
 
    InterpFrame* InterpFrameGroup::EnterFrameFromNative(const InterpMethodInfo* imi, StackObject* argBase)
    {
#if IL2CPP_ENABLE_PROFILER
        il2cpp_codegen_profiler_method_enter(imi->method);
#endif
        int32_t oldStackTop = _machineState.GetStackTop();
        StackObject* stackBasePtr = _machineState.AllocStackSlot(imi->maxStackSize);
        InterpFrame* newFrame = _machineState.PushFrame();
        *newFrame = { imi, stackBasePtr, oldStackTop, nullptr, nullptr, nullptr, 0, 0, _machineState.GetLocalPoolBottomIdx() };
 
        // if not prepare arg stack. copy from args
        if (imi->args)
        {
            IL2CPP_ASSERT(imi->argCount == metadata::GetActualArgumentNum(imi->method));
            CopyStackObject(stackBasePtr, argBase, imi->argStackObjectSize);
        }
        PUSH_STACK_FRAME(imi->method);
        return newFrame;
    }
 
    InterpFrame* InterpFrameGroup::LeaveFrame()
    {
        IL2CPP_ASSERT(_machineState.GetFrameTopIdx() > _frameBaseIdx);
        POP_STACK_FRAME();
        InterpFrame* frame = _machineState.GetTopFrame();
#if IL2CPP_ENABLE_PROFILER
        il2cpp_codegen_profiler_method_exit(frame->method->method);
#endif
        if (frame->exFlowBase)
        {
            _machineState.SetExceptionFlowTop(frame->exFlowBase);
        }
        _machineState.PopFrame();
        _machineState.SetStackTop(frame->oldStackTop);
        _machineState.SetLocalPoolBottomIdx(frame->oldLocalPoolBottomIdx);
        return _machineState.GetFrameTopIdx() > _frameBaseIdx ? _machineState.GetTopFrame() : nullptr;
    }
}
}