• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ponyint_pool_free_size函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ponyint_pool_free_size函数的典型用法代码示例。如果您正苦于以下问题:C++ ponyint_pool_free_size函数的具体用法?C++ ponyint_pool_free_size怎么用?C++ ponyint_pool_free_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ponyint_pool_free_size函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: make_trait_list

static LLVMValueRef make_trait_list(compile_t* c, reach_type_t* t,
  uint32_t* final_count)
{
  // The list is an array of integers.
  uint32_t* tid;
  size_t tid_size;
  uint32_t count = trait_count(t, &tid, &tid_size);

  // If we have no traits, return a null pointer to a list.
  if(count == 0)
    return LLVMConstNull(LLVMPointerType(LLVMArrayType(c->i32, 0), 0));

  // Create a constant array of trait identifiers.
  size_t list_size = count * sizeof(LLVMValueRef);
  LLVMValueRef* list = (LLVMValueRef*)ponyint_pool_alloc_size(list_size);

  for(uint32_t i = 0; i < count; i++)
    list[i] = LLVMConstInt(c->i32, tid[i], false);

  LLVMValueRef trait_array = LLVMConstArray(c->i32, list, count);

  // Create a global to hold the array.
  const char* name = genname_traitlist(t->name);
  LLVMTypeRef list_type = LLVMArrayType(c->i32, count);
  LLVMValueRef global = LLVMAddGlobal(c->module, list_type, name);
  LLVMSetGlobalConstant(global, true);
  LLVMSetLinkage(global, LLVMPrivateLinkage);
  LLVMSetInitializer(global, trait_array);

  ponyint_pool_free_size(tid_size, tid);
  ponyint_pool_free_size(list_size, list);

  *final_count = count;
  return global;
}
开发者ID:npruehs,项目名称:ponyc,代码行数:35,代码来源:gendesc.c


示例2: gen_tuple

LLVMValueRef gen_tuple(compile_t* c, ast_t* ast)
{
  ast_t* child = ast_child(ast);

  if(ast_sibling(child) == NULL)
    return gen_expr(c, child);

  deferred_reification_t* reify = c->frame->reify;

  ast_t* type = deferred_reify(reify, ast_type(ast), c->opt);

  // If we contain '_', we have no usable value.
  if(contains_dontcare(type))
  {
    ast_free_unattached(type);
    return GEN_NOTNEEDED;
  }

  reach_type_t* t = reach_type(c->reach, type);
  compile_type_t* c_t = (compile_type_t*)t->c_type;
  int count = LLVMCountStructElementTypes(c_t->primitive);
  size_t buf_size = count * sizeof(LLVMTypeRef);
  LLVMTypeRef* elements = (LLVMTypeRef*)ponyint_pool_alloc_size(buf_size);
  LLVMGetStructElementTypes(c_t->primitive, elements);

  LLVMValueRef tuple = LLVMGetUndef(c_t->primitive);
  int i = 0;

  while(child != NULL)
  {
    LLVMValueRef value = gen_expr(c, child);

    if(value == NULL)
    {
      ponyint_pool_free_size(buf_size, elements);
      return NULL;
    }

    // We'll have an undefined element if one of our source elements is a
    // variable declaration. This is ok, since the tuple value will never be
    // used.
    if(value == GEN_NOVALUE || value == GEN_NOTNEEDED)
    {
      ponyint_pool_free_size(buf_size, elements);
      return value;
    }

    ast_t* child_type = deferred_reify(reify, ast_type(child), c->opt);
    value = gen_assign_cast(c, elements[i], value, child_type);
    ast_free_unattached(child_type);
    tuple = LLVMBuildInsertValue(c->builder, tuple, value, i++, "");
    child = ast_sibling(child);
  }

  ponyint_pool_free_size(buf_size, elements);
  return tuple;
}
开发者ID:dipinhora,项目名称:ponyc,代码行数:57,代码来源:genreference.c


示例3: ponyint_sched_shutdown

