• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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#ifndef NDEBUG
17
18#include "runtime/interpreter/interpreter_impl.h"
19
20#include "libpandabase/macros.h"
21#include "runtime/interpreter/interpreter-inl.h"
22#include "runtime/interpreter/runtime_interface.h"
23#include "irtoc_interpreter_utils.h"
24
25namespace panda::interpreter {
26
27// Tests functions for CSA.
28
29% Panda::instructions.each do |i|
30%   namespace = i.namespace == 'core' ? '' : "#{i.namespace}::"
31%   if i.namespace != 'core'
32#ifdef PANDA_WITH_<%= i.namespace.upcase %>
33
34%   end
35%   mnemonic = i.mnemonic.split('.').map { |p| p == '64' ? 'Wide' : p.capitalize }.join
36void CSA_BUILD_ANALYZE_ONLY_DO_NOT_CALL_DYNAMIC_<%= i.handler_name %>(ManagedThread *thread, const uint8_t *pc, Frame *frame) {
37    InstructionHandlerState state(thread, pc, frame);
38    <%= namespace %>InstructionHandler<RuntimeInterface, true> handler(&state);
39    handler.template Handle<%= mnemonic %><BytecodeInstruction::Format::<%= i.format.pretty.upcase %>>();
40}
41
42void CSA_BUILD_ANALYZE_ONLY_DO_NOT_CALL_STATIC_<%= i.handler_name %>(ManagedThread *thread, const uint8_t *pc, Frame *frame) {
43    InstructionHandlerState state(thread, pc, frame);
44    <%= namespace %>InstructionHandler<RuntimeInterface, false> handler(&state);
45    handler.template Handle<%= mnemonic %><BytecodeInstruction::Format::<%= i.format.pretty.upcase %>>();
46}
47%   if i.namespace != 'core'
48
49#endif // PANDA_WITH_<%= i.namespace.upcase %>
50%   end
51
52% end
53
54}  // namespace panda::interpreter
55
56#endif // NDEBUG
57
58