// A visitor for seeing all instructions escape analysis considers escaping. // Called with each user of the reference passed to 'VisitEscapes'. Return true // to continue iteration and false to stop. class EscapeVisitor { public: virtual ~EscapeVisitor() {} virtualbool Visit(HInstruction* escape) = 0; booloperator()(HInstruction* user) { return Visit(user);
}
};
// An explicit EscapeVisitor for lambdas template <typename F> class LambdaEscapeVisitor final : public EscapeVisitor { public: explicit LambdaEscapeVisitor(F f) : func_(f) {} bool Visit(HInstruction* escape) override { return func_(escape);
}
private:
F func_;
};
// This functor is used with the escape-checking functions. If the NoEscape // function returns true escape analysis will consider 'user' to not have // escaped 'reference'. This allows clients with additional information to // supplement the escape-analysis. If the NoEscape function returns false then // the normal escape-checking code will be used to determine whether or not // 'reference' escapes. class NoEscapeCheck { public: virtual ~NoEscapeCheck() {} virtualbool NoEscape(HInstruction* reference, HInstruction* user) = 0; booloperator()(HInstruction* ref, HInstruction* user) { return NoEscape(ref, user);
}
};
// An explicit NoEscapeCheck for use with c++ lambdas. template <typename F> class LambdaNoEscapeCheck final : public NoEscapeCheck { public: explicit LambdaNoEscapeCheck(F f) : func_(f) {} bool NoEscape(HInstruction* ref, HInstruction* user) override { return func_(ref, user);
}
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.