// A convenience class that allows for iteration through a list of // input argument registers. This is used to iterate over input // arguments while performing standard argument conversions. class ShadowFrameGetter { public:
ShadowFrameGetter(const ShadowFrame& shadow_frame, const InstructionOperands* const operands,
size_t operand_index = 0u)
: shadow_frame_(shadow_frame), operands_(operands), operand_index_(operand_index) {}
const ShadowFrame& shadow_frame_; const InstructionOperands* const operands_; // the set of register operands to read
size_t operand_index_; // the next register operand to read from frame
};
// A convenience class that allows values to be written to a given shadow frame, // starting at location |first_dst_reg|. class ShadowFrameSetter { public:
ShadowFrameSetter(ShadowFrame* shadow_frame, size_t first_dst_reg)
: shadow_frame_(shadow_frame), arg_index_(first_dst_reg) {}
inlinebool ConvertArgumentValue(const ThrowWrongMethodTypeFunction& throw_wmt,
ObjPtr<mirror::Class> from,
ObjPtr<mirror::Class> to, /*inout*/ JValue* value) { if (from == to) { returntrue;
}
// `*value` may contain a bare heap pointer which is generally unsafe. // `ConvertJValueCommon()` saves `*value`, `from`, and `to` to Handles // where necessary to avoid issues if the heap changes. if (ConvertJValueCommon(throw_wmt, from, to, value)) {
DCHECK(!Thread::Current()->IsExceptionPending()); returntrue;
} else {
DCHECK(Thread::Current()->IsExceptionPending());
value->SetJ(0); returnfalse;
}
}
inlinebool ConvertReturnValue(const ThrowWrongMethodTypeFunction& throw_wmt,
ObjPtr<mirror::Class> from,
ObjPtr<mirror::Class> to, /*inout*/ JValue* value) { if (to->GetPrimitiveType() == Primitive::kPrimVoid || from == to) { returntrue;
}
// `*value` may contain a bare heap pointer which is generally unsafe. // `ConvertJValueCommon()` saves `*value`, `from`, and `to` to Handles // where necessary to avoid issues if the heap changes. if (ConvertJValueCommon(throw_wmt, from, to, value)) {
DCHECK(!Thread::Current()->IsExceptionPending()); returntrue;
} else {
DCHECK(Thread::Current()->IsExceptionPending());
value->SetJ(0); returnfalse;
}
}
template <typename FromPTypes, typename ToPTypes, typename G, typename S> bool PerformConversions(const ThrowWrongMethodTypeFunction& throw_wmt,
FromPTypes from_types,
ToPTypes to_types,
G* getter,
S* setter) {
DCHECK_EQ(from_types.GetLength(), to_types.GetLength()); for (int32_t i = 0, length = to_types.GetLength(); i != length; ++i) {
ObjPtr<mirror::Class> from = from_types.Get(i);
ObjPtr<mirror::Class> to = to_types.Get(i); const Primitive::Type from_type = from->GetPrimitiveType(); const Primitive::Type to_type = to->GetPrimitiveType(); if (from == to) { // Easy case - the types are identical. Nothing left to do except to pass // the arguments along verbatim. if (Primitive::Is64BitType(from_type)) {
setter->SetLong(getter->GetLong());
} elseif (from_type == Primitive::kPrimNot) {
setter->SetReference(getter->GetReference());
} else {
setter->Set(getter->Get());
}
} else {
JValue value; if (Primitive::Is64BitType(from_type)) {
value.SetJ(getter->GetLong());
} elseif (from_type == Primitive::kPrimNot) {
value.SetL(getter->GetReference());
} else {
value.SetI(getter->Get());
} // Caveat emptor - ObjPtr's not guaranteed valid after this call. if (!ConvertArgumentValue(throw_wmt, from, to, &value)) {
DCHECK(Thread::Current()->IsExceptionPending()); returnfalse;
} if (Primitive::Is64BitType(to_type)) {
setter->SetLong(value.GetJ());
} elseif (to_type == Primitive::kPrimNot) {
setter->SetReference(value.GetL());
} else {
setter->Set(value.GetI());
}
}
} returntrue;
}
for (int32_t i = 0; i < ptypes_length; ++i) {
ObjPtr<mirror::Class> ptype(ptypes->GetWithoutChecks(i));
Primitive::Type primitive = ptype->GetPrimitiveType(); if (Primitive::Is64BitType(primitive)) {
setter->SetLong(getter->GetLong());
} elseif (primitive == Primitive::kPrimNot) {
setter->SetReference(getter->GetReference());
} else {
setter->Set(getter->Get());
}
} returntrue;
}
} // namespace art
#endif// ART_RUNTIME_METHOD_HANDLES_INL_H_
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.10Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.