23DEFINE_FLAG(
bool, intrinsify,
true,
"Instrinsify when possible");
24DEFINE_FLAG(
bool, trace_intrinsifier,
false,
"Trace intrinsifier");
28bool Intrinsifier::CanIntrinsify(
const ParsedFunction& parsed_function) {
31 if (FLAG_trace_intrinsifier) {
34 if (!FLAG_intrinsify)
return false;
38 if (FLAG_trace_intrinsifier) {
45 if (FLAG_trace_intrinsifier) {
51 if (FLAG_trace_intrinsifier) {
52 THR_Print(
"No, not intrinsic function.\n");
56 switch (
function.recognized_kind()) {
57 case MethodRecognizer::kInt64ArrayGetIndexed:
58 case MethodRecognizer::kInt64ArraySetIndexed:
59 case MethodRecognizer::kUint64ArrayGetIndexed:
60 case MethodRecognizer::kUint64ArraySetIndexed:
65 if (FLAG_trace_intrinsifier) {
66 THR_Print(
"No, 64-bit int intrinsic on 32-bit platform.\n");
72 if (FLAG_trace_intrinsifier) {
88#define DEFINE_INTRINSIC(class_name, function_name, destination, fp) \
89 {#class_name, #function_name},
125 const intptr_t kNumLibs = 4;
135 for (intptr_t
i = 0;
i < kNumLibs;
i++) {
138 intrinsic->class_name !=
nullptr; intrinsic++) {
140 if (strcmp(intrinsic->class_name,
"::") == 0) {
149 if (!
error.IsNull()) {
154 if (intrinsic->function_name[0] ==
'.') {
162 func.set_is_intrinsic(
true);
163 }
else if (!FLAG_precompiled_mode) {
164 FATAL(
"Intrinsifier failed to find method %s in class %s\n",
165 intrinsic->function_name, intrinsic->class_name);
175 if (!CanIntrinsify(parsed_function)) {
180 return compiler->intrinsic_slow_path_label()->IsUnused();
184#if !defined(HASH_IN_OBJECT_HEADER)
189 if (
function.recognized_kind() == MethodRecognizer::kObject_getHash) {
195#define EMIT_BREAKPOINT() compiler->assembler()->Breakpoint()
197#define EMIT_BREAKPOINT()
200#define EMIT_CASE(class_name, function_name, enum_name, fp) \
201 case MethodRecognizer::k##enum_name: { \
202 compiler->assembler()->Comment("Intrinsic"); \
203 Label normal_ir_body; \
204 const auto size_before = compiler->assembler()->CodeSize(); \
205 AsmIntrinsifier::enum_name(compiler->assembler(), &normal_ir_body); \
206 const auto size_after = compiler->assembler()->CodeSize(); \
207 if (size_before == size_after) return false; \
208 if (function.HasUnboxedParameters()) { \
209 FATAL("Unsupported unboxed parameters in asm intrinsic %s", \
210 function.ToFullyQualifiedCString()); \
212 if (function.HasUnboxedReturnValue()) { \
213 FATAL("Unsupported unboxed return value in asm intrinsic %s", \
214 function.ToFullyQualifiedCString()); \
216 if (!normal_ir_body.IsBound()) { \
223 switch (
function.recognized_kind()) {
228 switch (
function.recognized_kind()) {
234#undef EMIT_BREAKPOINT
FunctionPtr LookupFunctionAllowPrivate(const String &name) const
ErrorPtr EnsureIsFinalized(Thread *thread) const
static LibraryPtr CoreLibrary()
ClassPtr LookupClassAllowPrivate(const String &name) const
FunctionPtr LookupFunctionAllowPrivate(const String &name) const
static LibraryPtr InternalLibrary()
static LibraryPtr DeveloperLibrary()
static LibraryPtr TypedDataLibrary()
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
const Function & function() const
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
static StringPtr Concat(const String &str1, const String &str2, Heap::Space space=Heap::kNew)
static Thread * Current()
static bool GraphIntrinsify(const ParsedFunction &parsed_function, FlowGraphCompiler *compiler)
static bool Intrinsify(const ParsedFunction &parsed_function, FlowGraphCompiler *compiler)
static void InitializeState()
#define THR_Print(format,...)
const uint8_t uint32_t uint32_t GError ** error
Dart_NativeFunction function
#define EMIT_CASE(class_name, function_name, enum_name, fp)
#define DEFINE_INTRINSIC(class_name, function_name, destination, fp)
static constexpr word kBitsPerWord
static const IntrinsicDesc developer_intrinsics[]
static const IntrinsicDesc core_intrinsics[]
static const IntrinsicDesc internal_intrinsics[]
static const IntrinsicDesc typed_data_intrinsics[]
DEFINE_FLAG(bool, print_cluster_information, false, "Print information about clusters written to snapshot")
#define CORE_LIB_INTRINSIC_LIST(V)
#define GRAPH_TYPED_DATA_INTRINSICS_LIST(V)
#define INTERNAL_LIB_INTRINSIC_LIST(V)
#define CORE_INTEGER_LIB_INTRINSIC_LIST(V)
#define GRAPH_CORE_INTRINSICS_LIST(V)
#define DEVELOPER_LIB_INTRINSIC_LIST(V)
#define ALL_INTRINSICS_NO_INTEGER_LIB_LIST(V)
const char * function_name
const IntrinsicDesc * intrinsics