static void ponyint_sched_shutdown()
{
  uint32_t start;

  start = 0;

  for(uint32_t i = start; i < scheduler_count; i++)
    ponyint_thread_join(scheduler[i].tid);

  DTRACE0(RT_END);
  ponyint_cycle_terminate(&scheduler[0].ctx);

  for(uint32_t i = 0; i < scheduler_count; i++)
  {
    while(ponyint_messageq_pop(&scheduler[i].mq) != NULL);
    ponyint_messageq_destroy(&scheduler[i].mq);
    ponyint_mpmcq_destroy(&scheduler[i].q);
  }

  ponyint_pool_free_size(scheduler_count * sizeof(scheduler_t), scheduler);
  scheduler = NULL;
  scheduler_count = 0;

  ponyint_mpmcq_destroy(&inject);
}
开发者ID:killerswan,项目名称:ponyc,代码行数:25,代码来源:scheduler.c


示例4: print_params

static void print_params(compile_t* c, printbuf_t* buf, ast_t* params)
{
  ast_t* param = ast_child(params);

  while(param != NULL)
  {
    AST_GET_CHILDREN(param, id, ptype);

    // Print the parameter.
    printbuf(buf, ", ");
    print_type_name(c, buf, ptype);

    // Smash trailing primes to underscores.
    const char* name = ast_name(id);
    size_t len = strlen(name) + 1;
    size_t buf_size = len;
    char* buffer = (char*)ponyint_pool_alloc_size(buf_size);
    memcpy(buffer, name, len);

    len--;

    while(buffer[--len] == '\'')
      buffer[len] = '_';

    printbuf(buf, " %s", buffer);

    param = ast_sibling(param);
    ponyint_pool_free_size(buf_size, buffer);
  }
}
开发者ID:Preetam,项目名称:ponyc,代码行数:30,代码来源:genheader.c


示例5: tuple_indices_destroy

static void tuple_indices_destroy(call_tuple_indices_t* ti)
{
  ponyint_pool_free_size(ti->alloc * sizeof(size_t), ti->data);
  ti->data = NULL;
  ti->count = 0;
  ti->alloc = 0;
}
开发者ID:Theodus,项目名称:ponyc,代码行数:7,代码来源:gencall.c


示例6: gendesc_table

void gendesc_table(compile_t* c)
{
  uint32_t len = c->reach->next_type_id;
  size_t size = len * sizeof(LLVMValueRef);
  LLVMValueRef* args = (LLVMValueRef*)ponyint_pool_alloc_size(size);

  reach_type_t* t;
  size_t i = HASHMAP_BEGIN;

  while((t = reach_types_next(&c->reach->types, &i)) != NULL)
  {
    LLVMValueRef desc;

    if(t->desc != NULL)
      desc = LLVMBuildBitCast(c->builder, t->desc, c->descriptor_ptr, "");
    else
      desc = LLVMConstNull(c->descriptor_ptr);

    args[t->type_id] = desc;
  }

  LLVMTypeRef type = LLVMArrayType(c->descriptor_ptr, len);
  LLVMValueRef table = LLVMAddGlobal(c->module, type, "__DescTable");
  LLVMValueRef value = LLVMConstArray(c->descriptor_ptr, args, len);
  LLVMSetInitializer(table, value);
  LLVMSetGlobalConstant(table, true);

  LLVMValueRef table_size = LLVMAddGlobal(c->module, c->intptr,
    "__DescTableSize");
  LLVMSetInitializer(table_size, LLVMConstInt(c->intptr, len, false));
  LLVMSetGlobalConstant(table_size, true);

  ponyint_pool_free_size(size, args);
}
开发者ID:npruehs,项目名称:ponyc,代码行数:34,代码来源:gendesc.c


示例7: doc_rm_star

// Delete all the files in the specified directory
static void doc_rm_star(const char* path)
{
  assert(path != NULL);

  PONY_ERRNO err;
  PONY_DIR* dir = pony_opendir(path, &err);

  if(dir == NULL)
    return;

  PONY_DIRINFO* result;

  while((result = pony_dir_entry_next(dir)) != NULL)
  {
    char* name = pony_dir_info_name(result);

    if(strcmp(name, ".") != 0 && strcmp(name, "..") != 0)
    {
      // Delete this file
      size_t buf_len;
      char* buf = doc_cat(path, name, "", "", "", &buf_len);

#ifdef PLATFORM_IS_WINDOWS
      DeleteFile(buf);
#else
      remove(buf);
#endif
      ponyint_pool_free_size(buf_len, buf);
    }
  }

  pony_closedir(dir);
}
开发者ID:JamesLinus,项目名称:ponyc,代码行数:34,代码来源:docgen.c


