diff options
| author | 2022-08-02 16:58:30 +0000 | |
|---|---|---|
| committer | 2022-08-05 19:47:42 +0000 | |
| commit | b96054f6f3704dcb039af56532b2ce10896e2b81 (patch) | |
| tree | 1076edb232bb03e870e23cb28445c62e688966d1 /runtime/interpreter/interpreter_common.cc | |
| parent | 5513fa8b1f35c19048b44359f7337442f92e5a76 (diff) | |
Revert "Ensure we initialize before pushing the method invoked."
This reverts commit 9f1a9bcfa320de7b4409cfd85cbe9b192c022f06.
Reason for revert: Just to confirm if it resolves presubmit tests
on the userfaultfd GC CLs (topic uffd-gc). This CL definitely causes
art-test failures (with uffd GC) on local tests due to double
reference to same shadow-frame on mutator stack.
Test: test/testrunner/testrunner.py --host --debug --interpreter --gcstress
Change-Id: I69affec203416aceb6f77e1ea2d1ec9bb1add6a6
Diffstat (limited to 'runtime/interpreter/interpreter_common.cc')
| -rw-r--r-- | runtime/interpreter/interpreter_common.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index c6b2ddc964..4ee4cb5a9f 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -262,6 +262,25 @@ void ArtInterpreterToCompiledCodeBridge(Thread* self, JValue* result) REQUIRES_SHARED(Locks::mutator_lock_) { ArtMethod* method = shadow_frame->GetMethod(); + // Ensure static methods are initialized. + if (method->IsStatic()) { + ObjPtr<mirror::Class> declaringClass = method->GetDeclaringClass(); + if (UNLIKELY(!declaringClass->IsVisiblyInitialized())) { + self->PushShadowFrame(shadow_frame); + StackHandleScope<1> hs(self); + Handle<mirror::Class> h_class(hs.NewHandle(declaringClass)); + if (UNLIKELY(!Runtime::Current()->GetClassLinker()->EnsureInitialized( + self, h_class, /*can_init_fields=*/ true, /*can_init_parents=*/ true))) { + self->PopShadowFrame(); + DCHECK(self->IsExceptionPending()); + return; + } + self->PopShadowFrame(); + DCHECK(h_class->IsInitializing()); + // Reload from shadow frame in case the method moved, this is faster than adding a handle. + method = shadow_frame->GetMethod(); + } + } // Basic checks for the arg_offset. If there's no code item, the arg_offset must be 0. Otherwise, // check that the arg_offset isn't greater than the number of registers. A stronger check is // difficult since the frame may contain space for all the registers in the method, or only enough |