1 /**
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "runtime/arch/asm_support.h"
17 #include "libpandabase/utils/arch.h"
18 #include "runtime/include/coretypes/array.h"
19 #include "runtime/include/coretypes/native_pointer.h"
20 #include "runtime/include/coretypes/string.h"
21 #include "runtime/include/method.h"
22 #include "runtime/include/mtmanaged_thread.h"
23 #include "runtime/include/thread.h"
24 #include "plugins_defines.h"
25
26 namespace panda {
27
28 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
29 #define DEFINE_VALUE(name, value) static_assert(name == value);
30 #include "asm_defines/asm_defines.def"
31
32 // Frame doesn't have aligned storage, so check its offset manually
33 #ifdef PANDA_TARGET_64
34 // NOLINTNEXTLINE(readability-magic-numbers)
35 static_assert(FRAME_METHOD_OFFSET == 8);
36 // NOLINTNEXTLINE(readability-magic-numbers)
37 static_assert(FRAME_PREV_FRAME_OFFSET == 0);
38 // NOLINTNEXTLINE(readability-magic-numbers)
39 static_assert(FRAME_SLOT_OFFSET == 80);
40 #endif
41
GetCurrentManagedThread()42 extern "C" ManagedThread *GetCurrentManagedThread()
43 {
44 return ManagedThread::GetCurrent();
45 }
46
AsmUnreachable()47 extern "C" void AsmUnreachable()
48 {
49 UNREACHABLE();
50 }
51
52 #if !defined(PANDA_TARGET_ARM64)
OsrEntryAfterCFrame(Frame * frame,uintptr_t loop_head_bc,const void * osr_code,size_t frame_size)53 extern "C" void OsrEntryAfterCFrame([[maybe_unused]] Frame *frame, [[maybe_unused]] uintptr_t loop_head_bc,
54 [[maybe_unused]] const void *osr_code, [[maybe_unused]] size_t frame_size)
55 {
56 UNREACHABLE();
57 }
OsrEntryAfterIFrame(Frame * frame,uintptr_t loop_head_bc,const void * osr_code,size_t frame_size)58 extern "C" void OsrEntryAfterIFrame([[maybe_unused]] Frame *frame, [[maybe_unused]] uintptr_t loop_head_bc,
59 [[maybe_unused]] const void *osr_code, [[maybe_unused]] size_t frame_size)
60 {
61 UNREACHABLE();
62 }
OsrEntryTopFrame(Frame * frame,uintptr_t loop_head_bc,const void * osr_code,size_t frame_size)63 extern "C" void OsrEntryTopFrame([[maybe_unused]] Frame *frame, [[maybe_unused]] uintptr_t loop_head_bc,
64 [[maybe_unused]] const void *osr_code, [[maybe_unused]] size_t frame_size)
65 {
66 UNREACHABLE();
67 }
68 #endif // !defined(PANDA_TARGET_ARM64)
69
70 } // namespace panda
71