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