1 /**
2 * Copyright (c) 2021-2024 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 ark {
27
28 // CC-OFFNXT(C_RULE_ID_MACRODEFINE_ENDWITH_SEMICOLON) code generation
29 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
30 #define DEFINE_VALUE(name, value) static_assert((name) == (value));
31 #include "asm_defines/asm_defines.def"
32
33 // Frame doesn't have aligned storage, so check its offset manually
34 #ifdef PANDA_TARGET_64
35 // NOLINTNEXTLINE(readability-magic-numbers)
36 static_assert(FRAME_METHOD_OFFSET == 8);
37 // NOLINTNEXTLINE(readability-magic-numbers)
38 static_assert(FRAME_PREV_FRAME_OFFSET == 0);
39 // NOLINTNEXTLINE(readability-magic-numbers)
40 static_assert(FRAME_SLOT_OFFSET == 80);
41 #endif
42
GetCurrentManagedThread()43 extern "C" ManagedThread *GetCurrentManagedThread()
44 {
45 return ManagedThread::GetCurrent();
46 }
47
AsmUnreachable()48 extern "C" void AsmUnreachable()
49 {
50 UNREACHABLE();
51 }
52
53 #if !defined(PANDA_TARGET_ARM64)
OsrEntryAfterCFrame(Frame * frame,uintptr_t loopHeadBc,const void * osrCode,size_t frameSize)54 extern "C" void OsrEntryAfterCFrame([[maybe_unused]] Frame *frame, [[maybe_unused]] uintptr_t loopHeadBc,
55 [[maybe_unused]] const void *osrCode, [[maybe_unused]] size_t frameSize)
56 {
57 UNREACHABLE();
58 }
OsrEntryAfterIFrame(Frame * frame,uintptr_t loopHeadBc,const void * osrCode,size_t frameSize)59 extern "C" void OsrEntryAfterIFrame([[maybe_unused]] Frame *frame, [[maybe_unused]] uintptr_t loopHeadBc,
60 [[maybe_unused]] const void *osrCode, [[maybe_unused]] size_t frameSize)
61 {
62 UNREACHABLE();
63 }
OsrEntryTopFrame(Frame * frame,uintptr_t loopHeadBc,const void * osrCode,size_t frameSize)64 extern "C" void OsrEntryTopFrame([[maybe_unused]] Frame *frame, [[maybe_unused]] uintptr_t loopHeadBc,
65 [[maybe_unused]] const void *osrCode, [[maybe_unused]] size_t frameSize)
66 {
67 UNREACHABLE();
68 }
69 #endif // !defined(PANDA_TARGET_ARM64)
70
71 } // namespace ark
72