本文整理汇总了C++中CompiledCode::hard_lock方法的典型用法代码示例。如果您正苦于以下问题:C++ CompiledCode::hard_lock方法的具体用法?C++ CompiledCode::hard_lock怎么用?C++ CompiledCode::hard_lock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompiledCode
的用法示例。
在下文中一共展示了CompiledCode::hard_lock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: internalize
MachineCode* CompiledCode::internalize(STATE, GCToken gct,
const char** reason, int* ip)
{
MachineCode* mcode = machine_code_;
atomic::memory_barrier();
if(mcode) return mcode;
CompiledCode* self = this;
OnStack<1> os(state, self);
self->hard_lock(state, gct);
mcode = self->machine_code_;
if(!mcode) {
{
BytecodeVerification bv(self);
if(!bv.verify(state)) {
if(reason) *reason = bv.failure_reason();
if(ip) *ip = bv.failure_ip();
std::cerr << "Error validating bytecode: " << bv.failure_reason() << "\n";
return 0;
}
}
mcode = new MachineCode(state, self);
if(self->resolve_primitive(state)) {
mcode->fallback = execute;
} else {
mcode->setup_argument_handler();
}
// We need to have an explicit memory barrier here, because we need to
// be sure that mcode is completely initialized before it's set.
// Otherwise another thread might see a partially initialized
// MachineCode.
atomic::write(&self->machine_code_, mcode);
set_executor(mcode->fallback);
}
self->hard_unlock(state, gct);
return mcode;
}