Implement LLVM version of jni_compiler to pass 17 jni_compiler tests.
Because we now have both shadow_frame and sirt (which is just for SirtRef<>
in the LLVM version), we define a new function NumStackReferences() as follows:
NumStackReferences() = NumSirtReferences() + NumShadowFrameReferences().
(cherry picked from commit 18fe89a14d212da9ec6841f4d19d08482a9610b7)
Change-Id: Idd95ee4276801b1555be87934cd9c4f33ab8a88a
diff --git a/src/shadow_frame.h b/src/shadow_frame.h
index 3bdee8e..c5b6492 100644
--- a/src/shadow_frame.h
+++ b/src/shadow_frame.h
@@ -51,6 +51,16 @@
references_[i] = object;
}
+ bool Contains(Object** shadow_frame_entry) const {
+ // A ShadowFrame should at least contain a reference. Even if a
+ // native method has no argument, we put jobject or jclass as a
+ // reference. The former is "this", while the latter is for static
+ // method.
+ DCHECK_GT(number_of_references_, 0U);
+ return ((&references_[0] <= shadow_frame_entry)
+ && (shadow_frame_entry <= (&references_[number_of_references_ - 1])));
+ }
+
// Offset of link within shadow frame
static size_t LinkOffset() {
return OFFSETOF_MEMBER(ShadowFrame, link_);