示例8: package_group_free

void package_group_free(package_group_t* group)
{
  if(group->signature != NULL)
    ponyint_pool_free_size(SIGNATURE_LENGTH, group->signature);

  package_set_destroy(&group->members);
  POOL_FREE(package_group_t, group);
}
开发者ID:dipinhora,项目名称:ponyc,代码行数:8,代码来源:package.c


示例9: generate_docs

void generate_docs(ast_t* program, pass_opt_t* options)
{
  assert(program != NULL);

  if(ast_id(program) != TK_PROGRAM)
    return;

  docgen_t docgen;
  docgen.errors = options->check.errors;

  doc_setup_dirs(&docgen, program, options);

  // Open the index and home files
  docgen.index_file = doc_open_file(&docgen, false, "mkdocs", ".yml");
  docgen.home_file = doc_open_file(&docgen, true, "index", ".md");
  docgen.type_file = NULL;

  // Write documentation files
  if(docgen.index_file != NULL && docgen.home_file != NULL)
  {
    ast_t* package = ast_child(program);
    const char* name = package_filename(package);

    fprintf(docgen.home_file, "Packages\n\n");

    fprintf(docgen.index_file, "site_name: %s\n", name);
    fprintf(docgen.index_file, "theme: readthedocs\n");
    fprintf(docgen.index_file, "pages:\n");
    fprintf(docgen.index_file, "- %s: index.md\n", name);

    doc_packages(&docgen, program);
  }

  // Tidy up
  if(docgen.index_file != NULL)
    fclose(docgen.index_file);

  if(docgen.home_file != NULL)
   fclose(docgen.home_file);

  if(docgen.base_dir != NULL)
    ponyint_pool_free_size(docgen.base_dir_buf_len, (void*)docgen.base_dir);

  if(docgen.sub_dir != NULL)
    ponyint_pool_free_size(docgen.sub_dir_buf_len, (void*)docgen.sub_dir);
}
开发者ID:JamesLinus,项目名称:ponyc,代码行数:46,代码来源:docgen.c


示例10: program_free

void program_free(program_t* program)
{
  pony_assert(program != NULL);

  package_group_list_free(program->package_groups);

  if(program->signature != NULL)
    ponyint_pool_free_size(SIGNATURE_LENGTH, program->signature);

  strlist_free(program->libpaths);
  strlist_free(program->libs);

  if(program->lib_args != NULL)
    ponyint_pool_free_size(program->lib_args_alloced, program->lib_args);

  POOL_FREE(program_t, program);
}
开发者ID:Theodus,项目名称:ponyc,代码行数:17,代码来源:program.c


示例11: doc_package_home

// Write the given package home page to its own file
static void doc_package_home(docgen_t* docgen,
  ast_t* package,
  ast_t* doc_string)
{
  assert(docgen != NULL);
  assert(docgen->index_file != NULL);
  assert(docgen->home_file != NULL);
  assert(docgen->package_file == NULL);
  assert(docgen->test_types == NULL);
  assert(docgen->public_types == NULL);
  assert(docgen->private_types == NULL);
  assert(docgen->type_file == NULL);
  assert(package != NULL);
  assert(ast_id(package) == TK_PACKAGE);

  // First open a file
  size_t tqfn_len;
  char* tqfn = write_tqfn(package, "-index", &tqfn_len);

  // Package group
  fprintf(docgen->index_file, "- package %s:\n",
    package_qualified_name(package));

  docgen->type_file = doc_open_file(docgen, true, tqfn, ".md");

  if(docgen->type_file == NULL)
    return;

  // Add reference to new file to index file
  fprintf(docgen->index_file, "  - Package: \"%s.md\"\n", tqfn);

  // Add reference to package to home file
  fprintf(docgen->home_file, "* [%s](%s)\n", package_qualified_name(package),
    tqfn);

  // Now we can write the actual documentation for the package
  if(doc_string != NULL)
  {
    assert(ast_id(doc_string) == TK_STRING);
    fprintf(docgen->type_file, "%s", ast_name(doc_string));
  }
  else
  {
    fprintf(docgen->type_file, "No package doc string provided for %s.",
      package_qualified_name(package));
  }


  ponyint_pool_free_size(tqfn_len, tqfn);

  docgen->test_types = printbuf_new();
  docgen->public_types = printbuf_new();
  docgen->private_types = printbuf_new();
  docgen->package_file = docgen->type_file;
  docgen->type_file = NULL;
}
开发者ID:JamesLinus,项目名称:ponyc,代码行数:57,代码来源:docgen.c


