From 95f40f35f732135bb68e51459827298f7feda283 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Wed, 4 Feb 2009 08:50:13 +0000 Subject: init: shortcut benchmarking, if there is only one runable implementation. --- liboil/liboilfunction.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'liboil') diff --git a/liboil/liboilfunction.c b/liboil/liboilfunction.c index fa1870c..f2eb440 100644 --- a/liboil/liboilfunction.c +++ b/liboil/liboilfunction.c @@ -367,6 +367,17 @@ oil_class_optimize (OilFunctionClass * klass) OIL_ERROR ("class %s has no implmentations", klass->name); return; } + + if (klass->first_impl->next == NULL) { + if (!oil_impl_is_runnable (klass->first_impl)) { + OIL_ERROR ("class %s has no runable implmentations", klass->name); + return; + } + OIL_DEBUG ("class %s has only one implementation %s", klass->name, klass->first_impl->name); + klass->chosen_impl = klass->first_impl; + klass->func = klass->first_impl->func; + return; + } test = oil_test_new (klass); if (test == NULL) { -- cgit v1.2.1