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 #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.h" 31 #include "runtime/include/tooling/inspector_extension.h" 32 #include "runtime/include/tooling/pt_lang_extension.h" 33 #include "runtime/include/stack_walker.h" 34 #include "runtime/mem/gc/gc_types.h" 35 namespace panda { 36 class Thread; 37 class Trace; 38 class Runtime; 39 class RuntimeOptions; 40 41 namespace mem { 42 class GC; 43 class ObjectAllocatorBase; 44 class GCSettings; 45 } // namespace mem 46 47 struct VerificationInitAPI { 48 std::vector<panda_file::Type::TypeId> primitiveRootsForVerification; 49 std::vector<const uint8_t *> arrayElementsForVerification; 50 bool isNeedObjectSyntheticClass = false; 51 bool isNeedStringSyntheticClass = false; 52 bool isNeedClassSyntheticClass = false; 53 }; 54 55 class LanguageContextBase { 56 public: 57 LanguageContextBase() = default; 58 59 DEFAULT_COPY_SEMANTIC(LanguageContextBase); 60 DEFAULT_MOVE_SEMANTIC(LanguageContextBase); 61 62 virtual ~LanguageContextBase() = default; 63 64 virtual panda_file::SourceLang GetLanguage() const = 0; 65 GetStringClassDescriptor()66 virtual const uint8_t *GetStringClassDescriptor() const 67 { 68 return utf::CStringAsMutf8(panda::panda_file::GetStringClassDescriptor(GetLanguage())); 69 } 70 71 virtual LangTypeT GetLanguageType() const = 0; 72 73 virtual const uint8_t *GetObjectClassDescriptor() const = 0; 74 75 virtual const uint8_t *GetClassClassDescriptor() const = 0; 76 77 virtual const uint8_t *GetClassArrayClassDescriptor() const = 0; 78 79 virtual const uint8_t *GetStringArrayClassDescriptor() const = 0; 80 GetCtorName()81 virtual const uint8_t *GetCtorName() const 82 { 83 return utf::CStringAsMutf8(panda::panda_file::GetCtorName(GetLanguage())); 84 } 85 GetCctorName()86 virtual const uint8_t *GetCctorName() const 87 { 88 return utf::CStringAsMutf8(panda::panda_file::GetCctorName(GetLanguage())); 89 } 90 91 virtual const uint8_t *GetNullPointerExceptionClassDescriptor() const = 0; 92 GetStackOverflowErrorClassDescriptor()93 virtual const uint8_t *GetStackOverflowErrorClassDescriptor() const 94 { 95 UNREACHABLE(); 96 return nullptr; 97 } 98 99 virtual const uint8_t *GetArrayIndexOutOfBoundsExceptionClassDescriptor() const = 0; 100 101 virtual const uint8_t *GetIndexOutOfBoundsExceptionClassDescriptor() const = 0; 102 103 virtual const uint8_t *GetIllegalStateExceptionClassDescriptor() const = 0; 104 105 virtual const uint8_t *GetNegativeArraySizeExceptionClassDescriptor() const = 0; 106 107 virtual const uint8_t *GetStringIndexOutOfBoundsExceptionClassDescriptor() const = 0; 108 109 virtual const uint8_t *GetArithmeticExceptionClassDescriptor() const = 0; 110 111 virtual const uint8_t *GetClassCastExceptionClassDescriptor() const = 0; 112 113 virtual const uint8_t *GetAbstractMethodErrorClassDescriptor() const = 0; 114 115 virtual const uint8_t *GetArrayStoreExceptionClassDescriptor() const = 0; 116 117 virtual const uint8_t *GetRuntimeExceptionClassDescriptor() const = 0; 118 119 virtual const uint8_t *GetFileNotFoundExceptionClassDescriptor() const = 0; 120 121 virtual const uint8_t *GetIOExceptionClassDescriptor() const = 0; 122 123 virtual const uint8_t *GetIllegalArgumentExceptionClassDescriptor() const = 0; 124 125 virtual const uint8_t *GetIllegalAccessExceptionClassDescriptor() const = 0; 126 127 virtual const uint8_t *GetOutOfMemoryErrorClassDescriptor() const = 0; 128 129 virtual const uint8_t *GetNoClassDefFoundErrorDescriptor() const = 0; 130 131 virtual const uint8_t *GetClassCircularityErrorDescriptor() const = 0; 132 133 virtual const uint8_t *GetNoSuchFieldErrorDescriptor() const = 0; 134 135 virtual const uint8_t *GetNoSuchMethodErrorDescriptor() const = 0; 136 137 virtual coretypes::TaggedValue GetInitialTaggedValue() const = 0; 138 139 virtual coretypes::TaggedValue GetEncodedTaggedValue(int64_t value, int64_t tag) const = 0; 140 141 virtual std::pair<Method *, uint32_t> GetCatchMethodAndOffset(Method *method, ManagedThread *thread) const; 142 143 virtual PandaVM *CreateVM(Runtime *runtime, const RuntimeOptions &options) const = 0; 144 145 virtual mem::GC *CreateGC(mem::GCType gcType, mem::ObjectAllocatorBase *objectAllocator, 146 const mem::GCSettings &settings) const = 0; 147 148 virtual std::unique_ptr<ClassLinkerExtension> CreateClassLinkerExtension() const; 149 150 virtual std::unique_ptr<tooling::InspectorExtension> CreateInspectorExtension() const; 151 152 virtual PandaUniquePtr<tooling::PtLangExt> CreatePtLangExt() const; 153 154 virtual void ThrowException(ManagedThread *thread, const uint8_t *mutf8Name, const uint8_t *mutf8Msg) const; 155 156 virtual void SetExceptionToVReg( 157 [[maybe_unused]] interpreter::AccVRegister &vreg, // NOLINTNEXTLINE(google-runtime-references) 158 [[maybe_unused]] ObjectHeader *obj) const; 159 160 virtual bool IsCallableObject([[maybe_unused]] ObjectHeader *obj) const = 0; 161 162 virtual Method *GetCallTarget(ObjectHeader *obj) const = 0; 163 164 virtual const uint8_t *GetExceptionInInitializerErrorDescriptor() const = 0; 165 166 virtual const uint8_t *GetClassNotFoundExceptionDescriptor() const = 0; 167 168 virtual const uint8_t *GetInstantiationErrorDescriptor() const = 0; 169 170 virtual const uint8_t *GetUnsupportedOperationExceptionClassDescriptor() const = 0; 171 172 virtual const uint8_t *GetVerifyErrorClassDescriptor() const = 0; 173 174 virtual const uint8_t *GetReferenceErrorDescriptor() const = 0; 175 176 virtual const uint8_t *GetTypedErrorDescriptor() const = 0; 177 178 virtual const uint8_t *GetIllegalMonitorStateExceptionDescriptor() const = 0; 179 ThrowStackOverflowException(ManagedThread * thread)180 virtual void ThrowStackOverflowException([[maybe_unused]] ManagedThread *thread) const 181 { 182 UNREACHABLE(); 183 } 184 GetCloneNotSupportedExceptionDescriptor()185 virtual const uint8_t *GetCloneNotSupportedExceptionDescriptor() const 186 { 187 UNREACHABLE(); 188 } 189 GetFrameExtSize()190 virtual uint32_t GetFrameExtSize() const 191 { 192 return 0; 193 } 194 GetIncompatibleClassChangeErrorDescriptor()195 virtual const uint8_t *GetIncompatibleClassChangeErrorDescriptor() const 196 { 197 UNREACHABLE(); 198 } 199 CreateIMTableBuilder()200 virtual PandaUniquePtr<IMTableBuilder> CreateIMTableBuilder() const 201 { 202 return MakePandaUnique<IMTableBuilder>(); 203 } 204 GetErrorClassDescriptor()205 virtual const uint8_t *GetErrorClassDescriptor() const 206 { 207 return nullptr; 208 } 209 CreateITableBuilder()210 virtual PandaUniquePtr<ITableBuilder> CreateITableBuilder() const 211 { 212 return nullptr; 213 } 214 CreateVTableBuilder()215 virtual PandaUniquePtr<VTableBuilder> CreateVTableBuilder() const 216 { 217 return nullptr; 218 } 219 InitializeClass(ClassLinker * classLinker,ManagedThread * thread,Class * klass)220 virtual bool InitializeClass([[maybe_unused]] ClassLinker *classLinker, [[maybe_unused]] ManagedThread *thread, 221 [[maybe_unused]] Class *klass) const 222 { 223 return true; 224 } 225 GetStringSize(const ObjectHeader * stringObject)226 virtual size_t GetStringSize(const ObjectHeader *stringObject) const 227 { 228 return stringObject->ObjectSize(); 229 } 230 CreateTrace(PandaUniquePtr<panda::os::file::File> traceFile,size_t bufferSize)231 virtual Trace *CreateTrace([[maybe_unused]] PandaUniquePtr<panda::os::file::File> traceFile, 232 [[maybe_unused]] size_t bufferSize) const 233 { 234 UNREACHABLE(); 235 } 236 GetBootPandaFilesOpenMode()237 virtual panda::panda_file::File::OpenMode GetBootPandaFilesOpenMode() const 238 { 239 return panda_file::File::READ_ONLY; 240 } 241 GetVerificationInitAPI()242 virtual VerificationInitAPI GetVerificationInitAPI() const 243 { 244 return VerificationInitAPI(); 245 } 246 GetVerificationTypeClass()247 virtual const char *GetVerificationTypeClass() const 248 { 249 return nullptr; 250 } 251 GetVerificationTypeObject()252 virtual const char *GetVerificationTypeObject() const 253 { 254 return nullptr; 255 } 256 GetVerificationTypeThrowable()257 virtual const char *GetVerificationTypeThrowable() const 258 { 259 return nullptr; 260 } 261 RestoreEnv(Frame * currentIframe,const StackWalker::EnvData & envData)262 virtual void RestoreEnv([[maybe_unused]] Frame *currentIframe, 263 [[maybe_unused]] const StackWalker::EnvData &envData) const 264 { 265 } 266 IsEnabledCHA()267 virtual bool IsEnabledCHA() const 268 { 269 return true; 270 } 271 InitializeOsrCframeSlots(Span<uintptr_t> paramSlots)272 virtual void InitializeOsrCframeSlots([[maybe_unused]] Span<uintptr_t> paramSlots) const {} 273 GetOsrEnv(const Frame * iframe,compiler::VRegInfo vregInfo)274 virtual uint64_t GetOsrEnv([[maybe_unused]] const Frame *iframe, [[maybe_unused]] compiler::VRegInfo vregInfo) const 275 { 276 return 0; 277 } 278 279 virtual void WrapClassInitializerException(ClassLinker *classLinker, ManagedThread *thread) const; 280 }; 281 282 class LanguageContext { 283 public: LanguageContext(const LanguageContextBase * context)284 explicit LanguageContext(const LanguageContextBase *context) : base_(context) {} 285 286 DEFAULT_COPY_SEMANTIC(LanguageContext); 287 DEFAULT_MOVE_SEMANTIC(LanguageContext); 288 289 ~LanguageContext() = default; 290 GetLanguage()291 panda_file::SourceLang GetLanguage() const 292 { 293 return base_->GetLanguage(); 294 } 295 GetLanguageType()296 LangTypeT GetLanguageType() const 297 { 298 return base_->GetLanguageType(); 299 } 300 GetInitialTaggedValue()301 coretypes::TaggedValue GetInitialTaggedValue() const 302 { 303 return base_->GetInitialTaggedValue(); 304 } 305 GetEncodedTaggedValue(int64_t value,int64_t tag)306 coretypes::TaggedValue GetEncodedTaggedValue(int64_t value, int64_t tag) const 307 { 308 return base_->GetEncodedTaggedValue(value, tag); 309 } 310 GetCatchMethodAndOffset(Method * method,ManagedThread * thread)311 std::pair<Method *, uint32_t> GetCatchMethodAndOffset(Method *method, ManagedThread *thread) const 312 { 313 return base_->GetCatchMethodAndOffset(method, thread); 314 } 315 CreateVM(Runtime * runtime,const RuntimeOptions & options)316 PandaVM *CreateVM(Runtime *runtime, const RuntimeOptions &options) 317 { 318 return base_->CreateVM(runtime, options); 319 } 320 CreateGC(mem::GCType gcType,mem::ObjectAllocatorBase * objectAllocator,const mem::GCSettings & settings)321 mem::GC *CreateGC(mem::GCType gcType, mem::ObjectAllocatorBase *objectAllocator, 322 const mem::GCSettings &settings) const 323 { 324 return base_->CreateGC(gcType, objectAllocator, settings); 325 } 326 CreateClassLinkerExtension()327 std::unique_ptr<ClassLinkerExtension> CreateClassLinkerExtension() 328 { 329 return base_->CreateClassLinkerExtension(); 330 } 331 CreateInspectorExtension()332 std::unique_ptr<tooling::InspectorExtension> CreateInspectorExtension() 333 { 334 return base_->CreateInspectorExtension(); 335 } 336 CreatePtLangExt()337 PandaUniquePtr<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 GetNoSuchFieldErrorDescriptor()489 const uint8_t *GetNoSuchFieldErrorDescriptor() const 490 { 491 return base_->GetNoSuchFieldErrorDescriptor(); 492 } 493 GetNoSuchMethodErrorDescriptor()494 const uint8_t *GetNoSuchMethodErrorDescriptor() const 495 { 496 return base_->GetNoSuchMethodErrorDescriptor(); 497 } 498 GetExceptionInInitializerErrorDescriptor()499 const uint8_t *GetExceptionInInitializerErrorDescriptor() const 500 { 501 return base_->GetExceptionInInitializerErrorDescriptor(); 502 } 503 GetClassNotFoundExceptionDescriptor()504 const uint8_t *GetClassNotFoundExceptionDescriptor() const 505 { 506 return base_->GetClassNotFoundExceptionDescriptor(); 507 } 508 GetInstantiationErrorDescriptor()509 const uint8_t *GetInstantiationErrorDescriptor() const 510 { 511 return base_->GetInstantiationErrorDescriptor(); 512 } 513 GetUnsupportedOperationExceptionClassDescriptor()514 const uint8_t *GetUnsupportedOperationExceptionClassDescriptor() const 515 { 516 return base_->GetUnsupportedOperationExceptionClassDescriptor(); 517 } 518 GetVerifyErrorClassDescriptor()519 const uint8_t *GetVerifyErrorClassDescriptor() const 520 { 521 return base_->GetVerifyErrorClassDescriptor(); 522 } 523 GetIllegalMonitorStateExceptionDescriptor()524 const uint8_t *GetIllegalMonitorStateExceptionDescriptor() const 525 { 526 return base_->GetIllegalMonitorStateExceptionDescriptor(); 527 } 528 GetCloneNotSupportedExceptionDescriptor()529 const uint8_t *GetCloneNotSupportedExceptionDescriptor() const 530 { 531 return base_->GetCloneNotSupportedExceptionDescriptor(); 532 } 533 GetErrorClassDescriptor()534 const uint8_t *GetErrorClassDescriptor() const 535 { 536 return base_->GetErrorClassDescriptor(); 537 } 538 GetIncompatibleClassChangeErrorDescriptor()539 const uint8_t *GetIncompatibleClassChangeErrorDescriptor() const 540 { 541 return base_->GetIncompatibleClassChangeErrorDescriptor(); 542 } 543 544 friend std::ostream &operator<<(std::ostream &stream, const LanguageContext &ctx) 545 { 546 return stream << panda::panda_file::LanguageToString(ctx.base_->GetLanguage()); 547 } 548 IsCallableObject(ObjectHeader * obj)549 bool IsCallableObject([[maybe_unused]] ObjectHeader *obj) 550 { 551 return base_->IsCallableObject(obj); 552 } 553 GetCallTarget(ObjectHeader * obj)554 Method *GetCallTarget(ObjectHeader *obj) const 555 { 556 return base_->GetCallTarget(obj); 557 } 558 GetReferenceErrorDescriptor()559 const uint8_t *GetReferenceErrorDescriptor() const 560 { 561 return base_->GetReferenceErrorDescriptor(); 562 } 563 GetTypedErrorDescriptor()564 const uint8_t *GetTypedErrorDescriptor() const 565 { 566 return base_->GetTypedErrorDescriptor(); 567 } 568 GetFrameExtSize()569 uint32_t GetFrameExtSize() const 570 { 571 return base_->GetFrameExtSize(); 572 } 573 CreateIMTableBuilder()574 PandaUniquePtr<IMTableBuilder> CreateIMTableBuilder() 575 { 576 return base_->CreateIMTableBuilder(); 577 } 578 CreateITableBuilder()579 PandaUniquePtr<ITableBuilder> CreateITableBuilder() 580 { 581 return base_->CreateITableBuilder(); 582 } 583 CreateVTableBuilder()584 PandaUniquePtr<VTableBuilder> CreateVTableBuilder() 585 { 586 return base_->CreateVTableBuilder(); 587 } 588 InitializeClass(ClassLinker * classLinker,ManagedThread * thread,Class * klass)589 bool InitializeClass(ClassLinker *classLinker, ManagedThread *thread, Class *klass) const 590 { 591 return base_->InitializeClass(classLinker, thread, klass); 592 } 593 CreateTrace(PandaUniquePtr<panda::os::file::File> traceFile,size_t bufferSize)594 Trace *CreateTrace(PandaUniquePtr<panda::os::file::File> traceFile, size_t bufferSize) const 595 { 596 return base_->CreateTrace(std::move(traceFile), bufferSize); 597 } 598 GetStringSize(const ObjectHeader * stringObject)599 size_t GetStringSize(const ObjectHeader *stringObject) const 600 { 601 return base_->GetStringSize(stringObject); 602 } 603 GetVerificationInitAPI()604 VerificationInitAPI GetVerificationInitAPI() const 605 { 606 return base_->GetVerificationInitAPI(); 607 } 608 GetVerificationTypeClass()609 const char *GetVerificationTypeClass() const 610 { 611 return base_->GetVerificationTypeClass(); 612 } 613 GetVerificationTypeObject()614 const char *GetVerificationTypeObject() const 615 { 616 return base_->GetVerificationTypeObject(); 617 } 618 GetVerificationTypeThrowable()619 const char *GetVerificationTypeThrowable() const 620 { 621 return base_->GetVerificationTypeThrowable(); 622 } 623 GetBootPandaFilesOpenMode()624 panda::panda_file::File::OpenMode GetBootPandaFilesOpenMode() const 625 { 626 return base_->GetBootPandaFilesOpenMode(); 627 } 628 RestoreEnv(Frame * currentIframe,const StackWalker::EnvData & envData)629 virtual void RestoreEnv(Frame *currentIframe, const StackWalker::EnvData &envData) const 630 { 631 return base_->RestoreEnv(currentIframe, envData); 632 } 633 IsEnabledCHA()634 virtual bool IsEnabledCHA() const 635 { 636 return base_->IsEnabledCHA(); 637 } 638 InitializeOsrCframeSlots(Span<uintptr_t> paramSlots)639 void InitializeOsrCframeSlots(Span<uintptr_t> paramSlots) const 640 { 641 base_->InitializeOsrCframeSlots(paramSlots); 642 } 643 GetOsrEnv(const Frame * iframe,compiler::VRegInfo vregInfo)644 uint64_t GetOsrEnv(const Frame *iframe, compiler::VRegInfo vregInfo) const 645 { 646 return base_->GetOsrEnv(iframe, vregInfo); 647 } 648 WrapClassInitializerException(ClassLinker * classLinker,ManagedThread * thread)649 void WrapClassInitializerException(ClassLinker *classLinker, ManagedThread *thread) const 650 { 651 base_->WrapClassInitializerException(classLinker, thread); 652 } 653 654 private: 655 const LanguageContextBase *base_; 656 }; 657 658 } // namespace panda 659 660 #endif // PANDA_RUNTIME_LANGUAGE_CONTEXT_H 661