Use a non-inlined helper for the simple case of a single provider.

This reduces the built size by another 37k.
macos/v1.5.9
Eric Anholt 11 years ago
parent c4f582b532
commit 28c2dcb99b
  1. 24
      src/gen_dispatch.py

@ -535,6 +535,7 @@ class Generator(object):
for provider in alias_func.providers.values(): for provider in alias_func.providers.values():
providers.append(provider) providers.append(provider)
if len(providers) != 1:
self.outln(' static const enum {0}_provider providers[] = {{'.format(self.target)) self.outln(' static const enum {0}_provider providers[] = {{'.format(self.target))
for provider in providers: for provider in providers:
self.outln(' {0},'.format(provider.enum)) self.outln(' {0},'.format(provider.enum))
@ -550,7 +551,12 @@ class Generator(object):
self.entrypoint_string_offset[func.name], self.entrypoint_string_offset[func.name],
func.name)) func.name))
self.outln(' providers, entrypoints);') self.outln(' providers, entrypoints);')
else:
assert(providers[0].name == func.name)
self.outln(' return {0}_single_resolver({1}, {2} /* {3} */);'.format(self.target,
providers[0].enum,
self.entrypoint_string_offset[func.name],
func.name))
self.outln('}') self.outln('}')
self.outln('') self.outln('')
@ -688,6 +694,22 @@ class Generator(object):
self.outln('}') self.outln('}')
self.outln('') self.outln('')
single_resolver_proto = '{0}_single_resolver(enum {0}_provider provider, uint16_t entrypoint_offset)'.format(self.target)
self.outln('static void *')
self.outln('{0} __attribute__((noinline));'.format(single_resolver_proto))
self.outln('')
self.outln('static void *')
self.outln('{0}'.format(single_resolver_proto))
self.outln('{')
self.outln(' enum {0}_provider providers[] = {{'.format(self.target))
self.outln(' provider,')
self.outln(' {0}_provider_terminator'.format(self.target))
self.outln(' };')
self.outln(' return {0}_provider_resolver(entrypoint_strings + entrypoint_offset,'.format(self.target))
self.outln(' providers, &entrypoint_offset);')
self.outln('}')
self.outln('')
def write_source(self, file): def write_source(self, file):
self.out_file = open(file, 'w') self.out_file = open(file, 'w')

Loading…
Cancel
Save