loci: replace of_object_wire_init in list accessors
The of_object_t was already initialized in the list_first accessor. Most of the
work done by the init call in of_object_init is redundant, and as an indirect
call from a central function it is likely to be mispredicted.
diff --git a/c_gen/templates/list.c b/c_gen/templates/list.c
index dd69df0..95b0276 100644
--- a/c_gen/templates/list.c
+++ b/c_gen/templates/list.c
@@ -53,10 +53,15 @@
return rv;
}
- of_object_wire_init(obj, ${e_cls.upper()}, list->length);
- if (obj->length == 0) {
- return OF_ERROR_PARSE;
- }
+:: if e_uclass.virtual:
+ ${e_cls}_wire_object_id_get(obj, &obj->object_id);
+:: #endif
+
+:: if has_wire_length:
+ loci_class_metadata[obj->object_id].wire_length_get(obj, &obj->length);
+:: else:
+ obj->length = of_object_fixed_len[obj->version][obj->object_id];
+:: #endif
return rv;
}
@@ -79,11 +84,15 @@
return rv;
}
- rv = of_object_wire_init(obj, ${e_cls.upper()}, list->length);
+:: if e_uclass.virtual:
+ ${e_cls}_wire_object_id_get(obj, &obj->object_id);
+:: #endif
- if ((rv == OF_ERROR_NONE) && (obj->length == 0)) {
- return OF_ERROR_PARSE;
- }
+:: if has_wire_length:
+ loci_class_metadata[obj->object_id].wire_length_get(obj, &obj->length);
+:: else:
+ obj->length = of_object_fixed_len[obj->version][obj->object_id];
+:: #endif
return rv;
}