1 /** 2 * Copyright (c) 2021-2024 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 ThrowStackOverflowException(ManagedThread * thread)177 virtual void ThrowStackOverflowException([[maybe_unused]] ManagedThread *thread) const 178 { 179 UNREACHABLE(); 180 } 181 GetCloneNotSupportedExceptionDescriptor()182 virtual const uint8_t *GetCloneNotSupportedExceptionDescriptor() const 183 { 184 UNREACHABLE(); 185 } 186 GetFrameExtSize()187 virtual uint32_t GetFrameExtSize() const 188 { 189 return 0; 190 } 191 GetIncompatibleClassChangeErrorDescriptor()192 virtual const uint8_t *GetIncompatibleClassChangeErrorDescriptor() const 193 { 194 UNREACHABLE(); 195 } 196 CreateIMTableBuilder()197 virtual PandaUniquePtr<IMTableBuilder> CreateIMTableBuilder() const 198 { 199 return MakePandaUnique<IMTableBuilder>(); 200 } 201 GetErrorClassDescriptor()202 virtual const uint8_t *GetErrorClassDescriptor() const 203 { 204 return nullptr; 205 } 206 CreateITableBuilder(ClassLinkerErrorHandler * errHandler)207 virtual PandaUniquePtr<ITableBuilder> CreateITableBuilder( 208 [[maybe_unused]] ClassLinkerErrorHandler *errHandler) const 209 { 210 return nullptr; 211 } 212 CreateVTableBuilder(ClassLinkerErrorHandler * errHandler)213 virtual PandaUniquePtr<VTableBuilder> CreateVTableBuilder( 214 [[maybe_unused]] ClassLinkerErrorHandler *errHandler) const 215 { 216 return nullptr; 217 } 218 InitializeClass(ClassLinker * classLinker,ManagedThread * thread,Class * klass)219 virtual bool InitializeClass([[maybe_unused]] ClassLinker *classLinker, [[maybe_unused]] ManagedThread *thread, 220 [[maybe_unused]] Class *klass) const 221 { 222 return true; 223 } 224 GetStringSize(const ObjectHeader * stringObject)225 virtual size_t GetStringSize(const ObjectHeader *stringObject) const 226 { 227 return stringObject->ObjectSize(); 228 } 229 CreateTrace(PandaUniquePtr<ark::os::file::File> traceFile,size_t bufferSize)230 virtual Trace *CreateTrace([[maybe_unused]] PandaUniquePtr<ark::os::file::File> traceFile, 231 [[maybe_unused]] size_t bufferSize) const 232 { 233 UNREACHABLE(); 234 } 235 GetBootPandaFilesOpenMode()236 virtual ark::panda_file::File::OpenMode GetBootPandaFilesOpenMode() const 237 { 238 return panda_file::File::READ_ONLY; 239 } 240 GetVerificationInitAPI()241 virtual VerificationInitAPI GetVerificationInitAPI() const 242 { 243 return VerificationInitAPI(); 244 } 245 GetVerificationTypeClass()246 virtual const char *GetVerificationTypeClass() const 247 { 248 return nullptr; 249 } 250 GetVerificationTypeObject()251 virtual const char *GetVerificationTypeObject() const 252 { 253 return nullptr; 254 } 255 GetVerificationTypeThrowable()256 virtual const char *GetVerificationTypeThrowable() const 257 { 258 return nullptr; 259 } 260 RestoreEnv(Frame * currentIframe,const StackWalker::EnvData & envData)261 virtual void RestoreEnv([[maybe_unused]] Frame *currentIframe, 262 [[maybe_unused]] const StackWalker::EnvData &envData) const 263 { 264 } 265 IsEnabledCHA()266 virtual bool IsEnabledCHA() const 267 { 268 return true; 269 } 270 InitializeOsrCframeSlots(Span<uintptr_t> paramSlots)271 virtual void InitializeOsrCframeSlots([[maybe_unused]] Span<uintptr_t> paramSlots) const {} 272 GetOsrEnv(const Frame * iframe,compiler::VRegInfo vregInfo)273 virtual uint64_t GetOsrEnv([[maybe_unused]] const Frame *iframe, [[maybe_unused]] compiler::VRegInfo vregInfo) const 274 { 275 return 0; 276 } 277 278 virtual void WrapClassInitializerException(ClassLinker *classLinker, ManagedThread *thread) const; 279 }; 280 281 class LanguageContext { 282 public: LanguageContext(const LanguageContextBase * context)283 explicit LanguageContext(const LanguageContextBase *context) : base_(context) {} 284 285 DEFAULT_COPY_SEMANTIC(LanguageContext); 286 DEFAULT_MOVE_SEMANTIC(LanguageContext); 287 288 ~LanguageContext() = default; 289 GetLanguage()290 panda_file::SourceLang GetLanguage() const 291 { 292 return base_->GetLanguage(); 293 } 294 GetLanguageType()295 LangTypeT GetLanguageType() const 296 { 297 return base_->GetLanguageType(); 298 } 299 GetInitialTaggedValue()300 coretypes::TaggedValue GetInitialTaggedValue() const 301 { 302 return base_->GetInitialTaggedValue(); 303 } 304 GetEncodedTaggedValue(int64_t value,int64_t tag)305 coretypes::TaggedValue GetEncodedTaggedValue(int64_t value, int64_t tag) const 306 { 307 return base_->GetEncodedTaggedValue(value, tag); 308 } 309 GetCatchMethodAndOffset(Method * method,ManagedThread * thread)310 std::pair<Method *, uint32_t> GetCatchMethodAndOffset(Method *method, ManagedThread *thread) const 311 { 312 return base_->GetCatchMethodAndOffset(method, thread); 313 } 314 CreateVM(Runtime * runtime,const RuntimeOptions & options)315 PandaVM *CreateVM(Runtime *runtime, const RuntimeOptions &options) 316 { 317 return base_->CreateVM(runtime, options); 318 } 319 CreateGC(mem::GCType gcType,mem::ObjectAllocatorBase * objectAllocator,const mem::GCSettings & settings)320 mem::GC *CreateGC(mem::GCType gcType, mem::ObjectAllocatorBase *objectAllocator, 321 const mem::GCSettings &settings) const 322 { 323 return base_->CreateGC(gcType, objectAllocator, settings); 324 } 325 CreateClassLinkerExtension()326 std::unique_ptr<ClassLinkerExtension> CreateClassLinkerExtension() 327 { 328 return base_->CreateClassLinkerExtension(); 329 } 330 CreatePtLangExt()331 std::unique_ptr<tooling::PtLangExt> CreatePtLangExt() 332 { 333 return base_->CreatePtLangExt(); 334 } 335 ThrowException(ManagedThread * thread,const uint8_t * mutf8Name,const uint8_t * mutf8Msg)336 void ThrowException(ManagedThread *thread, const uint8_t *mutf8Name, const uint8_t *mutf8Msg) const 337 { 338 base_->ThrowException(thread, mutf8Name, mutf8Msg); 339 } 340 SetExceptionToVReg(interpreter::AccVRegister & vreg,ObjectHeader * obj)341 void SetExceptionToVReg( 342 [[maybe_unused]] interpreter::AccVRegister &vreg, // NOLINTNEXTLINE(google-runtime-references) 343 [[maybe_unused]] ObjectHeader *obj) const 344 { 345 base_->SetExceptionToVReg(vreg, obj); 346 } 347 GetStringClassDescriptor()348 const uint8_t *GetStringClassDescriptor() const 349 { 350 return base_->GetStringClassDescriptor(); 351 } 352 GetObjectClassDescriptor()353 const uint8_t *GetObjectClassDescriptor() const 354 { 355 return base_->GetObjectClassDescriptor(); 356 } 357 GetClassClassDescriptor()358 const uint8_t *GetClassClassDescriptor() const 359 { 360 return base_->GetClassClassDescriptor(); 361 } 362 GetClassArrayClassDescriptor()363 const uint8_t *GetClassArrayClassDescriptor() const 364 { 365 return base_->GetClassArrayClassDescriptor(); 366 } 367 GetStringArrayClassDescriptor()368 const uint8_t *GetStringArrayClassDescriptor() const 369 { 370 return base_->GetStringArrayClassDescriptor(); 371 } 372 GetCtorName()373 const uint8_t *GetCtorName() const 374 { 375 return base_->GetCtorName(); 376 } 377 GetCctorName()378 const uint8_t *GetCctorName() const 379 { 380 return base_->GetCctorName(); 381 } 382 GetNullPointerExceptionClassDescriptor()383 const uint8_t *GetNullPointerExceptionClassDescriptor() const 384 { 385 return base_->GetNullPointerExceptionClassDescriptor(); 386 } 387 GetStackOverflowErrorClassDescriptor()388 const uint8_t *GetStackOverflowErrorClassDescriptor() const 389 { 390 return base_->GetStackOverflowErrorClassDescriptor(); 391 } 392 ThrowStackOverflowException(ManagedThread * thread)393 void ThrowStackOverflowException(ManagedThread *thread) const 394 { 395 return base_->ThrowStackOverflowException(thread); 396 } 397 GetArrayIndexOutOfBoundsExceptionClassDescriptor()398 const uint8_t *GetArrayIndexOutOfBoundsExceptionClassDescriptor() const 399 { 400 return base_->GetArrayIndexOutOfBoundsExceptionClassDescriptor(); 401 } 402 GetIndexOutOfBoundsExceptionClassDescriptor()403 const uint8_t *GetIndexOutOfBoundsExceptionClassDescriptor() const 404 { 405 return base_->GetIndexOutOfBoundsExceptionClassDescriptor(); 406 } 407 GetIllegalStateExceptionClassDescriptor()408 const uint8_t *GetIllegalStateExceptionClassDescriptor() const 409 { 410 return base_->GetIllegalStateExceptionClassDescriptor(); 411 } 412 GetNegativeArraySizeExceptionClassDescriptor()413 const uint8_t *GetNegativeArraySizeExceptionClassDescriptor() const 414 { 415 return base_->GetNegativeArraySizeExceptionClassDescriptor(); 416 } 417 GetStringIndexOutOfBoundsExceptionClassDescriptor()418 const uint8_t *GetStringIndexOutOfBoundsExceptionClassDescriptor() const 419 { 420 return base_->GetStringIndexOutOfBoundsExceptionClassDescriptor(); 421 } 422 GetArithmeticExceptionClassDescriptor()423 const uint8_t *GetArithmeticExceptionClassDescriptor() const 424 { 425 return base_->GetArithmeticExceptionClassDescriptor(); 426 } 427 GetClassCastExceptionClassDescriptor()428 const uint8_t *GetClassCastExceptionClassDescriptor() const 429 { 430 return base_->GetClassCastExceptionClassDescriptor(); 431 } 432 GetAbstractMethodErrorClassDescriptor()433 const uint8_t *GetAbstractMethodErrorClassDescriptor() const 434 { 435 return base_->GetAbstractMethodErrorClassDescriptor(); 436 } 437 GetArrayStoreExceptionClassDescriptor()438 const uint8_t *GetArrayStoreExceptionClassDescriptor() const 439 { 440 return base_->GetArrayStoreExceptionClassDescriptor(); 441 } 442 GetRuntimeExceptionClassDescriptor()443 const uint8_t *GetRuntimeExceptionClassDescriptor() const 444 { 445 return base_->GetRuntimeExceptionClassDescriptor(); 446 } 447 GetFileNotFoundExceptionClassDescriptor()448 const uint8_t *GetFileNotFoundExceptionClassDescriptor() const 449 { 450 return base_->GetFileNotFoundExceptionClassDescriptor(); 451 } 452 GetIOExceptionClassDescriptor()453 const uint8_t *GetIOExceptionClassDescriptor() const 454 { 455 return base_->GetIOExceptionClassDescriptor(); 456 } 457 GetIllegalArgumentExceptionClassDescriptor()458 const uint8_t *GetIllegalArgumentExceptionClassDescriptor() const 459 { 460 return base_->GetIllegalArgumentExceptionClassDescriptor(); 461 } 462 GetIllegalAccessExceptionClassDescriptor()463 const uint8_t *GetIllegalAccessExceptionClassDescriptor() const 464 { 465 return base_->GetIllegalAccessExceptionClassDescriptor(); 466 } 467 GetOutOfMemoryErrorClassDescriptor()468 const uint8_t *GetOutOfMemoryErrorClassDescriptor() const 469 { 470 return base_->GetOutOfMemoryErrorClassDescriptor(); 471 } 472 GetNoClassDefFoundErrorDescriptor()473 const uint8_t *GetNoClassDefFoundErrorDescriptor() const 474 { 475 return base_->GetNoClassDefFoundErrorDescriptor(); 476 } 477 GetClassCircularityErrorDescriptor()478 const uint8_t *GetClassCircularityErrorDescriptor() const 479 { 480 return base_->GetClassCircularityErrorDescriptor(); 481 } 482 GetNoSuchFieldErrorDescriptor()483 const uint8_t *GetNoSuchFieldErrorDescriptor() const 484 { 485 return base_->GetNoSuchFieldErrorDescriptor(); 486 } 487 GetNoSuchMethodErrorDescriptor()488 const uint8_t *GetNoSuchMethodErrorDescriptor() const 489 { 490 return base_->GetNoSuchMethodErrorDescriptor(); 491 } 492 GetExceptionInInitializerErrorDescriptor()493 const uint8_t *GetExceptionInInitializerErrorDescriptor() const 494 { 495 return base_->GetExceptionInInitializerErrorDescriptor(); 496 } 497 GetClassNotFoundExceptionDescriptor()498 const uint8_t *GetClassNotFoundExceptionDescriptor() const 499 { 500 return base_->GetClassNotFoundExceptionDescriptor(); 501 } 502 GetInstantiationErrorDescriptor()503 const uint8_t *GetInstantiationErrorDescriptor() const 504 { 505 return base_->GetInstantiationErrorDescriptor(); 506 } 507 GetUnsupportedOperationExceptionClassDescriptor()508 const uint8_t *GetUnsupportedOperationExceptionClassDescriptor() const 509 { 510 return base_->GetUnsupportedOperationExceptionClassDescriptor(); 511 } 512 GetVerifyErrorClassDescriptor()513 const uint8_t *GetVerifyErrorClassDescriptor() const 514 { 515 return base_->GetVerifyErrorClassDescriptor(); 516 } 517 GetIllegalMonitorStateExceptionDescriptor()518 const uint8_t *GetIllegalMonitorStateExceptionDescriptor() const 519 { 520 return base_->GetIllegalMonitorStateExceptionDescriptor(); 521 } 522 GetCloneNotSupportedExceptionDescriptor()523 const uint8_t *GetCloneNotSupportedExceptionDescriptor() const 524 { 525 return base_->GetCloneNotSupportedExceptionDescriptor(); 526 } 527 GetErrorClassDescriptor()528 const uint8_t *GetErrorClassDescriptor() const 529 { 530 return base_->GetErrorClassDescriptor(); 531 } 532 GetIncompatibleClassChangeErrorDescriptor()533 const uint8_t *GetIncompatibleClassChangeErrorDescriptor() const 534 { 535 return base_->GetIncompatibleClassChangeErrorDescriptor(); 536 } 537 538 friend std::ostream &operator<<(std::ostream &stream, const LanguageContext &ctx) 539 { 540 return stream << ark::panda_file::LanguageToString(ctx.base_->GetLanguage()); 541 } 542 IsCallableObject(ObjectHeader * obj)543 bool IsCallableObject([[maybe_unused]] ObjectHeader *obj) 544 { 545 return base_->IsCallableObject(obj); 546 } 547 GetCallTarget(ObjectHeader * obj)548 Method *GetCallTarget(ObjectHeader *obj) const 549 { 550 return base_->GetCallTarget(obj); 551 } 552 GetReferenceErrorDescriptor()553 const uint8_t *GetReferenceErrorDescriptor() const 554 { 555 return base_->GetReferenceErrorDescriptor(); 556 } 557 GetTypedErrorDescriptor()558 const uint8_t *GetTypedErrorDescriptor() const 559 { 560 return base_->GetTypedErrorDescriptor(); 561 } 562 GetFrameExtSize()563 uint32_t GetFrameExtSize() const 564 { 565 return base_->GetFrameExtSize(); 566 } 567 CreateIMTableBuilder()568 PandaUniquePtr<IMTableBuilder> CreateIMTableBuilder() 569 { 570 return base_->CreateIMTableBuilder(); 571 } 572 CreateITableBuilder(ClassLinkerErrorHandler * errHandler)573 PandaUniquePtr<ITableBuilder> CreateITableBuilder(ClassLinkerErrorHandler *errHandler) 574 { 575 return base_->CreateITableBuilder(errHandler); 576 } 577 CreateVTableBuilder(ClassLinkerErrorHandler * errHandler)578 PandaUniquePtr<VTableBuilder> CreateVTableBuilder(ClassLinkerErrorHandler *errHandler) 579 { 580 return base_->CreateVTableBuilder(errHandler); 581 } 582 InitializeClass(ClassLinker * classLinker,ManagedThread * thread,Class * klass)583 bool InitializeClass(ClassLinker *classLinker, ManagedThread *thread, Class *klass) const 584 { 585 return base_->InitializeClass(classLinker, thread, klass); 586 } 587 CreateTrace(PandaUniquePtr<ark::os::file::File> traceFile,size_t bufferSize)588 Trace *CreateTrace(PandaUniquePtr<ark::os::file::File> traceFile, size_t bufferSize) const 589 { 590 return base_->CreateTrace(std::move(traceFile), bufferSize); 591 } 592 GetStringSize(const ObjectHeader * stringObject)593 size_t GetStringSize(const ObjectHeader *stringObject) const 594 { 595 return base_->GetStringSize(stringObject); 596 } 597 GetVerificationInitAPI()598 VerificationInitAPI GetVerificationInitAPI() const 599 { 600 return base_->GetVerificationInitAPI(); 601 } 602 GetVerificationTypeClass()603 const char *GetVerificationTypeClass() const 604 { 605 return base_->GetVerificationTypeClass(); 606 } 607 GetVerificationTypeObject()608 const char *GetVerificationTypeObject() const 609 { 610 return base_->GetVerificationTypeObject(); 611 } 612 GetVerificationTypeThrowable()613 const char *GetVerificationTypeThrowable() const 614 { 615 return base_->GetVerificationTypeThrowable(); 616 } 617 GetBootPandaFilesOpenMode()618 ark::panda_file::File::OpenMode GetBootPandaFilesOpenMode() const 619 { 620 return base_->GetBootPandaFilesOpenMode(); 621 } 622 RestoreEnv(Frame * currentIframe,const StackWalker::EnvData & envData)623 virtual void RestoreEnv(Frame *currentIframe, const StackWalker::EnvData &envData) const 624 { 625 return base_->RestoreEnv(currentIframe, envData); 626 } 627 IsEnabledCHA()628 virtual bool IsEnabledCHA() const 629 { 630 return base_->IsEnabledCHA(); 631 } 632 InitializeOsrCframeSlots(Span<uintptr_t> paramSlots)633 void InitializeOsrCframeSlots(Span<uintptr_t> paramSlots) const 634 { 635 base_->InitializeOsrCframeSlots(paramSlots); 636 } 637 GetOsrEnv(const Frame * iframe,compiler::VRegInfo vregInfo)638 uint64_t GetOsrEnv(const Frame *iframe, compiler::VRegInfo vregInfo) const 639 { 640 return base_->GetOsrEnv(iframe, vregInfo); 641 } 642 WrapClassInitializerException(ClassLinker * classLinker,ManagedThread * thread)643 void WrapClassInitializerException(ClassLinker *classLinker, ManagedThread *thread) const 644 { 645 base_->WrapClassInitializerException(classLinker, thread); 646 } 647 648 private: 649 const LanguageContextBase *base_; 650 }; 651 652 } // namespace ark 653 654 #endif // PANDA_RUNTIME_LANGUAGE_CONTEXT_H_ 655