本文整理汇总了C++中GUARANTEE函数的典型用法代码示例。如果您正苦于以下问题:C++ GUARANTEE函数的具体用法?C++ GUARANTEE怎么用?C++ GUARANTEE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GUARANTEE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: base_offset
void MemoryAddress::prepare_preindexed_address(jint address_offset,
Assembler::Register& reg,
jint& offset){
offset = 0;
if (!has_address_register()) {
// Try to do direct access
jint fixed_offset;
if (has_fixed_offset(fixed_offset)) {
offset = fixed_offset + base_offset() + address_offset;
reg = fixed_register();
return;
}
create_and_initialize_address_register();
}
GUARANTEE(has_address_register(), "We must have address register by now");
reg = address_register();
int xbase_offset = // base_offset or 0
address_register_includes_base_offset() ? 0 : base_offset();
if (address_offset == 0 && xbase_offset != 0) {
// Update the address_register so that it includes the base_offset
set_address_register_includes_base_offset();
code_generator()->add(address_register(), address_register(), xbase_offset);
offset = 0;
} else {
offset = (address_offset + xbase_offset);
}
}
示例2: check_virtual
void check_virtual(int index JVM_TRAPS) {
UsingFastOops level1;
ConstantPool::Fast cp = method()->constants();
InstanceClass::Fast klass;
ClassInfo::Fast info;
Method::Fast m;
if (cp().tag_at(index).is_resolved_virtual_method()) {
int class_id, vtable_index;
cp().resolved_virtual_method_at(index, vtable_index, class_id);
klass = Universe::class_from_id(class_id);
info = klass().class_info();
m = info().vtable_method_at(vtable_index);
_owner->add_method(&m JVM_NO_CHECK_AT_BOTTOM);
} else {
// This could be an element we failed to resolve
// when ROMizing an application.
if (!PostponeErrorsUntilRuntime) {
SHOULD_NOT_REACH_HERE();
} else {
//The following GUARANTEE could trigger if the class is a bogus
// TCK class and we want to postpone the error until runtime so
// we have commented it out.
// GUARANTEE(cp.tag_at(index).is_method(), "Sanity");
// The class must be marked as unverified or non-optimizable,
// since it contains an unresolved entry at this point.
#ifdef AZZERT
klass = method()->holder();
GUARANTEE(!klass().is_verified() || !klass().is_optimizable(), "Sanity");
#endif
}
}
}
示例3: getClass
CLASS getClass(const char *name) {
GUARANTEE(_in_kvm_native_method, "sanity");
OopDesc *mirror_obj = NULL;
KNI_FindClass(name, (jclass)&mirror_obj);
return mirror_obj;
}
示例4: offset_from_checked_index
jint ConstantPool::name_and_type_at(int index JVM_TRAPS) const {
int offset = offset_from_checked_index(index JVM_ZCHECK_0(offset));
cp_check_0(ConstantTag::is_name_and_type(tag_value_at(index)));
int result = int_field(offset);
GUARANTEE(result != 0, "sanity for JVM_ZCHECK");
return result;
}
示例5: do_oop
void Thread::stack_oops_do(void do_oop(OopDesc**)) {
if (this->task_id() == Task::INVALID_TASK_ID) {
// If we continue we'll break JVMTaskGCContext with a -1 task id
GUARANTEE(!last_java_frame_exists(), "thread is already dead");
return;
}
// See Scheduler.cpp threads_do_list() for the
// reason why we do this.
const TaskGCContext tmp(this->task_id());
// Java frames
if (last_java_frame_exists()) {
Frame fr(this);
while (true) {
if (fr.is_entry_frame()) {
fr.as_EntryFrame().oops_do(do_oop);
if (fr.as_EntryFrame().is_first_frame()) {
break;
}
fr.as_EntryFrame().caller_is(fr);
} else {
fr.as_JavaFrame().oops_do(do_oop);
fr.as_JavaFrame().caller_is(fr);
}
}
}
}
示例6: KNI_GetThisPointer
KNIEXPORT void KNI_GetThisPointer(jobject toHandle) {
GUARANTEE(!_in_kvm_native_method, "sanity");
#ifdef AZZERT
if (!_jvm_in_quick_native_method) {
if (!ObjectHeap::is_finalizing()) {
JavaFrame frame(Thread::current());
Method::Raw method = frame.method();
GUARANTEE(!method().is_static(), "static method has no 'this' pointer");
}
} else {
// IMPL_NOTE: we don't have current method info ... this should be fixed to
// make it possible to do the GUARANTEE as above.
}
#endif
KNI_GetParameterAsObject(0, toHandle);
}
示例7: print_comment_for
void CompiledMethod::print_code_on(Stream* st) {
int end_offset = RelocationReader::code_length(this);
for (int offset = 0; offset < end_offset; offset += 2) {
short* instruction_start = (short*) (entry() + offset);
print_comment_for(offset, st);
bool is_oop = false;
for (RelocationReader stream(this); !stream.at_end(); stream.advance()) {
if (stream.code_offset() == offset) {
if (stream.is_oop() || stream.is_rom_oop()) {
is_oop = true;
break;
}
}
}
st->print(" %4d: ", offset);
if (VerbosePointers) {
st->print("0x%08x: ", instruction_start);
}
if (!is_oop) {
decode_instruction(st, instruction_start, offset);
} else {
GUARANTEE(((int)instruction_start & 0x3) == 0,
"Disassembler: Invalid embedded Oop");
Oop o = (OopDesc*)*(int*)instruction_start;
if (VerbosePointers) {
st->print("0x%08x:", *(int*)instruction_start);
}
o.print_value_on(st);
offset += 2;
}
st->cr();
}
}
示例8: GUARANTEE
void Value::set_double(jdouble value) {
GUARANTEE(type() == T_DOUBLE, "check type");
destroy();
set_where(T_IMMEDIATE);
*(double *)(&_low) = value;
}
示例9: ForAllHandles
/*
* Verifies that this oop is a unique handle to its obj, i.e. no other Oop on
* the chain refences its obj.
*/
void LinkedBasicOop::handle_uniqueness_verification() {
if (not_null()) {
ForAllHandles( handle ) {
GUARANTEE(handle == this || handle->obj() != obj(), "Non-unique handle");
}
}
}
示例10: is_value
void ExtendedValue::set_obj(Oop* value) {
if (value->is_null()) {
is_value(T_OBJECT);
this->value().set_obj(value);
} else {
// IMPL_NOTE: Can we merge the code below with Value::set_value() ??
set_oop(value);
if (!ObjectHeap::contains_moveable(value->obj())) {
_value.set_not_on_heap();
}
#if ENABLE_COMPILER_TYPE_INFO
FarClass::Raw value_class = value->blueprint();
GUARANTEE(value_class.not_null(), "Sanity");
if (value_class.is_java_class()) {
JavaClass::Raw java_class = value_class.obj();
_value.set_class_id(java_class().class_id());
_value.set_is_exact_type();
}
#else
if (value->is_string()) {
_value.set_is_string();
}
#endif
_value.set_must_be_nonnull();
}
}
示例11: destroy
void Value::set_registers(Assembler::Register low, Assembler::Register high) {
destroy();
GUARANTEE(use_two_registers(), "tag_check");
set_where(T_REGISTER);
_low = (int) low;
_high = (int) high;
}
示例12: byte_size_for
int byte_size_for(BasicType type) {
static const jubyte table[] = {
/* unused = 0: */ 0,
/* unused = 1: */ 0,
/* unused = 2: */ 0,
/* unused = 3: */ 0,
/* T_BOOLEAN = 4: */ T_BOOLEAN_byte_size,
/* T_CHAR = 5: */ T_CHAR_byte_size,
/* T_FLOAT = 6: */ T_FLOAT_byte_size,
/* T_DOUBLE = 7: */ T_DOUBLE_byte_size,
/* T_BYTE = 8: */ T_BYTE_byte_size,
/* T_SHORT = 9: */ T_SHORT_byte_size,
/* T_INT = 10: */ T_INT_byte_size,
/* T_LONG = 11: */ T_LONG_byte_size,
/* T_OBJECT = 12: */ T_OBJECT_byte_size,
/* T_ARRAY = 13: */ T_OBJECT_byte_size,
/* T_VOID = 14: */ T_VOID_byte_size,
#if ENABLE_ROM_GENERATOR
/* T_SYMBOLIC = 15: */ T_SYMBOLIC_byte_size,
#endif
};
#ifdef AZZERT
#if ENABLE_ROM_GENERATOR
const int max = T_SYMBOLIC;
#else
const int max = T_VOID;
#endif
GUARANTEE(type >= T_BOOLEAN && type <= max, "sanity");
#endif
return table[(int)type];
}
示例13: GUARANTEE
void GPTableGenerator::define_zeros(int size) {
if (!GenerateGPTableOnly) {
SourceMacros::define_zeros(size);
} else {
if (GenerateGNUCode) {
#ifdef SPARC
GUARANTEE((size % 4) == 0, "sanity");
for (int i=0; i<size; i+=4) {
stream()->print_cr("\t.long\t0");
}
#else
stream()->print_cr("\t%s\t%d", ".space", size);
#endif
} else {
// generating the GP table on Win32 for MASM
if ((size % 4) == 0) {
for (int i=0; i<size; i+=4) {
stream()->print_cr("\tDWORD 0; %d bytes", i+4);
}
} else {
// We support only define_zero of bytes divisible by 4!
UNIMPLEMENTED();
}
}
}
}
示例14: OsMemory_adjust_chunk
// Expand or shrink a chunk returned by allocate_chunk().
// The chunk is never moved.
//
// Returns 0 if fail to expand (shrink will always succeed). Returns old
// size if successful.
size_t OsMemory_adjust_chunk(address chunk_ptr, size_t new_committed_size) {
ChunkInfo* ci = get_chunk_info(chunk_ptr);
size_t old_size = ci->size;
size_t new_size = page_align_up(new_committed_size);
if (new_size <= ci->mmaped_size) {
int rv;
if (new_size < old_size) {
rv = protect_area(chunk_ptr + new_size, old_size - new_size);
} else {
rv = unprotect_area(chunk_ptr, new_size);
}
GUARANTEE(rv == 0, "mprotect must succeed");
ci->size = new_size;
return old_size;
}
new_size = page_align_up(new_size - ci->mmaped_size);
if (anon_mmap(chunk_ptr + ci->mmaped_size, new_size) == NULL) {
return 0;
}
ci->mmaped_size += new_size;
ci->size = ci->mmaped_size;
unprotect_area(chunk_ptr, ci->size);
return old_size;
}
示例15: sizeof
int SourceAssembler::find_gp_offset(const char *name) {
#if !ENABLE_THUMB_GP_TABLE
int offset = 256 * sizeof(OopDesc*); // skip the bytecode table
if (ENABLE_DISPATCH_TABLE_PADDING) {
offset += 8 * sizeof(OopDesc*); // 8 extra bytecodes.
}
#else
int offset = 1 * sizeof(OopDesc*); // skip the nop bytecode
#endif
static const GPTemplate gp_templates[] = {
GP_SYMBOLS_DO(DEFINE_GP_POINTER, DEFINE_GP_VALUE)
{NULL, 0, 0, 0}
};
for (const GPTemplate* tmpl = gp_templates; tmpl->name; tmpl++) {
if (jvm_strcmp(name, tmpl->name) == 0) {
return offset;
}
offset += tmpl->size;
GUARANTEE((offset % 4) == 0, "must be word aligned");
}
SHOULD_NOT_REACH_HERE();
return 0;
}