riscv64: Fix crash in ExecuteNterpWithClinitImpl
ArtMethod::declaring_class_ is a GcRoot, which is only 32 bits wide.
With the 64-bit load, if the adjacent ArtMethod::access_flags_ field is
nonzero, the pointer in t0 will be invalid, and dereferencing it will
cause a segmentation fault. This was observed as system_server crashing
during the second boot of the device.
Test: Boot AOSP on HiFive Unmatched twice
Change-Id: Iaee482f6fcf963dc6d330650aa4be58311a807ad
diff --git a/runtime/interpreter/mterp/riscv64/main.S b/runtime/interpreter/mterp/riscv64/main.S
index 4acca57..c1e81ab 100644
--- a/runtime/interpreter/mterp/riscv64/main.S
+++ b/runtime/interpreter/mterp/riscv64/main.S
@@ -486,7 +486,7 @@
// For simplicity, we don't do a read barrier here, but instead rely
// on art_quick_resolution_trampoline to always have a suspend point before
// calling back here.
- ld t0, ART_METHOD_DECLARING_CLASS_OFFSET(a0)
+ lwu t0, ART_METHOD_DECLARING_CLASS_OFFSET(a0)
lw t1, MIRROR_CLASS_STATUS_OFFSET(t0) // t1 := status word, sext
lui t2, MIRROR_CLASS_STATUS_VISIBLY_INITIALIZED << (MIRROR_CLASS_STATUS_SHIFT - 12)
// The unsigned comparison works in tandem with the 64-bit sign-extension of