1 /* 2 * Copyright (c) 2021 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 #ifndef PANDA_RUNTIME_BRIDGE_BRIDGE_H_ 17 #define PANDA_RUNTIME_BRIDGE_BRIDGE_H_ 18 19 #include <cstdint> 20 21 namespace panda { 22 23 class Method; 24 class Frame; 25 class ManagedThread; 26 27 struct DecodedTaggedValue { 28 DecodedTaggedValue() = default; DecodedTaggedValueDecodedTaggedValue29 DecodedTaggedValue(int64_t v, int64_t t) : value(v), tag(t) {} 30 31 int64_t value; // NOLINT(misc-non-private-member-variables-in-classes) 32 int64_t tag; // NOLINT(misc-non-private-member-variables-in-classes) 33 }; 34 35 inline bool operator==(const DecodedTaggedValue &v1, const DecodedTaggedValue &v2) 36 { 37 return v1.value == v2.value && v1.tag == v2.tag; 38 } 39 40 inline bool operator!=(const DecodedTaggedValue &v1, const DecodedTaggedValue &v2) 41 { 42 return !(v1 == v2); 43 } 44 extern "C" void InterpreterToCompiledCodeBridge(const uint8_t *, const Frame *, const Method *, ManagedThread *); 45 extern "C" void InterpreterToCompiledCodeBridgeDyn(const uint8_t *, const Frame *, const Method *, ManagedThread *); 46 extern "C" DecodedTaggedValue InvokeCompiledCodeWithArgArray(const int64_t *, const Frame *, const Method *, 47 ManagedThread *); 48 extern "C" DecodedTaggedValue InvokeCompiledCodeWithArgArrayDyn(const int64_t *, uint32_t, const Frame *, 49 const Method *, ManagedThread *); 50 51 extern "C" int64_t InvokeInterpreter(ManagedThread *thread, const uint8_t *pc, Frame *frame, Frame *last_frame); 52 53 const void *GetCompiledCodeToInterpreterBridge(const Method *method); 54 55 } // namespace panda 56 57 #endif // PANDA_RUNTIME_BRIDGE_BRIDGE_H_ 58