Lines Matching full:runtime
16 #include "runtime/include/runtime.h"
42 #include "runtime/cha.h"
43 #include "runtime/compiler.h"
44 #include "runtime/dprofiler/dprofiler.h"
45 #include "runtime/entrypoints/entrypoints.h"
46 #include "runtime/include/class_linker_extension.h"
47 #include "runtime/include/coretypes/array-inl.h"
48 #include "runtime/include/coretypes/string.h"
49 #include "runtime/include/language_context.h"
50 #include "runtime/include/locks.h"
51 #include "runtime/include/runtime_notification.h"
52 #include "runtime/include/thread.h"
53 #include "runtime/include/thread_scopes.h"
54 #include "runtime/include/tooling/debug_inf.h"
55 #include "runtime/handle_scope.h"
56 #include "runtime/handle_scope-inl.h"
58 #include "runtime/mem/gc/gc_stats.h"
59 #include "runtime/mem/gc/stw-gc/stw-gc.h"
60 #include "runtime/mem/heap_manager.h"
61 #include "runtime/mem/memory_manager.h"
62 #include "runtime/mem/internal_allocator-inl.h"
63 #include "runtime/mem/gc/gc-hung/gc_hung.h"
64 #include "runtime/include/panda_vm.h"
65 #include "runtime/tooling/debugger.h"
66 #include "runtime/include/file_manager.h"
67 #include "runtime/methodtrace/trace.h"
81 Runtime *Runtime::instance = nullptr;
82 RuntimeOptions Runtime::options_; // NOLINT(fuchsia-statically-constructed-objects)
83 std::string Runtime::runtime_type_; // NOLINT(fuchsia-statically-constructed-objects)
84 os::memory::Mutex Runtime::mutex; // NOLINT(fuchsia-statically-constructed-objects)
159 Runtime::DebugSession::DebugSession(Runtime &runtime) in DebugSession() argument
160 : runtime_(runtime), in DebugSession()
161 is_jit_enabled_(runtime.IsJitEnabled()), in DebugSession()
162 lock_(runtime.debug_session_uniqueness_mutex_), in DebugSession()
170 Runtime::DebugSession::~DebugSession() in ~DebugSession()
178 tooling::DebugInterface &Runtime::DebugSession::GetDebugger() in GetDebugger()
184 LanguageContext Runtime::GetLanguageContext(panda_file::SourceLang lang) in GetLanguageContext()
196 LanguageContext Runtime::GetLanguageContext(const Method &method) in GetLanguageContext()
209 LanguageContext Runtime::GetLanguageContext(const Class &cls) in GetLanguageContext()
214 LanguageContext Runtime::GetLanguageContext(const BaseClass &cls) in GetLanguageContext()
219 LanguageContext Runtime::GetLanguageContext(panda_file::ClassDataAccessor *cda) in GetLanguageContext()
229 LanguageContext Runtime::GetLanguageContext(const std::string &runtime_type) in GetLanguageContext()
235 bool Runtime::CreateInstance(const RuntimeOptions &options, mem::InternalAllocatorPtr internal_allo… in CreateInstance()
250 instance = new Runtime(options, internal_allocator); in CreateInstance()
261 LOG(ERROR, RUNTIME) << "Incorrect minimum free heap size percentage (min-free-percentage=" in CreateMemorySpaces()
266 LOG(ERROR, RUNTIME) << "Incorrect maximum free heap size percentage (max-free-percentage=" in CreateMemorySpaces()
271 …LOG(ERROR, RUNTIME) << "Minimum free heap size percentage(min-free-percentage=" << min_free_percen… in CreateMemorySpaces()
288 …LOG(ERROR, RUNTIME) << "Initial heap size (" << initial_object_size << ") must be <= max heap size… in CreateMemorySpaces()
306 bool Runtime::Create(const RuntimeOptions &options, const std::vector<LanguageContextBase *> &ctxs) in Create()
309 return Runtime::Create(options); in Create()
313 bool Runtime::Create(const RuntimeOptions &options) in Create()
320 trace::ScopedTrace scoped_trace("Runtime::Create"); in Create()
323 LOG(ERROR, RUNTIME) << "Failed to create memory spaces for runtime"; in Create()
335 LOG(ERROR, RUNTIME) << "Failed to create runtime instance"; in Create()
340 LOG(ERROR, RUNTIME) << "Failed to initialize runtime"; in Create()
356 Runtime *Runtime::GetCurrent() in GetCurrent()
362 bool Runtime::DestroyUnderLockHolder() in DestroyUnderLockHolder()
371 LOG(ERROR, RUNTIME) << "Failed to shutdown runtime"; in DestroyUnderLockHolder()
379 * NOTE: Users threads can call log after destroying Runtime. We can't control these in DestroyUnderLockHolder()
393 bool Runtime::Destroy() in Destroy()
399 trace::ScopedTrace scoped_trace("Runtime shutdown"); in Destroy()
434 void Runtime::InitializeVerificationResultCache() in InitializeVerificationResultCache()
450 void Runtime::Halt(int32_t status) in Halt()
452 Runtime *runtime = Runtime::GetCurrent(); in Halt() local
453 if (runtime != nullptr && runtime->exit_ != nullptr) { in Halt()
454 runtime->exit_(status); in Halt()
463 void Runtime::Abort(const char *message /* = nullptr */) in Abort()
465 Runtime *runtime = Runtime::GetCurrent(); in Abort() local
466 if (runtime != nullptr && runtime->abort_ != nullptr) { in Abort()
467 runtime->abort_(); in Abort()
470 std::cerr << "Runtime::Abort: " << ((message != nullptr) ? message : "") << std::endl; in Abort()
482 // Choose first non-core runtime. in GetMainRuntimeType()
491 Runtime::Runtime(const RuntimeOptions &options, mem::InternalAllocatorPtr internal_allocator) in Runtime() function in panda::Runtime
497 Runtime::runtime_type_ = GetMainRuntimeType(options); in Runtime()
498 Runtime::options_ = options; in Runtime()
515 is_jit_enabled_ = !this->IsDebugMode() && Runtime::GetOptions().IsCompilerEnableJit(); in Runtime()
530 Runtime::~Runtime() in ~Runtime()
546 * @description: This point is right after runtime deastroys panda VM. in ~Runtime()
573 PandaVector<PandaString> Runtime::GetBootPandaFiles() in GetBootPandaFiles()
580 PandaVector<PandaString> Runtime::GetPandaFiles() in GetPandaFiles()
587 bool Runtime::LoadBootPandaFiles(panda_file::File::OpenMode open_mode) in LoadBootPandaFiles()
594 LOG(FATAL, RUNTIME) << "Load boot panda file failed: " << name; in LoadBootPandaFiles()
596 LOG(ERROR, RUNTIME) << "Load boot panda file failed: " << name; in LoadBootPandaFiles()
605 void Runtime::SetDaemonMemoryLeakThreshold(uint32_t daemon_memory_leak_threshold) in SetDaemonMemoryLeakThreshold()
610 mem::GCType Runtime::GetGCType(const RuntimeOptions &options, panda_file::SourceLang lang) in GetGCType()
622 bool Runtime::LoadVerificationConfig() in LoadVerificationConfig()
628 bool Runtime::CreatePandaVM(std::string_view runtime_type) in CreatePandaVM()
634 LOG(ERROR, RUNTIME) << "Failed to create panda vm"; in CreatePandaVM()
641 LOG(ERROR, RUNTIME) << "Failed to load boot panda files"; in CreatePandaVM()
670 bool Runtime::InitializePandaVM() in InitializePandaVM()
674 LOG(FATAL, RUNTIME) << "Non compressed strings is not supported"; in InitializePandaVM()
678 LOG(ERROR, RUNTIME) << "Failed to initialize class loader"; in InitializePandaVM()
693 LOG(ERROR, RUNTIME) << "Failed to initialize panda vm"; in InitializePandaVM()
700 bool Runtime::HandleAotOptions() in HandleAotOptions()
722 void Runtime::HandleJitOptions() in HandleJitOptions()
733 bool Runtime::CheckOptionsConsistency() in CheckOptionsConsistency()
739 LOG(ERROR, RUNTIME) << "--resolve-string-aot-threshold value (" << value << ") is " in CheckOptionsConsistency()
748 void Runtime::SetPandaPath() in SetPandaPath()
759 bool Runtime::Initialize() in Initialize()
761 trace::ScopedTrace scoped_trace("Runtime::Initialize"); in Initialize()
804 LOG(ERROR, RUNTIME) << "Failed to finish panda vm initialization"; in Initialize()
843 Expected<Method *, Runtime::Error> Runtime::ResolveEntryPoint(std::string_view entry_point) in ResolveEntryPoint()
849 LOG(ERROR, RUNTIME) << "Invalid entry point: " << entry_point; in ResolveEntryPoint()
850 return Unexpected(Runtime::Error::INVALID_ENTRY_POINT); in ResolveEntryPoint()
868 LOG(ERROR, RUNTIME) << "Cannot find class '" << class_name << "'"; in ResolveEntryPoint()
869 return Unexpected(Runtime::Error::CLASS_NOT_FOUND); in ResolveEntryPoint()
884 LOG(ERROR, RUNTIME) << "Cannot find method '" << entry_point << "'"; in ResolveEntryPoint()
885 return Unexpected(Runtime::Error::METHOD_NOT_FOUND); in ResolveEntryPoint()
892 PandaString Runtime::GetMemoryStatistics() in GetMemoryStatistics()
897 PandaString Runtime::GetFinalStatistics() in GetFinalStatistics()
902 void Runtime::NotifyAboutLoadedModules() in NotifyAboutLoadedModules()
916 Expected<LanguageContext, Runtime::Error> Runtime::ExtractLanguageContext(const panda_file::File *p… in ExtractLanguageContext()
922 LOG(ERROR, RUNTIME) << "Invalid entry point: " << entry_point; in ExtractLanguageContext()
923 return Unexpected(Runtime::Error::INVALID_ENTRY_POINT); in ExtractLanguageContext()
932 LOG(ERROR, RUNTIME) << "Cannot find class '" << class_name << "'"; in ExtractLanguageContext()
933 return Unexpected(Runtime::Error::CLASS_NOT_FOUND); in ExtractLanguageContext()
950 LOG(ERROR, RUNTIME) << "Cannot find method '" << entry_point << "'"; in ExtractLanguageContext()
951 return Unexpected(Runtime::Error::METHOD_NOT_FOUND); in ExtractLanguageContext()
957 std::optional<Runtime::Error> Runtime::CreateApplicationClassLinkerContext(std::string_view filenam… in CreateApplicationClassLinkerContext()
976 return Runtime::Error::PANDA_FILE_LOAD_ERROR; in CreateApplicationClassLinkerContext()
986 LOG(ERROR, RUNTIME) << "class linker hasn't " << res.Value() << " language extension"; in CreateApplicationClassLinkerContext()
987 return Runtime::Error::CLASS_LINKER_EXTENSION_NOT_FOUND; in CreateApplicationClassLinkerContext()
1012 Expected<int, Runtime::Error> Runtime::ExecutePandaFile(std::string_view filename, std::string_view… in ExecutePandaFile()
1037 Expected<int, Runtime::Error> Runtime::Execute(std::string_view entry_point, const std::vector<std:… in Execute()
1052 int Runtime::StartDProfiler(std::string_view app_name) in StartDProfiler()
1055 LOG(ERROR, RUNTIME) << "DProfiller already started"; in StartDProfiler()
1059 dprofiler_ = internal_allocator_->New<DProfiler>(app_name, Runtime::GetCurrent()); in StartDProfiler()
1063 Runtime::DebugSessionHandle Runtime::StartDebugSession() in StartDebugSession()
1079 bool Runtime::Shutdown() in Shutdown()
1087 coretypes::String *Runtime::ResolveString(PandaVM *vm, const Method &caller, panda_file::File::Enti… in ResolveString()
1093 coretypes::String *Runtime::ResolveStringFromCompiledCode(PandaVM *vm, const Method &caller, in ResolveStringFromCompiledCode()
1100 coretypes::String *Runtime::ResolveString(PandaVM *vm, const panda_file::File &pf, panda_file::File… in ResolveString()
1111 coretypes::String *Runtime::ResolveString(PandaVM *vm, const uint8_t *mutf8, uint32_t length, in ResolveString()
1117 coretypes::Array *Runtime::ResolveLiteralArray(PandaVM *vm, const Method &caller, uint32_t id) in ResolveLiteralArray()
1124 Class *Runtime::GetClassRootForLiteralTag(const ClassLinkerExtension &ext, panda_file::LiteralTag t… in GetClassRootForLiteralTag()
1173 bool Runtime::GetLiteralTagAndValue(const panda_file::File &pf, uint32_t id, panda_file::LiteralTag… in GetLiteralTagAndValue()
1189 uintptr_t Runtime::GetPointerToConstArrayData(const panda_file::File &pf, uint32_t id) const in GetPointerToConstArrayData()
1204 coretypes::Array *Runtime::ResolveLiteralArray(PandaVM *vm, const panda_file::File &pf, uint32_t id, in ResolveLiteralArray()
1216 auto ext = Runtime::GetCurrent()->GetClassLinker()->GetExtension(ctx); in ResolveLiteralArray()
1229 … auto str = Runtime::GetCurrent()->ResolveString(vm, pf, panda_file::File::EntityId(str_id), ctx); in ResolveLiteralArray()
1235 void Runtime::UpdateProcessState([[maybe_unused]] int state) in UpdateProcessState()
1237 LOG(INFO, RUNTIME) << __func__ << " is an empty implementation now."; in UpdateProcessState()
1240 void Runtime::RegisterSensitiveThread() const in RegisterSensitiveThread()
1242 LOG(INFO, RUNTIME) << __func__ << " is an empty implementation now."; in RegisterSensitiveThread()
1245 void Runtime::BlockSignals() in BlockSignals()
1249 LOG(ERROR, RUNTIME) << "sigemptyset failed"; in BlockSignals()
1259 LOG(ERROR, RUNTIME) << "sigaddset failed"; in BlockSignals()
1264 LOG(ERROR, RUNTIME) << "g_PandaThreadSigmask failed"; in BlockSignals()
1268 void Runtime::DumpForSigQuit(std::ostream &os) in DumpForSigQuit()
1298 void Runtime::InitNonZygoteOrPostFork([[maybe_unused]] bool is_system_server, [[maybe_unused]] cons… in InitNonZygoteOrPostFork()
1332 void Runtime::PreZygoteFork() in PreZygoteFork()
1337 void Runtime::PostZygoteFork() in PostZygoteFork()
1343 bool Runtime::SaveProfileInfo() const in SaveProfileInfo()