示例12: source_close

void source_close(source_t* source)
{
  if(source == NULL)
    return;

  if(source->m != NULL)
    ponyint_pool_free_size(source->len, source->m);

  POOL_FREE(source_t, source);
}
开发者ID:Preetam,项目名称:ponyc,代码行数:10,代码来源:source.c


示例13: destroy_large

static void destroy_large(chunk_t* chunk, uint32_t mark)
{
  (void)mark;
  large_pagemap(chunk->m, chunk->size, NULL);

  if(chunk->m != NULL)
    ponyint_pool_free_size(chunk->size, chunk->m);

  POOL_FREE(chunk_t, chunk);
}
开发者ID:JamesLinus,项目名称:ponyc,代码行数:10,代码来源:heap.c


示例14: reach_mangled_free

static void reach_mangled_free(reach_method_t* m)
{
  ast_free(m->typeargs);
  ast_free(m->r_fun);

  if(m->param_count > 0)
    ponyint_pool_free_size(m->param_count * sizeof(reach_param_t), m->params);

  POOL_FREE(reach_method_t, m);
}
开发者ID:Sendence,项目名称:ponyc,代码行数:10,代码来源:reach.c


示例15: tuple_indices_push

static void tuple_indices_push(call_tuple_indices_t* ti, size_t idx)
{
  if(ti->count == ti->alloc)
  {
    size_t* tmp_data =
      (size_t*)ponyint_pool_alloc_size(2 * ti->alloc * sizeof(size_t));
    memcpy(tmp_data, ti->data, ti->count * sizeof(size_t));
    ponyint_pool_free_size(ti->alloc * sizeof(size_t), ti->data);
    ti->alloc *= 2;
    ti->data = tmp_data;
  }
  ti->data[ti->count++] = idx;
}
开发者ID:killerswan,项目名称:ponyc,代码行数:13,代码来源:gencall.c


示例16: reachable_method_free

static void reachable_method_free(reachable_method_t* m)
{
  ast_free(m->typeargs);
  ast_free(m->r_fun);

  if(m->param_count > 0)
  {
    ponyint_pool_free_size(m->param_count * sizeof(reachable_type_t*),
      m->params);
  }

  POOL_FREE(reachable_method_t, m);
}
开发者ID:jersey99,项目名称:ponyc,代码行数:13,代码来源:reach.c


示例17: buildflagset_free

void buildflagset_free(buildflagset_t* set)
{
  if(set != NULL)
  {
    flagtab_destroy(set->flags);
    POOL_FREE(flagtab_t, set->flags);

    if(set->buffer_size > 0)
      ponyint_pool_free_size(set->buffer_size, set->text_buffer);

    POOL_FREE(buildflagset_t, set);
  }
}
开发者ID:JamesLinus,项目名称:ponyc,代码行数:13,代码来源:buildflagset.c


示例18: make_field_list

