当前位置: 首页>>代码示例>>C++>>正文


C++ critical_error函数代码示例

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


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

示例1: end

/* The number of cells from the start of the object which should be scanned by
the GC. Some types have a binary payload at the end (string, word, DLL) which
we ignore. */
cell factor_vm::binary_payload_start(object *pointer)
{
    switch(pointer->h.hi_tag())
    {
    /* these objects do not refer to other objects at all */
    case FLOAT_TYPE:
    case BYTE_ARRAY_TYPE:
    case BIGNUM_TYPE:
    case CALLSTACK_TYPE:
        return 0;
    /* these objects have some binary data at the end */
    case WORD_TYPE:
        return sizeof(word) - sizeof(cell) * 3;
    case ALIEN_TYPE:
        return sizeof(cell) * 3;
    case DLL_TYPE:
        return sizeof(cell) * 2;
    case QUOTATION_TYPE:
        return sizeof(quotation) - sizeof(cell) * 2;
    case STRING_TYPE:
        return sizeof(string);
    /* everything else consists entirely of pointers */
    case ARRAY_TYPE:
        return array_size<array>(array_capacity((array*)pointer));
    case TUPLE_TYPE:
        return tuple_size(untag<tuple_layout>(((tuple *)pointer)->layout));
    case WRAPPER_TYPE:
        return sizeof(wrapper);
    default:
        critical_error("Invalid header",(cell)pointer);
        return 0; /* can't happen */
    }
}
开发者ID:harold,项目名称:factor,代码行数:36,代码来源:data_heap.cpp

示例2: lasso_server_add_provider_helper

