本文整理汇总了C++中GC_INIT函数的典型用法代码示例。如果您正苦于以下问题:C++ GC_INIT函数的具体用法?C++ GC_INIT怎么用?C++ GC_INIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GC_INIT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: initGC
jboolean initGC(Options* options) {
GC_set_no_dls(1);
GC_set_java_finalization(1);
GC_INIT();
if (options->maxHeapSize > 0) {
GC_set_max_heap_size(options->maxHeapSize);
}
if (options->initialHeapSize > 0) {
size_t now = GC_get_heap_size();
if (options->initialHeapSize > now) {
GC_expand_hp(options->initialHeapSize - now);
}
}
objectGCKind = GC_new_kind(GC_new_free_list(), GC_MAKE_PROC(GC_new_proc(markObject), 0), 0, 1);
largeArrayGCKind = GC_new_kind(GC_new_free_list(), GC_DS_LENGTH, 1, 1);
atomicObjectGCKind = GC_new_kind(GC_new_free_list(), GC_DS_LENGTH, 0, 1);
referentEntryGCKind = gcNewDirectBitmapKind(REFERENT_ENTRY_GC_BITMAP);
if (rvmInitMutex(&referentsLock) != 0) {
return FALSE;
}
if (rvmInitMutex(&gcRootsLock) != 0) {
return FALSE;
}
GC_set_warn_proc(gcWarnProc);
return TRUE;
}
开发者ID:tobium,项目名称:robovm,代码行数:30,代码来源:memory.c
示例2: OOC_RT0_init
void OOC_RT0_init() {
#ifdef USE_BOEHM_GC
GC_all_interior_pointers = 0;
GC_INIT();
/* tell GC to accept pointers with an offset of 8/16/24 as references to
a given object; this is necessary if the GC is running with the
ALL_INTERIOR_POINTERS option; the offsets cover records and open
arrays with up to 5 free dimensions on 32 bit architectures */
GC_REGISTER_DISPLACEMENT(8);
GC_REGISTER_DISPLACEMENT(16);
GC_REGISTER_DISPLACEMENT(24);
#endif
modules = RT0__NewBlock(sizeModules*sizeof(RT0__Module));
PS(RT0__boolean , "BOOLEAN", RT0__strBoolean , sizeof(OOC_BOOLEAN));
PS(RT0__char , "CHAR", RT0__strChar , sizeof(OOC_CHAR8));
PS(RT0__longchar , "LONGCHAR", RT0__strLongchar , sizeof(OOC_CHAR16));
PS(RT0__ucs4char , "UCS4CHAR", RT0__strUCS4Char , sizeof(OOC_CHAR32));
PS(RT0__shortint , "SHORTINT", RT0__strShortint , sizeof(OOC_INT8));
PS(RT0__integer , "INTEGER", RT0__strInteger , sizeof(OOC_INT16));
PS(RT0__longint , "LONGINT", RT0__strLongint , sizeof(OOC_INT32));
PS(RT0__real , "REAL", RT0__strReal , sizeof(OOC_REAL32));
PS(RT0__longreal , "LONGREAL", RT0__strLongreal , sizeof(OOC_REAL64));
PS(RT0__set32 , "SET", RT0__strSet32 , sizeof(OOC_UINT32));
PS(RT0__byte , "BYTE", RT0__strByte , sizeof(OOC_BYTE));
PS(RT0__ptr , "PTR", RT0__strPtr , sizeof(OOC_PTR));
PS(RT0__procedure, "$PROC", RT0__strProcedure, sizeof(OOC_PTR));
}
开发者ID:AlexIljin,项目名称:oo2c,代码行数:29,代码来源:RT0.c
示例3: main
int main(int argc, char **argv)
{
GC_INIT();
IM2_initialize();
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
开发者ID:DanGrayson,项目名称:M2,代码行数:7,代码来源:testMain.cpp
示例4: ILGCInit
void ILGCInit(unsigned long maxSize)
{
GC_INIT(); /* For shared library initialization on sparc */
GC_set_max_heap_size((size_t)maxSize);
/* Set up the finalization system the way we want it */
GC_finalize_on_demand = 1;
GC_java_finalization = 1;
GC_finalizer_notifier = GCNotifyFinalize;
_FinalizersDisabled = 0;
_ILMutexCreate(&_FinalizerLock);
/* Create the finalizer thread */
_FinalizerStopFlag = 0;
_FinalizerThread = ILThreadCreate(_FinalizerThreadFunc, 0);
if (_FinalizerThread)
{
_FinalizerSignal = ILWaitEventCreate(1, 0);
_FinalizerResponse = ILWaitEventCreate(1, 0);
/* Make the finalizer thread a background thread */
ILThreadSetBackground(_FinalizerThread, 1);
/* To speed up simple command line apps, the finalizer thread doesn't start
until it is first needed */
}
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:29,代码来源:hb_gc.c
示例5: main
int main(void)
{
ast_t * a;
int jval;
jit_t * jit;
GC_INIT();
GREG g;
ast_init();
sym_tab_init();
types_init();
scope_init();
loc_tab_init();
intrinsics_init();
jit = llvm_init();
ZZ_init(jit);
yyinit(&g);
printf("Welcome to Bacon v0.1\n\n");
printf("> ");
while (1)
{
if (!(jval = setjmp(exc)))
{
if (!yyparse(&g))
{
printf("Error parsing\n");
abort();
} else if (root)
{
#if DEBUG1
printf("\n");
ast_print(root, 0);
#endif
inference(root);
#if DEBUG2
printf("\n");
/*ast2_print(root, 0);*/
#endif
exec_root(jit, root);
root = NULL;
}
} else if (jval == 1)
root = NULL;
else /* jval == 2 */
break;
printf("\n> ");
}
llvm_cleanup(jit);
yydeinit(&g);
printf("\n");
return 0;
}
开发者ID:wbhart,项目名称:bacon,代码行数:60,代码来源:bacon.c
示例6: main
int main(void)
{
GC_INIT();
GC_set_max_heap_size(100*1024*1024);
/* Otherwise heap expansion aborts when deallocating large block. */
/* That's OK. We test this corner case mostly to make sure that */
/* it fails predictably. */
GC_expand_hp(1024*1024*5);
if (sizeof(long) == sizeof(void *)) {
void *r = GC_MALLOC(LONG_MAX-1024);
if (0 != r) {
fprintf(stderr,
"Size LONG_MAX-1024 allocation unexpectedly succeeded\n");
exit(1);
}
r = GC_MALLOC(LONG_MAX);
if (0 != r) {
fprintf(stderr,
"Size LONG_MAX allocation unexpectedly succeeded\n");
exit(1);
}
r = GC_MALLOC((size_t)LONG_MAX + 1024);
if (0 != r) {
fprintf(stderr,
"Size LONG_MAX+1024 allocation unexpectedly succeeded\n");
exit(1);
}
}
return 0;
}
开发者ID:ExpressOS,项目名称:third_party-l4re,代码行数:31,代码来源:huge_test.c
示例7: main
int main() {
int i;
GC_INIT();
uniq("%s:%d: error: gc library doesn't find all the active pointers in registers or on the stack!\n"
" Perhaps GC_push_regs was configured incorrectly.\n",
GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)),
GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)),
GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)),
GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)),
GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)),
(void *)0);
for (i=0; i<20; i++) {
if (i%4 == 3) GC_gcollect();
x[i] = GC_malloc(12);
}
uniq("%s:%d: error: gc library doesn't find all the active pointers in static memory!\n"
" Perhaps GC_add_roots needs to be told about static memory.\n",
x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19], (void *)0);
for (i=0; i<20; i++) {
reg(GC_malloc(12));
}
GC_gcollect(); /* just to see if finalizers get called */
return had_error;
}
开发者ID:AlessandroOneto,项目名称:M2,代码行数:30,代码来源:gc_test.c
示例8: libxl_sched_credit2_params_set
int libxl_sched_credit2_params_set(libxl_ctx *ctx, uint32_t poolid,
libxl_sched_credit2_params *scinfo)
{
struct xen_sysctl_credit2_schedule sparam;
int r, rc;
GC_INIT(ctx);
rc = sched_ratelimit_check(gc, scinfo->ratelimit_us);
if (rc) goto out;
sparam.ratelimit_us = scinfo->ratelimit_us;
r = xc_sched_credit2_params_set(ctx->xch, poolid, &sparam);
if (r < 0) {
LOGE(ERROR, "Setting Credit2 scheduler parameters");
rc = ERROR_FAIL;
goto out;
}
scinfo->ratelimit_us = sparam.ratelimit_us;
rc = 0;
out:
GC_FREE;
return rc;
}
开发者ID:mirage,项目名称:xen,代码行数:26,代码来源:libxl_sched.c
示例9: main
int main (void)
{
int i;
GC_INIT ();
# ifdef GC_SOLARIS_THREADS
pthread_key_create (&key, on_thread_exit);
# else
pthread_once (&key_once, make_key);
# endif
for (i = 0; i < NTHREADS; i++) {
pthread_t t;
if (GC_pthread_create(&t, NULL, entry, NULL) == 0) {
void *res;
int code = (i & 1) != 0 ? GC_pthread_join(t, &res)
: GC_pthread_detach(t);
if (code != 0) {
fprintf(stderr, "Thread %s failed %d\n",
(i & 1) != 0 ? "join" : "detach", code);
exit(2);
}
}
}
return 0;
}
开发者ID:OpenModelica,项目名称:OMCompiler-3rdParty,代码行数:27,代码来源:threadkey_test.c
示例10: main
int main(int argc, char * const argv[])
{
ParserContext context;
GC_INIT();
const char *syntax_file = NULL;
const char *orig_argv0 = argv[0];
int opt;
while ((opt = getopt(argc, argv, "f:")) != -1) {
switch (opt) {
case 'f':
syntax_file = optarg;
break;
default: /* '?' */
pegvm_usage(orig_argv0);
}
}
if (syntax_file == NULL) {
pegvm_usage(orig_argv0);
}
argc -= optind;
argv += optind;
if (argc == 0) {
pegvm_usage(orig_argv0);
}
ParserContext_Init(&context);
if (ParserContext_LoadSyntax(&context, syntax_file)) {
pegvm_error("invalid bytecode");
}
if (ParserContext_ParseFiles(&context, argc, (char **)argv)) {
pegvm_error(context.last_error);
}
ParserContext_Dispose(&context);
return 0;
}
开发者ID:imasahiro,项目名称:simplevm,代码行数:34,代码来源:main.c
示例11: initialize_memory
int initialize_memory()
{
GC_INIT();
POINTER_MASK = 0xFFFFFFFFFFFFFFF0;
return 0;
}
开发者ID:shikantaza,项目名称:pLisp,代码行数:7,代码来源:memory_old.c
示例12: main
int
main (int argc, char **argv)
{
// Set exit routines
atexit (GC_gcollect);
atexit (close_libs);
atexit (thread_cleanup);
// Start the garbage collector
GC_INIT ();
// Set up GMP library
mp_set_memory_functions (&FACT_malloc,
&gmp_realloc_wrapper,
&gmp_free_wrapper);
// Start the main thread
root_thread = FACT_malloc (sizeof (FACT_thread_t));
root_thread->tid = pthread_self ();
root_thread->exited = false;
root_thread->destroy = false;
root_thread->next = NULL;
root_thread->prev = NULL;
root_thread->root = NULL;
root_thread->nid = 0;
pthread_mutex_init (&root_thread->queue_lock, NULL);
// Process the arguments and start the interpreter.
process_args (argc, argv);
// Exit.
exit (0);
}
开发者ID:netspencer,项目名称:FACT,代码行数:33,代码来源:main.c
示例13: libsrl_init
GC_TEST_EXPORT_API void * libsrl_init(void)
{
# ifndef STATICROOTSLIB_INIT_IN_MAIN
GC_INIT();
# endif
return GC_MALLOC(sizeof(struct treenode));
}
开发者ID:8l,项目名称:lllm,代码行数:7,代码来源:staticrootslib.c
示例14: main
int main() {
GC_INIT();
const RRB *rrb = rrb_create();
for (uintptr_t i = 0; i < 33; i++) {
rrb = rrb_push(rrb, (void *) i);
}
int file_size = rrb_to_dot_file(rrb, "foo.dot");
switch (file_size) {
case -1:
puts("Had trouble either opening or closing \"foo.dot\".");
return 1;
case -2:
puts("Had trouble writing to the file \"foo.dot\".");
return 1;
default:
printf("The file \"foo.dot\" contains an RRB-tree in dot format "
"(%d bytes)\n", file_size);
if (RRB_BITS != 2) {
puts("\n"
"(If you want to use the code for visualising RRB-trees, I'd recommend to use the\n"
" settings `CFLAGS='-Ofast' ./configure --with-branching=2` instead. It is much\n"
" easier to visualise/comprehend with 4 elements per trie node instead of 32.)");
}
return 0;
}
}
开发者ID:ukutaht,项目名称:c-rrb,代码行数:27,代码来源:printing_example.c
示例15: libxl__init_recursive_mutex
_hidden int libxl__init_recursive_mutex(libxl_ctx *ctx, pthread_mutex_t *lock)
{
GC_INIT(ctx);
pthread_mutexattr_t attr;
int rc = 0;
if (pthread_mutexattr_init(&attr) != 0) {
LOGE(ERROR, "Failed to init mutex attributes");
rc = ERROR_FAIL;
goto out;
}
if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0) {
LOGE(ERROR, "Failed to set mutex attributes");
rc = ERROR_FAIL;
goto out;
}
if (pthread_mutex_init(lock, &attr) != 0) {
LOGE(ERROR, "Failed to init mutex");
rc = ERROR_FAIL;
goto out;
}
out:
pthread_mutexattr_destroy(&attr);
GC_FREE;
return rc;
}
开发者ID:jfehlig,项目名称:xen,代码行数:26,代码来源:libxl_internal.c
示例16: libxl_vcpu_sched_params_get_all
int libxl_vcpu_sched_params_get_all(libxl_ctx *ctx, uint32_t domid,
libxl_vcpu_sched_params *scinfo)
{
GC_INIT(ctx);
int rc;
scinfo->sched = libxl__domain_scheduler(gc, domid);
switch (scinfo->sched) {
case LIBXL_SCHEDULER_SEDF:
LOGD(ERROR, domid, "SEDF scheduler is no longer available");
rc = ERROR_FEATURE_REMOVED;
break;
case LIBXL_SCHEDULER_CREDIT:
case LIBXL_SCHEDULER_CREDIT2:
case LIBXL_SCHEDULER_ARINC653:
case LIBXL_SCHEDULER_NULL:
LOGD(ERROR, domid, "per-VCPU parameter getting not supported for this scheduler");
rc = ERROR_INVAL;
break;
case LIBXL_SCHEDULER_RTDS:
rc = sched_rtds_vcpu_get_all(gc, domid, scinfo);
break;
default:
LOGD(ERROR, domid, "Unknown scheduler");
rc = ERROR_INVAL;
break;
}
GC_FREE;
return rc;
}
开发者ID:mirage,项目名称:xen,代码行数:32,代码来源:libxl_sched.c
示例17: main
int main() {
GC_INIT();
// Create the input file.
// Right now, this requires an actual file, but on non-mac os x
// systems, there is a function fmemopen() which lets you open
// an in-memory buffer as a file handle. There are shims for it on
// mac os x, but its more complex than it needs to be
FILE *input = fopen("example.lisp", "r");
// Create the parser state object. This could probably be moved into parse()
// but for now you need to do it seperately
struct p_state state = new_p_state(input);
// parse the lisp code into an ast
struct sexp *parsed = parse(&state);
// Display the resulting ast
print_ast_node(parsed[0]);
printf("\n********************\n");
scm *res = run_lisp(parsed[0]);
printf("RESULT: ");
print_scm(res);
printf("\n");
}
开发者ID:mystor,项目名称:simple-lisp-parser-in-c,代码行数:27,代码来源:runtime.c
示例18: main
int main(void) {
GC_INIT();
GREG g;
int jval, jval2;
char c;
sym_tab_init();
ast_init();
type_init();
scope_init();
rel_assign_init();
jit_t * jit = llvm_init();
yyinit(&g);
printf("Welcome to Cesium v 0.2\n");
printf("To exit press CTRL-D\n\n");
printf("> ");
while (1)
{
if (!(jval = setjmp(exc)))
{
if (!yyparse(&g))
{
printf("Error parsing\n");
abort();
} else if (root != NULL)
{
rel_stack_init();
rel_assign_mark();
scope_mark();
annotate_ast(root);
if (TRACE)
ast_print(root, 0);
unify(rel_stack, rel_assign);
if (TRACE)
print_assigns(rel_assign);
exec_root(jit, root);
if (root->tag != AST_FNDEC)
rel_assign_rewind();
}
} else if (jval == 1)
root = NULL;
else if (jval == 2)
break;
printf("\n> ");
}
yydeinit(&g);
llvm_cleanup(jit);
return 0;
}
开发者ID:finbrein,项目名称:Cesium,代码行数:57,代码来源:cesium.c
示例19: new
void* Object::operator new( size_t size) {
if(SYLPH_UNLIKELY(!Object::gc_inited)) {
GC_INIT();
Object::gc_inited = true;
}
void * toReturn = GC_MALLOC(size);
if (!toReturn) throw std::bad_alloc();
else return toReturn;
}
开发者ID:scottphilbrook84,项目名称:libsylph,代码行数:9,代码来源:Object.cpp
示例20: main
int
main (int argc, char **argv)
{
GC_INIT ();
setlocale (LC_ALL, "");
printf ("%s|", GFileGetUserDataDir ());
ulc_fprintf (stdout, "%U|", u8_GFileGetUserDataDir ());
return 0;
}
开发者ID:khaledhosny,项目名称:sortsmill,代码行数:9,代码来源:test_GFileGetUserDataDir.c
注:本文中的GC_INIT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论