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 ES2PANDA_COMPILER_INCLUDE_COMPILER_IMPL_H 17#define ES2PANDA_COMPILER_INCLUDE_COMPILER_IMPL_H 18 19#include <es2panda.h> 20#include <macros.h> 21#include <mem/arena_allocator.h> 22#include <os/thread.h> 23#include <util/patchFix.h> 24 25#include <string> 26 27namespace panda::pandasm { 28struct Program; 29} // namespace panda::pandasm 30 31namespace panda::es2panda::parser { 32class Program; 33} // namespace panda::es2panda::parser 34 35namespace panda::es2panda::compiler { 36class CompileFuncQueue; 37 38class CompilerImpl { 39public: 40 explicit CompilerImpl(size_t threadCount): threadCount_(threadCount) {} 41 ~CompilerImpl(); 42 NO_COPY_SEMANTIC(CompilerImpl); 43 NO_MOVE_SEMANTIC(CompilerImpl); 44 45 panda::pandasm::Program *Compile(parser::Program *program, const es2panda::CompilerOptions &options, 46 const std::string &debugInfoSourceFile, const std::string &pkgName); 47 static void DumpAsm(const panda::pandasm::Program *prog); 48 49 void AddPatchFixHelper(util::PatchFix *patchFixHelper) 50 { 51 patchFixHelper_ = patchFixHelper; 52 } 53 54private: 55 size_t threadCount_ {0}; 56 CompileFuncQueue *queue_ {nullptr}; 57 util::PatchFix *patchFixHelper_ {nullptr}; 58}; 59} // namespace panda::es2panda::compiler 60 61#endif 62