• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "invokation_helper.h"
17 
18 extern "C" void InvokeHelper(...);
19 
20 namespace ark::test {
21 
GetInvokeHelperImpl()22 const void *GetInvokeHelperImpl()
23 {
24     return reinterpret_cast<const void *>(InvokeHelper);
25 }
26 
CountMethodTypes(panda_file::ShortyIterator & it,arch::ArgCounter<RUNTIME_ARCH> counter)27 void CountMethodTypes(panda_file::ShortyIterator &it, arch::ArgCounter<RUNTIME_ARCH> counter)
28 {
29     switch ((*it).GetId()) {
30         case panda_file::Type::TypeId::U1:
31         case panda_file::Type::TypeId::U8:
32         case panda_file::Type::TypeId::I8:
33         case panda_file::Type::TypeId::I16:
34         case panda_file::Type::TypeId::U16:
35         case panda_file::Type::TypeId::I32:
36         case panda_file::Type::TypeId::U32:
37             counter.Count<int32_t>();
38             break;
39         case panda_file::Type::TypeId::F32:
40             counter.Count<float>();
41             break;
42         case panda_file::Type::TypeId::F64:
43             counter.Count<double>();
44             break;
45         case panda_file::Type::TypeId::I64:
46         case panda_file::Type::TypeId::U64:
47             counter.Count<int64_t>();
48             break;
49         case panda_file::Type::TypeId::REFERENCE:
50             counter.Count<ObjectHeader *>();
51             break;
52         case panda_file::Type::TypeId::TAGGED:
53             counter.Count<coretypes::TaggedValue>();
54             break;
55         default:
56             UNREACHABLE();
57     }
58 }
59 
60 }  // namespace ark::test
61