1 /** 2 * Copyright (c) 2021-2025 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 #ifndef PANDA_RUNTIME_LANGUAGE_CONTEXT_H_ 16 #define PANDA_RUNTIME_LANGUAGE_CONTEXT_H_ 17 18 #include "libpandabase/utils/utf.h" 19 #include "libpandafile/class_data_accessor-inl.h" 20 #include "libpandafile/file_items.h" 21 #include "macros.h" 22 #include "compiler/code_info/vreg_info.h" 23 #include "runtime/class_initializer.h" 24 #include "runtime/include/class-inl.h" 25 #include "runtime/include/class_linker_extension.h" 26 #include "runtime/include/coretypes/tagged_value.h" 27 #include "runtime/include/imtable_builder.h" 28 #include "runtime/include/itable_builder.h" 29 #include "runtime/include/language_config.h" 30 #include "runtime/include/vtable_builder_interface.h" 31 #include "runtime/include/tooling/pt_lang_extension.h" 32 #include "runtime/include/stack_walker.h" 33 #include "runtime/mem/gc/gc_types.h" 34 namespace ark { 35 class Thread; 36 class Trace; 37 class Runtime; 38 class RuntimeOptions; 39 40 namespace mem { 41 class GC; 42 class ObjectAllocatorBase; 43 class GCSettings; 44 } // namespace mem 45 46 struct VerificationInitAPI { 47 std::vector<panda_file::Type::TypeId> primitiveRootsForVerification; 48 std::vector<const uint8_t *> arrayElementsForVerification; 49 bool isNeedObjectSyntheticClass = false; 50 bool isNeedStringSyntheticClass = false; 51 bool isNeedClassSyntheticClass = false; 52 }; 53 54 class LanguageContextBase { 55 public: 56 LanguageContextBase() = default; 57 58 DEFAULT_COPY_SEMANTIC(LanguageContextBase); 59 DEFAULT_MOVE_SEMANTIC(LanguageContextBase); 60 61 virtual ~LanguageContextBase() = default; 62 63 virtual panda_file::SourceLang GetLanguage() const = 0; 64 GetStringClassDescriptor()65 virtual const uint8_t *GetStringClassDescriptor() const 66 { 67 return utf::CStringAsMutf8(ark::panda_file::GetStringClassDescriptor(GetLanguage())); 68 } 69 70 virtual LangTypeT GetLanguageType() const = 0; 71 72 virtual const uint8_t *GetObjectClassDescriptor() const = 0; 73 74 virtual const uint8_t *GetClassClassDescriptor() const = 0; 75 76 virtual const uint8_t *GetClassArrayClassDescriptor() const = 0; 77 78 virtual const uint8_t *GetStringArrayClassDescriptor() const = 0; 79 GetCtorName()80 virtual const uint8_t *GetCtorName() const 81 { 82 return utf::CStringAsMutf8(ark::panda_file::GetCtorName(GetLanguage())); 83 } 84 GetCctorName()85 virtual const uint8_t *GetCctorName() const 86 { 87 return utf::CStringAsMutf8(ark::panda_file::GetCctorName(GetLanguage())); 88 } 89 90 virtual const uint8_t *GetNullPointerExceptionClassDescriptor() const = 0; 91 GetStackOverflowErrorClassDescriptor()92 virtual const uint8_t *GetStackOverflowErrorClassDescriptor() const 93 { 94 UNREACHABLE(); 95 return nullptr; 96 } 97 98 virtual const uint8_t *GetArrayIndexOutOfBoundsExceptionClassDescriptor() const = 0; 99 100 virtual const uint8_t *GetIndexOutOfBoundsExceptionClassDescriptor() const = 0; 101 102 virtual const uint8_t *GetIllegalStateExceptionClassDescriptor() const = 0; 103 104 virtual const uint8_t *GetNegativeArraySizeExceptionClassDescriptor() const = 0; 105 106 virtual const uint8_t *GetStringIndexOutOfBoundsExceptionClassDescriptor() const = 0; 107 108 virtual const uint8_t *GetArithmeticExceptionClassDescriptor() const = 0; 109 110 virtual const uint8_t *GetClassCastExceptionClassDescriptor() const = 0; 111 112 virtual const uint8_t *GetAbstractMethodErrorClassDescriptor() const = 0; 113 114 virtual const uint8_t *GetArrayStoreExceptionClassDescriptor() const = 0; 115 116 virtual const uint8_t *GetRuntimeExceptionClassDescriptor() const = 0; 117 118 virtual const uint8_t *GetFileNotFoundExceptionClassDescriptor() const = 0; 119 120 virtual const uint8_t *GetIOExceptionClassDescriptor() const = 0; 121 122 virtual const uint8_t *GetIllegalArgumentExceptionClassDescriptor() const = 0; 123 124 virtual const uint8_t *GetIllegalAccessExceptionClassDescriptor() const = 0; 125 126 virtual const uint8_t *GetOutOfMemoryErrorClassDescriptor() const = 0; 127 128 virtual const uint8_t *GetNoClassDefFoundErrorDescriptor() const = 0; 129 130 virtual const uint8_t *GetClassCircularityErrorDescriptor() const = 0; 131 132 virtual const uint8_t *GetNoSuchFieldErrorDescriptor() const = 0; 133 134 virtual const uint8_t *GetNoSuchMethodErrorDescriptor() const = 0; 135 136 virtual coretypes::TaggedValue GetInitialTaggedValue() const = 0; 137 138 virtual coretypes::TaggedValue GetEncodedTaggedValue(int64_t value, int64_t tag) const = 0; 139 140 virtual std::pair<Method *, uint32_t> GetCatchMethodAndOffset(Method *method, ManagedThread *thread) const; 141 142 virtual PandaVM *CreateVM(Runtime *runtime, const RuntimeOptions &options) const = 0; 143 144 virtual mem::GC *CreateGC(mem::GCType gcType, mem::ObjectAllocatorBase *objectAllocator, 145 const mem::GCSettings &settings) const = 0; 146 147 virtual std::unique_ptr<ClassLinkerExtension> CreateClassLinkerExtension() const; 148 149 virtual std::unique_ptr<tooling::PtLangExt> CreatePtLangExt() const; 150 151 virtual void ThrowException(ManagedThread *thread, const uint8_t *mutf8Name, const uint8_t *mutf8Msg) const; 152 153 virtual void SetExceptionToVReg( 154 [[maybe_unused]] interpreter::AccVRegister &vreg, // NOLINTNEXTLINE(google-runtime-references) 155 [[maybe_unused]] ObjectHeader *obj) const; 156 157 virtual bool IsCallableObject([[maybe_unused]] ObjectHeader *obj) const = 0; 158 159 virtual Method *GetCallTarget(ObjectHeader *obj) const = 0; 160 161 virtual const uint8_t *GetExceptionInInitializerErrorDescriptor() const = 0; 162 163 virtual const uint8_t *GetClassNotFoundExceptionDescriptor() const = 0; 164 165 virtual const uint8_t *GetInstantiationErrorDescriptor() const = 0; 166 167 virtual const uint8_t *GetUnsupportedOperationExceptionClassDescriptor() const = 0; 168 169 virtual const uint8_t *GetVerifyErrorClassDescriptor() const = 0; 170 171 virtual const uint8_t *GetReferenceErrorDescriptor() const = 0; 172 173 virtual const uint8_t *GetTypedErrorDescriptor() const = 0; 174 175 virtual const uint8_t *GetIllegalMonitorStateExceptionDescriptor() const = 0; 176 GetCoroutinesLimitExceedErrorDescriptor()177 virtual const uint8_t *GetCoroutinesLimitExceedErrorDescriptor() const 178 { 179 UNREACHABLE(); 180 return nullptr; 181 } 182 ThrowStackOverflowException(ManagedThread * thread)183 virtual void ThrowStackOverflowException([[maybe_unused]] ManagedThread *thread) const 184 { 185 UNREACHABLE(); 186 } 187 GetCloneNotSupportedExceptionDescriptor()188 virtual const uint8_t *GetCloneNotSupportedExceptionDescriptor() const 189 { 190 UNREACHABLE(); 191 } 192 GetFrameExtSize()193 virtual uint32_t GetFrameExtSize() const 194 { 195 return 0; 196 } 197 GetIncompatibleClassChangeErrorDescriptor()198 virtual const uint8_t *GetIncompatibleClassChangeErrorDescriptor() const 199 { 200 UNREACHABLE(); 201 } 202 CreateIMTableBuilder()203 virtual PandaUniquePtr<IMTableBuilder> CreateIMTableBuilder() const 204 { 205 return MakePandaUnique<IMTableBuilder>(); 206 } 207 GetErrorClassDescriptor()208 virtual const uint8_t *GetErrorClassDescriptor() const 209 { 210 return nullptr; 211 } 212 CreateITableBuilder(ClassLinkerErrorHandler * errHandler)213 virtual PandaUniquePtr<ITableBuilder> CreateITableBuilder( 214 [[maybe_unused]] ClassLinkerErrorHandler *errHandler) const 215 { 216 return nullptr; 217 } 218 CreateVTableBuilder(ClassLinkerErrorHandler * errHandler)219 virtual PandaUniquePtr<VTableBuilder> CreateVTableBuilder( 220 [[maybe_unused]] ClassLinkerErrorHandler *errHandler) const 221 { 222 return nullptr; 223 } 224 InitializeClass(ClassLinker * classLinker,ManagedThread * thread,Class * klass)225 virtual bool InitializeClass([[maybe_unused]] ClassLinker *classLinker, [[maybe_unused]] ManagedThread *thread, 226 [[maybe_unused]] Class *klass) const 227 { 228 return true; 229 } 230 GetStringSize(const ObjectHeader * stringObject)231 virtual size_t GetStringSize(const ObjectHeader *stringObject) const 232 { 233 return stringObject->ObjectSize(); 234 } 235 CreateTrace(PandaUniquePtr<ark::os::file::File> traceFile,size_t bufferSize)236 virtual Trace *CreateTrace([[maybe_unused]] PandaUniquePtr<ark::os::file::File> traceFile, 237 [[maybe_unused]] size_t bufferSize) const 238 { 239 UNREACHABLE(); 240 } 241 GetBootPandaFilesOpenMode()242 virtual ark::panda_file::File::OpenMode GetBootPandaFilesOpenMode() const 243 { 244 return panda_file::File::READ_ONLY; 245 } 246 GetVerificationInitAPI()247 virtual VerificationInitAPI GetVerificationInitAPI() const 248 { 249 return VerificationInitAPI(); 250 } 251 GetVerificationTypeClass()252 virtual const char *GetVerificationTypeClass() const 253 { 254 return nullptr; 255 } 256 GetVerificationTypeObject()257 virtual const char *GetVerificationTypeObject() const 258 { 259 return nullptr; 260 } 261 GetVerificationTypeThrowable()262 virtual const char *GetVerificationTypeThrowable() const 263 { 264 return nullptr; 265 } 266 RestoreEnv(Frame * currentIframe,const StackWalker::EnvData & envData)267 virtual void RestoreEnv([[maybe_unused]] Frame *currentIframe, 268 [[maybe_unused]] const StackWalker::EnvData &envData) const 269 { 270 } 271 IsEnabledCHA()272 virtual bool IsEnabledCHA() const 273 { 274 return true; 275 } 276 InitializeOsrCframeSlots(Span<uintptr_t> paramSlots)277 virtual void InitializeOsrCframeSlots([[maybe_unused]] Span<uintptr_t> paramSlots) const {} 278 GetOsrEnv(const Frame * iframe,compiler::VRegInfo vregInfo)279 virtual uint64_t GetOsrEnv([[maybe_unused]] const Frame *iframe, [[maybe_unused]] compiler::VRegInfo vregInfo) const 280 { 281 return 0; 282 } 283 284 virtual void WrapClassInitializerException(ClassLinker *classLinker, ManagedThread *thread) const; 285 }; 286 287 class LanguageContext { 288 public: LanguageContext(const LanguageContextBase * context)289 explicit LanguageContext(const LanguageContextBase *context) : base_(context) {} 290 291 DEFAULT_COPY_SEMANTIC(LanguageContext); 292 DEFAULT_MOVE_SEMANTIC(LanguageContext); 293 294 ~LanguageContext() = default; 295 GetLanguage()296 panda_file::SourceLang GetLanguage() const 297 { 298 return base_->GetLanguage(); 299 } 300 GetLanguageType()301 LangTypeT GetLanguageType() const 302 { 303 return base_->GetLanguageType(); 304 } 305 GetInitialTaggedValue()306 coretypes::TaggedValue GetInitialTaggedValue() const 307 { 308 return base_->GetInitialTaggedValue(); 309 } 310 GetEncodedTaggedValue(int64_t value,int64_t tag)311 coretypes::TaggedValue GetEncodedTaggedValue(int64_t value, int64_t tag) const 312 { 313 return base_->GetEncodedTaggedValue(value, tag); 314 } 315 GetCatchMethodAndOffset(Method * method,ManagedThread * thread)316 std::pair<Method *, uint32_t> GetCatchMethodAndOffset(Method *method, ManagedThread *thread) const 317 { 318 return base_->GetCatchMethodAndOffset(method, thread); 319 } 320 CreateVM(Runtime * runtime,const RuntimeOptions & options)321 PandaVM *CreateVM(Runtime *runtime, const RuntimeOptions &options) 322 { 323 return base_->CreateVM(runtime, options); 324 } 325 CreateGC(mem::GCType gcType,mem::ObjectAllocatorBase * objectAllocator,const mem::GCSettings & settings)326 mem::GC *CreateGC(mem::GCType gcType, mem::ObjectAllocatorBase *objectAllocator, 327 const mem::GCSettings &settings) const 328 { 329 return base_->CreateGC(gcType, objectAllocator, settings); 330 } 331 CreateClassLinkerExtension()332 std::unique_ptr<ClassLinkerExtension> CreateClassLinkerExtension() 333 { 334 return base_->CreateClassLinkerExtension(); 335 } 336 CreatePtLangExt()337 std::unique_ptr<tooling::PtLangExt> CreatePtLangExt() 338 { 339 return base_->CreatePtLangExt(); 340 } 341 ThrowException(ManagedThread * thread,const uint8_t * mutf8Name,const uint8_t * mutf8Msg)342 void ThrowException(ManagedThread *thread, const uint8_t *mutf8Name, const uint8_t *mutf8Msg) const 343 { 344 base_->ThrowException(thread, mutf8Name, mutf8Msg); 345 } 346 SetExceptionToVReg(interpreter::AccVRegister & vreg,ObjectHeader * obj)347 void SetExceptionToVReg( 348 [[maybe_unused]] interpreter::AccVRegister &vreg, // NOLINTNEXTLINE(google-runtime-references) 349 [[maybe_unused]] ObjectHeader *obj) const 350 { 351 base_->SetExceptionToVReg(vreg, obj); 352 } 353 GetStringClassDescriptor()354 const uint8_t *GetStringClassDescriptor() const 355 { 356 return base_->GetStringClassDescriptor(); 357 } 358 GetObjectClassDescriptor()359 const uint8_t *GetObjectClassDescriptor() const 360 { 361 return base_->GetObjectClassDescriptor(); 362 } 363 GetClassClassDescriptor()364 const uint8_t *GetClassClassDescriptor() const 365 { 366 return base_->GetClassClassDescriptor(); 367 } 368 GetClassArrayClassDescriptor()369 const uint8_t *GetClassArrayClassDescriptor() const 370 { 371 return base_->GetClassArrayClassDescriptor(); 372 } 373 GetStringArrayClassDescriptor()374 const uint8_t *GetStringArrayClassDescriptor() const 375 { 376 return base_->GetStringArrayClassDescriptor(); 377 } 378 GetCtorName()379 const uint8_t *GetCtorName() const 380 { 381 return base_->GetCtorName(); 382 } 383 GetCctorName()384 const uint8_t *GetCctorName() const 385 { 386 return base_->GetCctorName(); 387 } 388 GetNullPointerExceptionClassDescriptor()389 const uint8_t *GetNullPointerExceptionClassDescriptor() const 390 { 391 return base_->GetNullPointerExceptionClassDescriptor(); 392 } 393 GetStackOverflowErrorClassDescriptor()394 const uint8_t *GetStackOverflowErrorClassDescriptor() const 395 { 396 return base_->GetStackOverflowErrorClassDescriptor(); 397 } 398 ThrowStackOverflowException(ManagedThread * thread)399 void ThrowStackOverflowException(ManagedThread *thread) const 400 { 401 return base_->ThrowStackOverflowException(thread); 402 } 403 GetArrayIndexOutOfBoundsExceptionClassDescriptor()404 const uint8_t *GetArrayIndexOutOfBoundsExceptionClassDescriptor() const 405 { 406 return base_->GetArrayIndexOutOfBoundsExceptionClassDescriptor(); 407 } 408 GetIndexOutOfBoundsExceptionClassDescriptor()409 const uint8_t *GetIndexOutOfBoundsExceptionClassDescriptor() const 410 { 411 return base_->GetIndexOutOfBoundsExceptionClassDescriptor(); 412 } 413 GetIllegalStateExceptionClassDescriptor()414 const uint8_t *GetIllegalStateExceptionClassDescriptor() const 415 { 416 return base_->GetIllegalStateExceptionClassDescriptor(); 417 } 418 GetNegativeArraySizeExceptionClassDescriptor()419 const uint8_t *GetNegativeArraySizeExceptionClassDescriptor() const 420 { 421 return base_->GetNegativeArraySizeExceptionClassDescriptor(); 422 } 423 GetStringIndexOutOfBoundsExceptionClassDescriptor()424 const uint8_t *GetStringIndexOutOfBoundsExceptionClassDescriptor() const 425 { 426 return base_->GetStringIndexOutOfBoundsExceptionClassDescriptor(); 427 } 428 GetArithmeticExceptionClassDescriptor()429 const uint8_t *GetArithmeticExceptionClassDescriptor() const 430 { 431 return base_->GetArithmeticExceptionClassDescriptor(); 432 } 433 GetClassCastExceptionClassDescriptor()434 const uint8_t *GetClassCastExceptionClassDescriptor() const 435 { 436 return base_->GetClassCastExceptionClassDescriptor(); 437 } 438 GetAbstractMethodErrorClassDescriptor()439 const uint8_t *GetAbstractMethodErrorClassDescriptor() const 440 { 441 return base_->GetAbstractMethodErrorClassDescriptor(); 442 } 443 GetArrayStoreExceptionClassDescriptor()444 const uint8_t *GetArrayStoreExceptionClassDescriptor() const 445 { 446 return base_->GetArrayStoreExceptionClassDescriptor(); 447 } 448 GetRuntimeExceptionClassDescriptor()449 const uint8_t *GetRuntimeExceptionClassDescriptor() const 450 { 451 return base_->GetRuntimeExceptionClassDescriptor(); 452 } 453 GetFileNotFoundExceptionClassDescriptor()454 const uint8_t *GetFileNotFoundExceptionClassDescriptor() const 455 { 456 return base_->GetFileNotFoundExceptionClassDescriptor(); 457 } 458 GetIOExceptionClassDescriptor()459 const uint8_t *GetIOExceptionClassDescriptor() const 460 { 461 return base_->GetIOExceptionClassDescriptor(); 462 } 463 GetIllegalArgumentExceptionClassDescriptor()464 const uint8_t *GetIllegalArgumentExceptionClassDescriptor() const 465 { 466 return base_->GetIllegalArgumentExceptionClassDescriptor(); 467 } 468 GetIllegalAccessExceptionClassDescriptor()469 const uint8_t *GetIllegalAccessExceptionClassDescriptor() const 470 { 471 return base_->GetIllegalAccessExceptionClassDescriptor(); 472 } 473 GetOutOfMemoryErrorClassDescriptor()474 const uint8_t *GetOutOfMemoryErrorClassDescriptor() const 475 { 476 return base_->GetOutOfMemoryErrorClassDescriptor(); 477 } 478 GetNoClassDefFoundErrorDescriptor()479 const uint8_t *GetNoClassDefFoundErrorDescriptor() const 480 { 481 return base_->GetNoClassDefFoundErrorDescriptor(); 482 } 483 GetClassCircularityErrorDescriptor()484 const uint8_t *GetClassCircularityErrorDescriptor() const 485 { 486 return base_->GetClassCircularityErrorDescriptor(); 487 } 488 GetCoroutinesLimitExceedErrorDescriptor()489 const uint8_t *GetCoroutinesLimitExceedErrorDescriptor() const 490 { 491 return base_->GetCoroutinesLimitExceedErrorDescriptor(); 492 } 493 GetNoSuchFieldErrorDescriptor()494 const uint8_t *GetNoSuchFieldErrorDescriptor() const 495 { 496 return base_->GetNoSuchFieldErrorDescriptor(); 497 } 498 GetNoSuchMethodErrorDescriptor()499 const uint8_t *GetNoSuchMethodErrorDescriptor() const 500 { 501 return base_->GetNoSuchMethodErrorDescriptor(); 502 } 503 GetExceptionInInitializerErrorDescriptor()504 const uint8_t *GetExceptionInInitializerErrorDescriptor() const 505 { 506 return base_->GetExceptionInInitializerErrorDescriptor(); 507 } 508 GetClassNotFoundExceptionDescriptor()509 const uint8_t *GetClassNotFoundExceptionDescriptor() const 510 { 511 return base_->GetClassNotFoundExceptionDescriptor(); 512 } 513 GetInstantiationErrorDescriptor()514 const uint8_t *GetInstantiationErrorDescriptor() const 515 { 516 return base_->GetInstantiationErrorDescriptor(); 517 } 518 GetUnsupportedOperationExceptionClassDescriptor()519 const uint8_t *GetUnsupportedOperationExceptionClassDescriptor() const 520 { 521 return base_->GetUnsupportedOperationExceptionClassDescriptor(); 522 } 523 GetVerifyErrorClassDescriptor()524 const uint8_t *GetVerifyErrorClassDescriptor() const 525 { 526 return base_->GetVerifyErrorClassDescriptor(); 527 } 528 GetIllegalMonitorStateExceptionDescriptor()529 const uint8_t *GetIllegalMonitorStateExceptionDescriptor() const 530 { 531 return base_->GetIllegalMonitorStateExceptionDescriptor(); 532 } 533 GetCloneNotSupportedExceptionDescriptor()534 const uint8_t *GetCloneNotSupportedExceptionDescriptor() const 535 { 536 return base_->GetCloneNotSupportedExceptionDescriptor(); 537 } 538 GetErrorClassDescriptor()539 const uint8_t *GetErrorClassDescriptor() const 540 { 541 return base_->GetErrorClassDescriptor(); 542 } 543 GetIncompatibleClassChangeErrorDescriptor()544 const uint8_t *GetIncompatibleClassChangeErrorDescriptor() const 545 { 546 return base_->GetIncompatibleClassChangeErrorDescriptor(); 547 } 548 549 friend std::ostream &operator<<(std::ostream &stream, const LanguageContext &ctx) 550 { 551 return stream << ark::panda_file::LanguageToString(ctx.base_->GetLanguage()); 552 } 553 IsCallableObject(ObjectHeader * obj)554 bool IsCallableObject([[maybe_unused]] ObjectHeader *obj) 555 { 556 return base_->IsCallableObject(obj); 557 } 558 GetCallTarget(ObjectHeader * obj)559 Method *GetCallTarget(ObjectHeader *obj) const 560 { 561 return base_->GetCallTarget(obj); 562 } 563 GetReferenceErrorDescriptor()564 const uint8_t *GetReferenceErrorDescriptor() const 565 { 566 return base_->GetReferenceErrorDescriptor(); 567 } 568 GetTypedErrorDescriptor()569 const uint8_t *GetTypedErrorDescriptor() const 570 { 571 return base_->GetTypedErrorDescriptor(); 572 } 573 GetFrameExtSize()574 uint32_t GetFrameExtSize() const 575 { 576 return base_->GetFrameExtSize(); 577 } 578 CreateIMTableBuilder()579 PandaUniquePtr<IMTableBuilder> CreateIMTableBuilder() 580 { 581 return base_->CreateIMTableBuilder(); 582 } 583 CreateITableBuilder(ClassLinkerErrorHandler * errHandler)584 PandaUniquePtr<ITableBuilder> CreateITableBuilder(ClassLinkerErrorHandler *errHandler) 585 { 586 return base_->CreateITableBuilder(errHandler); 587 } 588 CreateVTableBuilder(ClassLinkerErrorHandler * errHandler)589 PandaUniquePtr<VTableBuilder> CreateVTableBuilder(ClassLinkerErrorHandler *errHandler) 590 { 591 return base_->CreateVTableBuilder(errHandler); 592 } 593 InitializeClass(ClassLinker * classLinker,ManagedThread * thread,Class * klass)594 bool InitializeClass(ClassLinker *classLinker, ManagedThread *thread, Class *klass) const 595 { 596 return base_->InitializeClass(classLinker, thread, klass); 597 } 598 CreateTrace(PandaUniquePtr<ark::os::file::File> traceFile,size_t bufferSize)599 Trace *CreateTrace(PandaUniquePtr<ark::os::file::File> traceFile, size_t bufferSize) const 600 { 601 return base_->CreateTrace(std::move(traceFile), bufferSize); 602 } 603 GetStringSize(const ObjectHeader * stringObject)604 size_t GetStringSize(const ObjectHeader *stringObject) const 605 { 606 return base_->GetStringSize(stringObject); 607 } 608 GetVerificationInitAPI()609 VerificationInitAPI GetVerificationInitAPI() const 610 { 611 return base_->GetVerificationInitAPI(); 612 } 613 GetVerificationTypeClass()614 const char *GetVerificationTypeClass() const 615 { 616 return base_->GetVerificationTypeClass(); 617 } 618 GetVerificationTypeObject()619 const char *GetVerificationTypeObject() const 620 { 621 return base_->GetVerificationTypeObject(); 622 } 623 GetVerificationTypeThrowable()624 const char *GetVerificationTypeThrowable() const 625 { 626 return base_->GetVerificationTypeThrowable(); 627 } 628 GetBootPandaFilesOpenMode()629 ark::panda_file::File::OpenMode GetBootPandaFilesOpenMode() const 630 { 631 return base_->GetBootPandaFilesOpenMode(); 632 } 633 RestoreEnv(Frame * currentIframe,const StackWalker::EnvData & envData)634 virtual void RestoreEnv(Frame *currentIframe, const StackWalker::EnvData &envData) const 635 { 636 return base_->RestoreEnv(currentIframe, envData); 637 } 638 IsEnabledCHA()639 virtual bool IsEnabledCHA() const 640 { 641 return base_->IsEnabledCHA(); 642 } 643 InitializeOsrCframeSlots(Span<uintptr_t> paramSlots)644 void InitializeOsrCframeSlots(Span<uintptr_t> paramSlots) const 645 { 646 base_->InitializeOsrCframeSlots(paramSlots); 647 } 648 GetOsrEnv(const Frame * iframe,compiler::VRegInfo vregInfo)649 uint64_t GetOsrEnv(const Frame *iframe, compiler::VRegInfo vregInfo) const 650 { 651 return base_->GetOsrEnv(iframe, vregInfo); 652 } 653 WrapClassInitializerException(ClassLinker * classLinker,ManagedThread * thread)654 void WrapClassInitializerException(ClassLinker *classLinker, ManagedThread *thread) const 655 { 656 base_->WrapClassInitializerException(classLinker, thread); 657 } 658 659 private: 660 const LanguageContextBase *base_; 661 }; 662 663 } // namespace ark 664 665 #endif // PANDA_RUNTIME_LANGUAGE_CONTEXT_H_ 666