| 795 | #endif |
| 796 | |
| 797 | extern "C" int RunCompiledCodeMain(int argc, const char *const *argv, const VMMetaData *vmmeta, |
| 798 | const lobster::fun_base_t *vtables, |
| 799 | void *custom_pre_init, const char *aux_src_path) { |
| 800 | #ifdef _MSC_VER |
| 801 | _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); |
| 802 | InitUnhandledExceptionFilter(argc, (char **)argv); |
| 803 | #endif |
| 804 | #ifdef USE_EXCEPTION_HANDLING |
| 805 | try |
| 806 | #endif |
| 807 | { |
| 808 | NativeRegistry nfr; |
| 809 | RegisterCoreLanguageBuiltins(nfr); |
| 810 | if (custom_pre_init) ((void (*)(NativeRegistry &))(custom_pre_init))(nfr); |
| 811 | auto loader = EnginePreInit(nfr); |
| 812 | min_output_level = OUTPUT_WARN; |
| 813 | InitPlatform(GetMainDirFromExePath(argv[0]), aux_src_path, false, loader); |
| 814 | auto from_lpak = true; |
| 815 | uint64_t src_hash = 0; |
| 816 | if (!LoadPakDir("default.lpak", src_hash)) { |
| 817 | // FIXME: this is optional, we don't know if the compiled code wants to load this |
| 818 | // file, so we don't error or even warn if this file can't be found. |
| 819 | from_lpak = false; |
| 820 | } |
| 821 | auto vmargs = VMArgs { |
| 822 | nfr, |
| 823 | from_lpak ? string{} : StripDirPart(string_view_nt(argv[0])), |
| 824 | vmmeta, |
| 825 | {}, |
| 826 | vtables, |
| 827 | nullptr, |
| 828 | false, |
| 829 | RUNTIME_ASSERT |
| 830 | }; |
| 831 | for (int arg = 1; arg < argc; arg++) { vmargs.program_args.push_back(argv[arg]); } |
| 832 | lobster::VMAllocator vma(std::move(vmargs)); |
| 833 | if (from_lpak && src_hash != vma.vm->vma.meta->src_hash) { |
| 834 | THROW_OR_ABORT("lpak file from different version of the source code than the compiled code"); |
| 835 | } |
| 836 | vma.vm->EvalProgram(); |
| 837 | } |
| 838 | #ifdef USE_EXCEPTION_HANDLING |
| 839 | catch (string &s) { |
| 840 | LOG_ERROR(s); |
| 841 | return 1; |
| 842 | } |
| 843 | #endif |
| 844 | return 0; |
| 845 | } |
| 846 | |
| 847 | bool Type::Equal(const Type &o, bool allow_unresolved) const { |
| 848 | if (this == &o) return true; |
nothing calls this directly
no test coverage detected