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


C++ MethodDesc::getSideEffect方法代码示例

本文整理汇总了C++中MethodDesc::getSideEffect方法的典型用法代码示例。如果您正苦于以下问题:C++ MethodDesc::getSideEffect方法的具体用法?C++ MethodDesc::getSideEffect怎么用?C++ MethodDesc::getSideEffect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MethodDesc的用法示例。


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

示例1: strncmp

/**
 * Checks a callee method side effect.
 * @param inst - method call instruction
 * @return <code>true</code> if method has side effect;
 *         <code>false<code> if method has no side effect.
 */
bool
LazyExceptionOpt::methodCallHasSideEffect(Inst* inst) {
    U_32 opcode = inst->getOpcode();
    MethodDesc* cmd = NULL;
    Method_Side_Effects mse = MSE_Unknown;

    if (opcode==Op_DirectCall || opcode==Op_TauVirtualCall) {
        cmd = inst->asMethodCallInst()->getMethodDesc();
    } else {
        if (opcode==Op_IndirectCall || opcode==Op_IndirectMemoryCall) {
            Type* type = inst->asCallInst()->getFunPtr()->getType();
            if (type->isUnresolvedType()) {
                return true;
            }
            cmd = type->asMethodPtrType()->getMethodDesc();
        } else {
#ifdef _DEBUG
            if (Log::isEnabled()) {
                Log::out() << "    checkMC: no check ";
                inst->print(Log::out());
                Log::out()  << std::endl;
            }
#endif
            return true;
        }
    }
#ifdef _DEBUG
    if (Log::isEnabled()) {
        Log::out() << "    checkMC: ";
        cmd->printFullName(Log::out());
        Log::out() << std::endl;
    }
#endif

    mse = cmd->getSideEffect();
#ifdef _DEBUG
    if (mse != MSE_Unknown) {
        if (Log::isEnabled()) {
            Log::out() << "    checkMC: prev.set sideEff " << mse << "  ";
            inst->print(Log::out());
            Log::out() << std::endl;
        }
    }
#endif
    if (mse == MSE_True) {
        return true;
    }
    if (mse == MSE_False) {
        return false;
    }
//  core api exception init
    if (cmd->isInstanceInitializer() && cmd->getParentType()->isLikelyExceptionType()
            && strncmp(cmd->getParentType()->getName(),"java/lang/",10) == 0) {
        cmd->setSideEffect(MSE_False);
#ifdef _DEBUG
        if (Log::isEnabled()) {
            Log::out() << "    checkMC: core api exc ";
            inst->print(Log::out());
            Log::out() << std::endl;
        }
#endif
        return false;
    }

    if ( opcode!=Op_DirectCall && !cmd->isFinal() ) {
#ifdef _DEBUG
        if (Log::isEnabled()) {
            Log::out() << "    checkMC: not DirCall not final ";
            inst->print(Log::out());
            Log::out() << std::endl;
        }
#endif
        return true;
    }

    if (!isExceptionInit &&
            !(cmd->isInstanceInitializer()&&cmd->getParentType()->isLikelyExceptionType())) {
#ifdef _DEBUG
        if (Log::isEnabled()) {
            Log::out() << "    checkMC: no init ";
            Log::out() << isExceptionInit << " ";
            Log::out() << cmd->isInstanceInitializer() << " ";
            Log::out() << cmd->getParentType()->isLikelyExceptionType() << " ";
            inst->print(Log::out());
            Log::out() << std::endl;
        }
#endif
        return true;
    }

    /*
        if (cmd->getParentType()->needsInitialization()) {
    #ifdef _DEBUG
            if (Log::isEnabled()) {
//.........这里部分代码省略.........
开发者ID:unitedroad,项目名称:harmony-for-haiku,代码行数:101,代码来源:lazyexceptionopt.cpp


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