static gint
lasso_server_add_provider_helper(LassoServer *server, LassoProviderRole role,
		const gchar *metadata, const gchar *public_key, const gchar *ca_cert_chain,
		LassoProvider *(*provider_constructor)(LassoProviderRole role,
		const char *metadata, const char *public_key, const char *ca_cert_chain))
{
	LassoProvider *provider;

	g_return_val_if_fail(LASSO_IS_SERVER(server), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
	g_return_val_if_fail(metadata != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);

	provider = provider_constructor(role, metadata, public_key, ca_cert_chain);
	if (provider == NULL) {
		return critical_error(LASSO_SERVER_ERROR_ADD_PROVIDER_FAILED);
	}
	provider->role = role;

	if (LASSO_PROVIDER(server)->private_data->conformance == LASSO_PROTOCOL_SAML_2_0 &&
			provider->private_data->conformance != LASSO_PROTOCOL_SAML_2_0) {
		lasso_node_destroy(LASSO_NODE(provider));
		return LASSO_SERVER_ERROR_ADD_PROVIDER_PROTOCOL_MISMATCH;
	}

	if (LASSO_PROVIDER(server)->private_data->conformance == LASSO_PROTOCOL_LIBERTY_1_2 &&
			provider->private_data->conformance > LASSO_PROTOCOL_LIBERTY_1_2) {
		lasso_node_destroy(LASSO_NODE(provider));
		return LASSO_SERVER_ERROR_ADD_PROVIDER_PROTOCOL_MISMATCH;
	}

	g_hash_table_insert(server->providers, g_strdup(provider->ProviderID), provider);

	return 0;
}
开发者ID:cascadeo,项目名称:lasso,代码行数:33,代码来源:server.c

示例3: end_gc

void factor_vm::start_gc_again()
{
	end_gc();

	switch(current_gc->op)
	{
	case collect_nursery_op:
		current_gc->op = collect_aging_op;
		break;
	case collect_aging_op:
		current_gc->op = collect_to_tenured_op;
		break;
	case collect_to_tenured_op:
		current_gc->op = collect_full_op;
		break;
	case collect_full_op:
	case collect_compact_op:
		current_gc->op = collect_growing_heap_op;
		break;
	default:
		critical_error("Bad GC op",current_gc->op);
		break;
	}

	current_gc->event = new gc_event(current_gc->op,this);
}
开发者ID:littledan,项目名称:Factor,代码行数:26,代码来源:gc.cpp

示例4: indirect_blocks_needed

static u32 indirect_blocks_needed(u32 len)
{
	u32 ind = 0;

	if (len <= EXT4_NDIR_BLOCKS)
		return ind;

	len -= EXT4_NDIR_BLOCKS;

	/* We will need an indirect block for the rest of the blocks */
	ind += DIV_ROUND_UP(len, aux_info.blocks_per_ind);

	if (len <= aux_info.blocks_per_ind)
		return ind;

	len -= aux_info.blocks_per_ind;

	ind += DIV_ROUND_UP(len, aux_info.blocks_per_dind);

	if (len <= aux_info.blocks_per_dind)
		return ind;

	len -= aux_info.blocks_per_dind;

	ind += DIV_ROUND_UP(len, aux_info.blocks_per_tind);

	if (len <= aux_info.blocks_per_tind)
		return ind;

	critical_error("request too large");
	return 0;
}
开发者ID:TeamNyx,项目名称:system_extras,代码行数:32,代码来源:indirect.c

示例5: switch

/* Size of the data area of an object pointed to by an untagged pointer */
cell factor_vm::unaligned_object_size(object *pointer)
{
    switch(pointer->h.hi_tag())
    {
    case ARRAY_TYPE:
        return array_size((array*)pointer);
    case BIGNUM_TYPE:
        return array_size((bignum*)pointer);
    case BYTE_ARRAY_TYPE:
        return array_size((byte_array*)pointer);
    case STRING_TYPE:
        return string_size(string_capacity((string*)pointer));
    case TUPLE_TYPE:
        return tuple_size(untag<tuple_layout>(((tuple *)pointer)->layout));
    case QUOTATION_TYPE:
        return sizeof(quotation);
    case WORD_TYPE:
        return sizeof(word);
    case FLOAT_TYPE:
        return sizeof(boxed_float);
    case DLL_TYPE:
        return sizeof(dll);
    case ALIEN_TYPE:
        return sizeof(alien);
    case WRAPPER_TYPE:
        return sizeof(wrapper);
    case CALLSTACK_TYPE:
        return callstack_size(untag_fixnum(((callstack *)pointer)->length));
    default:
        critical_error("Invalid header",(cell)pointer);
        return 0; /* can't happen */
    }
}
开发者ID:harold,项目名称:factor,代码行数:34,代码来源:data_heap.cpp

示例6: critical_error

/* Creates data buffers for the first backing_len bytes of a block allocation
   and queues them to be written */
static u8 *create_backing(struct block_allocation *alloc,
		unsigned long backing_len)
{
	if (DIV_ROUND_UP(backing_len, info.block_size) > EXT4_NDIR_BLOCKS)
		critical_error("indirect backing larger than %d blocks", EXT4_NDIR_BLOCKS);

	u8 *data = calloc(backing_len, 1);
	if (!data)
		critical_error_errno("calloc");

	u8 *ptr = data;
	for (; alloc != NULL && backing_len > 0; get_next_region(alloc)) {
		u32 region_block;
		u32 region_len;
		u32 len;
		get_region(alloc, &region_block, &region_len);

		len = min(region_len * info.block_size, backing_len);

		queue_data_block(ptr, len, region_block);
		ptr += len;
		backing_len -= len;
	}

	return data;
}
开发者ID:TeamNyx,项目名称:system_extras,代码行数:28,代码来源:indirect.c

示例7: end_gc

void factor_vm::start_gc_again()
{
    end_gc();

    switch(current_gc->op)
    {
    case collect_nursery_op:
        /* Nursery collection can fail if aging does not have enough
        free space to fit all live objects from nursery. */
        current_gc->op = collect_aging_op;
        break;
    case collect_aging_op:
        /* Aging collection can fail if the aging semispace cannot fit
        all the live objects from the other aging semispace and the
        nursery. */
        current_gc->op = collect_to_tenured_op;
        break;
    default:
        /* Nothing else should fail mid-collection due to insufficient
        space in the target generation. */
        critical_error("Bad GC op",current_gc->op);
        break;
    }

    if(gc_events)
        current_gc->event = new gc_event(current_gc->op,this);
}
开发者ID:Renha,项目名称:factor,代码行数:27,代码来源:gc.cpp

示例8: while

cell factor_vm::lookup_tuple_method(cell obj, cell methods)
{
	tuple_layout *layout = untag<tuple_layout>(untag<tuple>(obj)->layout);

	array *echelons = untag<array>(methods);

	fixnum echelon = std::min(untag_fixnum(layout->echelon),(fixnum)array_capacity(echelons) - 1);

	while(echelon >= 0)
	{
		cell echelon_methods = array_nth(echelons,echelon);

		if(tagged<object>(echelon_methods).type_p(WORD_TYPE))
			return echelon_methods;
		else if(to_boolean(echelon_methods))
		{
			cell klass = nth_superclass(layout,echelon);
			cell hashcode = untag_fixnum(nth_hashcode(layout,echelon));
			cell result = search_lookup_hash(echelon_methods,klass,hashcode);
			if(to_boolean(result))
				return result;
		}

		echelon--;
	}

	critical_error("Cannot find tuple method",methods);
	return false_object;
}
开发者ID:mcandre,项目名称:factor,代码行数:29,代码来源:dispatch.cpp

示例9: assert

void factor_vm::gc(gc_op op, cell requested_bytes, bool trace_contexts_p)
{
	assert(!gc_off);
	assert(!current_gc);

	current_gc = new gc_state(op,this);

	/* Keep trying to GC higher and higher generations until we don't run out
	of space */
	if(setjmp(current_gc->gc_unwind))
	{
		/* We come back here if a generation is full */
		start_gc_again();
	}

	current_gc->event->op = current_gc->op;

	switch(current_gc->op)
	{
	case collect_nursery_op:
		collect_nursery();
		break;
	case collect_aging_op:
		collect_aging();
		if(data->high_fragmentation_p())
		{
			current_gc->op = collect_full_op;
			current_gc->event->op = collect_full_op;
			collect_full(trace_contexts_p);
		}
		break;
	case collect_to_tenured_op:
		collect_to_tenured();
		if(data->high_fragmentation_p())
		{
			current_gc->op = collect_full_op;
			current_gc->event->op = collect_full_op;
			collect_full(trace_contexts_p);
		}
		break;
	case collect_full_op:
		collect_full(trace_contexts_p);
		break;
	case collect_compact_op:
		collect_compact(trace_contexts_p);
		break;
	case collect_growing_heap_op:
		collect_growing_heap(requested_bytes,trace_contexts_p);
		break;
	default:
		critical_error("Bad GC op",current_gc->op);
		break;
	}

	end_gc();

	delete current_gc;
	current_gc = NULL;
}
开发者ID:littledan,项目名称:Factor,代码行数:59,代码来源:gc.cpp

示例10: strlen

/* return a newly-malloc'd string that is a copy of str.  The new string
   is guaranteed to have a trailing slash.  If absolute is true, the new string
   is also guaranteed to have a leading slash.
*/
static char *canonicalize_slashes(const char *str, bool absolute)
{
	char *ret;
	int len = strlen(str);
	int newlen = len;
	char *ptr;

	if (len == 0) {
		if (absolute)
			return strdup("/");
		else
			return strdup("");
	}

	if (str[0] != '/' && absolute) {
		newlen++;
	}
	if (str[len - 1] != '/') {
		newlen++;
	}
	ret = malloc(newlen + 1);
	if (!ret) {
		critical_error("malloc");
	}

	ptr = ret;
	if (str[0] != '/' && absolute) {
		*ptr++ = '/';
	}

	strcpy(ptr, str);
	ptr += len;

	if (str[len - 1] != '/') {
		*ptr++ = '/';
	}

	if (ptr != ret + newlen) {
		critical_error("assertion failed\n");
	}

	*ptr = '\0';

	return ret;
}
开发者ID:acempiece,项目名称:make_ext4fs,代码行数:49,代码来源:make_ext4fs.c

示例11: to_boolean

void factor_vm::primitive_modify_code_heap()
{
	bool reset_inline_caches = to_boolean(ctx->pop());
	bool update_existing_words = to_boolean(ctx->pop());
	data_root<array> alist(ctx->pop(),this);

	cell count = array_capacity(alist.untagged());

	if(count == 0)
		return;

	for(cell i = 0; i < count; i++)
	{
		data_root<array> pair(array_nth(alist.untagged(),i),this);

		data_root<word> word(array_nth(pair.untagged(),0),this);
		data_root<object> data(array_nth(pair.untagged(),1),this);

		switch(data.type())
		{
		case QUOTATION_TYPE:
			jit_compile_word(word.value(),data.value(),false);
			break;
		case ARRAY_TYPE:
			{
				array *compiled_data = data.as<array>().untagged();
				cell parameters = array_nth(compiled_data,0);
				cell literals = array_nth(compiled_data,1);
				cell relocation = array_nth(compiled_data,2);
				cell labels = array_nth(compiled_data,3);
				cell code = array_nth(compiled_data,4);

				code_block *compiled = add_code_block(
					code_block_optimized,
					code,
					labels,
					word.value(),
					relocation,
					parameters,
					literals);

				word->code = compiled;
			}
			break;
		default:
			critical_error("Expected a quotation or an array",data.value());
			break;
		}

		update_word_entry_point(word.untagged());
	}

	if(update_existing_words)
		update_code_heap_words(reset_inline_caches);
	else
		initialize_code_blocks();
}
开发者ID:8byte-jose,项目名称:factor,代码行数:57,代码来源:code_heap.cpp

示例12: inode_attach_resize

void inode_attach_resize(struct ext4_inode *inode,
		struct block_allocation *alloc)
{
	u32 block_len = block_allocation_len(alloc);
	u32 superblocks = block_len / info.bg_desc_reserve_blocks;
	u32 i, j;
	u64 blocks;
	u64 size;

	if (block_len % info.bg_desc_reserve_blocks)
		critical_error("reserved blocks not a multiple of %d",
				info.bg_desc_reserve_blocks);

	append_oob_allocation(alloc, 1);
	u32 dind_block = get_oob_block(alloc, 0);

	u32 *dind_block_data = calloc(info.block_size, 1);
	if (!dind_block_data)
		critical_error_errno("calloc");
	queue_data_block((u8 *)dind_block_data, info.block_size, dind_block);

	u32 *ind_block_data = calloc(info.block_size, info.bg_desc_reserve_blocks);
	if (!ind_block_data)
		critical_error_errno("calloc");
	queue_data_block((u8 *)ind_block_data,
			info.block_size * info.bg_desc_reserve_blocks,
			get_block(alloc, 0));

	for (i = 0; i < info.bg_desc_reserve_blocks; i++) {
		int r = (i - aux_info.bg_desc_blocks) % info.bg_desc_reserve_blocks;
		if (r < 0)
			r += info.bg_desc_reserve_blocks;

		dind_block_data[i] = get_block(alloc, r);

		for (j = 1; j < superblocks; j++) {
			u32 b = j * info.bg_desc_reserve_blocks + r;
			ind_block_data[r * aux_info.blocks_per_ind + j - 1] = get_block(alloc, b);
		}
	}

	u32 last_block = EXT4_NDIR_BLOCKS + aux_info.blocks_per_ind +
			aux_info.blocks_per_ind * (info.bg_desc_reserve_blocks - 1) +
			superblocks - 2;

	blocks = ((u64)block_len + 1) * info.block_size / 512;
	size = (u64)last_block * info.block_size;

	inode->i_block[EXT4_DIND_BLOCK] = dind_block;
	inode->i_flags = 0;
	inode->i_blocks_lo = blocks;
	inode->osd2.linux2.l_i_blocks_high = blocks >> 32;
	inode->i_size_lo = size;
	inode->i_size_high = size >> 32;
}
开发者ID:TeamNyx,项目名称:system_extras,代码行数:55,代码来源:indirect.c

示例13: writeBNtoFile

void writeBNtoFile(const BIGNUM *bn, const char *filename) {
	int bufLen = BN_num_bytes(bn);
	unsigned char *buf = (unsigned char *) malloc(bufLen);

	bufLen = BN_bn2bin(bn, buf);
	if (_bufToFile(filename, buf, bufLen)) {
		printf("%s - ",filename);
		critical_error("can't write to file!");
	}
	free(buf);
}
开发者ID:darioscarpa,项目名称:pkiPedersenCommitment,代码行数:11,代码来源:commitment_common.c

示例14: set_callstack

void factor_vm::primitive_set_callstack()
{
	callstack *stack = untag_check<callstack>(dpop());

	set_callstack(stack_chain->callstack_bottom,
		stack->top(),
		untag_fixnum(stack->length),
		memcpy);

	/* We cannot return here ... */
	critical_error("Bug in set_callstack()",0);
}
开发者ID:chris-ream,项目名称:factor,代码行数:12,代码来源:callstack.cpp

示例15: build_free_list

/* Called after reading the code heap from the image file, and after code GC.

In the former case, we must add a large free block from compiling.base + size to
compiling.limit. */
void build_free_list(F_HEAP *heap, CELL size)
{
	F_BLOCK *prev = NULL;
	F_BLOCK *prev_free = NULL;
	F_BLOCK *scan = first_block(heap);
	F_BLOCK *end = (F_BLOCK *)(heap->segment->start + size);

	/* Add all free blocks to the free list */
	while(scan && scan < end)
	{
		switch(scan->status)
		{
		case B_FREE:
			update_free_list(heap,prev_free,scan);
			prev_free = scan;
			break;
		case B_ALLOCATED:
			break;
		default:
			critical_error("Invalid scan->status",(CELL)scan);
			break;
		}

		prev = scan;
		scan = next_block(heap,scan);
	}

	/* If there is room at the end of the heap, add a free block. This
	branch is only taken after loading a new image, not after code GC */
	if((CELL)(end + 1) <= heap->segment->end)
	{
		end->status = B_FREE;
		end->next_free = NULL;
		end->size = heap->segment->end - (CELL)end;

		/* add final free block */
		update_free_list(heap,prev_free,end);
	}
	/* This branch is taken if the newly loaded image fits exactly, or
	after code GC */
	else
	{
		/* even if there's no room at the end of the heap for a new
		free block, we might have to jigger it up by a few bytes in
		case prev + prev->size */
		if(prev)
			prev->size = heap->segment->end - (CELL)prev;

		/* this is the last free block */
		update_free_list(heap,prev_free,NULL);
	}

}
开发者ID:Rogers-zz,项目名称:factor,代码行数:57,代码来源:code_gc.c


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