Пример #1
0
bool gentypes(compile_t* c)
{
  reach_type_t* t;
  size_t i;

  genprim_builtins(c);

  if(c->opt->verbosity >= VERBOSITY_INFO)
    fprintf(stderr, " Data prototypes\n");

  i = HASHMAP_BEGIN;

  while((t = reach_types_next(&c->reach->types, &i)) != NULL)
  {
    if(!make_opaque_struct(c, t))
      return false;

    gendesc_type(c, t);
    make_debug_info(c, t);
    make_box_type(c, t);
    make_dispatch(c, t);
    gentrace_prototype(c, t);
  }

  gendesc_table(c);

  if(c->opt->verbosity >= VERBOSITY_INFO)
    fprintf(stderr, " Data types\n");

  i = HASHMAP_BEGIN;

  while((t = reach_types_next(&c->reach->types, &i)) != NULL)
  {
    if(!make_struct(c, t))
      return false;

    make_global_instance(c, t);
  }

  if(c->opt->verbosity >= VERBOSITY_INFO)
    fprintf(stderr, " Function prototypes\n");

  i = HASHMAP_BEGIN;

  while((t = reach_types_next(&c->reach->types, &i)) != NULL)
  {
    // The ABI size for machine words and tuples is the boxed size.
    if(t->structure != NULL)
      t->abi_size = (size_t)LLVMABISizeOfType(c->target_data, t->structure);

    make_debug_final(c, t);
    make_pointer_methods(c, t);

    if(!genfun_method_sigs(c, t))
      return false;
  }

  if(c->opt->verbosity >= VERBOSITY_INFO)
    fprintf(stderr, " Functions\n");

  i = HASHMAP_BEGIN;

  while((t = reach_types_next(&c->reach->types, &i)) != NULL)
  {
    if(!genfun_method_bodies(c, t))
      return false;
  }

  if(c->opt->verbosity >= VERBOSITY_INFO)
    fprintf(stderr, " Descriptors\n");

  i = HASHMAP_BEGIN;

  while((t = reach_types_next(&c->reach->types, &i)) != NULL)
  {
    if(!make_trace(c, t))
      return false;

    if(!genserialise(c, t))
      return false;

    gendesc_init(c, t);
  }

  return true;
}
Пример #2
0
bool gentypes(compile_t* c)
{
  reachable_type_t* t;
  size_t i;

  genprim_builtins(c);

  PONY_LOG(c->opt, VERBOSITY_INFO, (" Data prototypes\n"));
  i = HASHMAP_BEGIN;

  while((t = reachable_types_next(&c->reachable->types, &i)) != NULL)
  {
    if(!make_opaque_struct(c, t))
      return false;

    gendesc_type(c, t);
    make_debug_info(c, t);
    make_box_type(c, t);
    make_dispatch(c, t);
    gentrace_prototype(c, t);
  }

  PONY_LOG(c->opt, VERBOSITY_INFO, (" Data types\n"));
  i = HASHMAP_BEGIN;

  while((t = reachable_types_next(&c->reachable->types, &i)) != NULL)
  {
    if(!make_struct(c, t))
      return false;

    make_global_instance(c, t);
  }

  PONY_LOG(c->opt, VERBOSITY_INFO, (" Function prototypes\n"));
  i = HASHMAP_BEGIN;

  while((t = reachable_types_next(&c->reachable->types, &i)) != NULL)
  {
    make_debug_final(c, t);
    make_pointer_methods(c, t);

    if(!genfun_method_sigs(c, t))
      return false;
  }

  PONY_LOG(c->opt, VERBOSITY_INFO, (" Functions\n"));
  i = HASHMAP_BEGIN;

  while((t = reachable_types_next(&c->reachable->types, &i)) != NULL)
  {
    if(!genfun_method_bodies(c, t))
      return false;
  }

  PONY_LOG(c->opt, VERBOSITY_INFO, (" Descriptors\n"));
  i = HASHMAP_BEGIN;

  while((t = reachable_types_next(&c->reachable->types, &i)) != NULL)
  {
    if(!make_trace(c, t))
      return false;

    gendesc_init(c, t);
  }

  return true;
}