static LLVMValueRef make_field_list(compile_t* c, reach_type_t* t)
{
  // The list is an array of field descriptors.
  uint32_t count;

  if(t->underlying == TK_TUPLETYPE)
    count = t->field_count;
  else
    count = 0;

  LLVMTypeRef field_type = LLVMArrayType(c->field_descriptor, count);

  // If we aren't a tuple, return a null pointer to a list.
  if(count == 0)
    return LLVMConstNull(LLVMPointerType(field_type, 0));

  // Create a constant array of field descriptors.
  size_t buf_size = count * sizeof(LLVMValueRef);
  LLVMValueRef* list = (LLVMValueRef*)ponyint_pool_alloc_size(buf_size);

  for(uint32_t i = 0; i < count; i++)
  {
    LLVMValueRef fdesc[2];
    fdesc[0] = LLVMConstInt(c->i32,
      LLVMOffsetOfElement(c->target_data, t->primitive, i), false);

    if(t->fields[i].type->desc != NULL)
    {
      // We are a concrete type.
      fdesc[1] = LLVMConstBitCast(t->fields[i].type->desc,
        c->descriptor_ptr);
    } else {
      // We aren't a concrete type.
      fdesc[1] = LLVMConstNull(c->descriptor_ptr);
    }

    list[i] = LLVMConstStructInContext(c->context, fdesc, 2, false);
  }

  LLVMValueRef field_array = LLVMConstArray(c->field_descriptor, list, count);

  // Create a global to hold the array.
  const char* name = genname_fieldlist(t->name);
  LLVMValueRef global = LLVMAddGlobal(c->module, field_type, name);
  LLVMSetGlobalConstant(global, true);
  LLVMSetLinkage(global, LLVMPrivateLinkage);
  LLVMSetInitializer(global, field_array);

  ponyint_pool_free_size(buf_size, list);
  return global;
}
开发者ID:npruehs,项目名称:ponyc,代码行数:51,代码来源:gendesc.c


示例19: assign_to_tuple

static LLVMValueRef assign_to_tuple(compile_t* c, LLVMTypeRef l_type,
  LLVMValueRef r_value, ast_t* type)
{
  // Cast each component.
  assert(ast_id(type) == TK_TUPLETYPE);

  int count = LLVMCountStructElementTypes(l_type);
  size_t buf_size = count * sizeof(LLVMTypeRef);
  LLVMTypeRef* elements = (LLVMTypeRef*)ponyint_pool_alloc_size(buf_size);
  LLVMGetStructElementTypes(l_type, elements);

  LLVMValueRef result = LLVMGetUndef(l_type);

  ast_t* type_child = ast_child(type);
  int i = 0;

  while(type_child != NULL)
  {
    LLVMValueRef r_child = LLVMBuildExtractValue(c->builder, r_value, i, "");
    LLVMValueRef cast_value = gen_assign_cast(c, elements[i], r_child,
      type_child);

    if(cast_value == NULL)
    {
      ponyint_pool_free_size(buf_size, elements);
      return NULL;
    }

    result = LLVMBuildInsertValue(c->builder, result, cast_value, i, "");
    type_child = ast_sibling(type_child);
    i++;
  }

  ponyint_pool_free_size(buf_size, elements);
  return result;
}
开发者ID:awaidmann,项目名称:ponyc,代码行数:36,代码来源:genexpr.c


示例20: buildflagset_print

const char* buildflagset_print(buildflagset_t* set)
{
  assert(set != NULL);
  assert(set->flags != NULL);

  char* p = set->text_buffer;

  // First the mutually exclusive flags.
  if(set->have_os_flags)
    print_flag(_os_flags[set->enum_os_flags], true, set, &p);

  if(set->have_arch_flags)
    print_flag(_arch_flags[set->enum_arch_flags], true, set, &p);

  if(set->have_size_flags)
    print_flag(_size_flags[set->enum_size_flags], true, set, &p);

  // Next the normal flags, in any order.
  size_t i = HASHMAP_BEGIN;
  flag_t* flag;

  while((flag = flagtab_next(set->flags, &i)) != NULL)
    print_flag(flag->name, flag->value, set, &p);

  if(p == set->text_buffer) // No flags, all configs match.
    print_str("all configs", set, &p);

  // Check buffer was big enough for it all.
  size_t size_needed = (p - set->text_buffer) + 1; // +1 for terminator.

  if(size_needed > set->buffer_size)
  {
    // Buffer we have isn't big enough, make it bigger then go round again.
    if(set->buffer_size > 0)
      ponyint_pool_free_size(set->buffer_size, set->text_buffer);

    set->text_buffer = (char*)ponyint_pool_alloc_size(size_needed);
    set->buffer_size = size_needed;
    set->text_buffer[0] = '\0';
    buildflagset_print(set);
  }

  // Add terminator.
  assert(set->text_buffer != NULL);
  set->text_buffer[size_needed - 1] = '\0';
  return set->text_buffer;
}
开发者ID:JamesLinus,项目名称:ponyc,代码行数:47,代码来源:buildflagset.c



注:本文中的ponyint_pool_free_size函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pool函数代码示例发布时间:2022-05-30
下一篇:
C++ ponyint_pool_alloc_size函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap