本文整理汇总了C++中Klass::can_inline_allocation方法的典型用法代码示例。如果您正苦于以下问题:C++ Klass::can_inline_allocation方法的具体用法?C++ Klass::can_inline_allocation怎么用?C++ Klass::can_inline_allocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Klass
的用法示例。
在下文中一共展示了Klass::can_inline_allocation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: obj_new
Expr* PrimInliner::obj_new() {
// replace generic allocation primitive by size-specific primitive, if possible
Expr* rcvr = parameter(0);
if (!rcvr->isConstantExpr() || !rcvr->constant()->is_klass()) return NULL;
Klass* klass = klassOop(rcvr->constant())->klass_part(); // class being instantiated
if (klass->oop_is_indexable()) return NULL; // would fail (extremely unlikely)
int size = klass->non_indexable_size(); // size in words
if (klass->can_inline_allocation()) {
// These special compiler primitives only work for memOop klasses
int number_of_instance_variables = size - memOopDesc::header_size();
switch (number_of_instance_variables) {
case 0: _pdesc = primitives::new0(); break;
case 1: _pdesc = primitives::new1(); break;
case 2: _pdesc = primitives::new2(); break;
case 3: _pdesc = primitives::new3(); break;
case 4: _pdesc = primitives::new4(); break;
case 5: _pdesc = primitives::new5(); break;
case 6: _pdesc = primitives::new6(); break;
case 7: _pdesc = primitives::new7(); break;
case 8: _pdesc = primitives::new8(); break;
case 9: _pdesc = primitives::new9(); break;
default: ; // use generic primitives
}
}
Expr* u = genCall(true);
return new KlassExpr(klass->as_klassOop(), u->preg(), u->node());
}