ICCItem *CMission::GetProperty (const CString &sName)

//	GetProperty
//
//	Returns a property

{
    CCodeChain &CC = g_pUniverse->GetCC();

    if (strEquals(sName, PROPERTY_IS_ACTIVE))
        return CC.CreateBool(IsActive());

    else if (strEquals(sName, PROPERTY_IS_COMPLETED))
        return CC.CreateBool(IsCompleted());

    else if (strEquals(sName, PROPERTY_IS_DEBRIEFED))
        return CC.CreateBool(m_fDebriefed);

    else if (strEquals(sName, PROPERTY_IS_DECLINED))
        return CC.CreateBool(m_fDeclined);

    else if (strEquals(sName, PROPERTY_IS_FAILURE))
        return CC.CreateBool(IsFailure());

    else if (strEquals(sName, PROPERTY_IS_INTRO_SHOWN))
        return CC.CreateBool(m_fIntroShown);

    else if (strEquals(sName, PROPERTY_IS_OPEN))
        return CC.CreateBool(m_iStatus == statusOpen);

    else if (strEquals(sName, PROPERTY_IS_RECORDED))
        return CC.CreateBool(IsRecorded());

    else if (strEquals(sName, PROPERTY_IS_SUCCESS))
        return CC.CreateBool(IsSuccess());

    else if (strEquals(sName, PROPERTY_IS_UNAVAILABLE))
        return CC.CreateBool(IsUnavailable());

    else if (strEquals(sName, PROPERTY_NODE_ID))
        return (m_sNodeID.IsBlank() ? CC.CreateNil() : CC.CreateString(m_sNodeID));

    else if (strEquals(sName, PROPERTY_OWNER_ID))
    {
        if (m_pOwner.GetID() == OBJID_NULL)
            return CC.CreateNil();
        else
            return CC.CreateInteger(m_pOwner.GetID());
    }

    else if (strEquals(sName, PROPERTY_UNID))
        return CC.CreateInteger(m_pType->GetUNID());

    else
        return CSpaceObject::GetProperty(sName);
}
Exemple #2
0
void InlineResult::Report()
{
    // If we weren't actually inlining, user may have suppressed
    // reporting via setReported(). If so, do nothing.
    if (m_Reported)
    {
        return;
    }

    m_Reported = true;

#ifdef DEBUG
    const char* callee = nullptr;

    // Optionally dump the result
    if (VERBOSE)
    {
        const char* format = "INLINER: during '%s' result '%s' reason '%s' for '%s' calling '%s'\n";
        const char* caller = (m_Caller == nullptr) ? "n/a" : m_RootCompiler->eeGetMethodFullName(m_Caller);

        callee = (m_Callee == nullptr) ? "n/a" : m_RootCompiler->eeGetMethodFullName(m_Callee);

        JITDUMP(format, m_Context, ResultString(), ReasonString(), caller, callee);
    }

    // If the inline failed, leave information on the call so we can
    // later recover what observation lead to the failure.
    if (IsFailure() && (m_Call != nullptr))
    {
        // compiler should have revoked candidacy on the call by now
        assert((m_Call->gtFlags & GTF_CALL_INLINE_CANDIDATE) == 0);

        m_Call->gtInlineObservation = m_Policy->GetObservation();
    }

#endif // DEBUG

    // Was the result NEVER? If so we might want to propagate this to
    // the runtime.

    if (IsNever() && m_Policy->PropagateNeverToRuntime())
    {
        // If we know the callee, and if the observation that got us
        // to this Never inline state is something *other* than
        // IS_NOINLINE, then we've uncovered a reason why this method
        // can't ever be inlined. Update the callee method attributes
        // so that future inline attempts for this callee fail faster.

        InlineObservation obs = m_Policy->GetObservation();

        if ((m_Callee != nullptr) && (obs != InlineObservation::CALLEE_IS_NOINLINE))
        {

#ifdef DEBUG

            if (VERBOSE)
            {
                const char* obsString = InlGetObservationString(obs);
                JITDUMP("\nINLINER: Marking %s as NOINLINE because of %s\n", callee, obsString);
            }

#endif  // DEBUG

            COMP_HANDLE comp = m_RootCompiler->info.compCompHnd;
            comp->setMethodAttribs(m_Callee, CORINFO_FLG_BAD_INLINEE);
        }
    }

    if (IsDecided())
    {
        const char* format = "INLINER: during '%s' result '%s' reason '%s'\n";
        JITLOG_THIS(m_RootCompiler, (LL_INFO100000, format, m_Context, ResultString(), ReasonString()));
        COMP_HANDLE comp = m_RootCompiler->info.compCompHnd;
        comp->reportInliningDecision(m_Caller, m_Callee, Result(), ReasonString());
    }
}
Exemple #3
0
ICCItem *CMission::GetProperty (CCodeChainCtx &Ctx, const CString &sName)

//	GetProperty
//
//	Returns a property

	{
	CCodeChain &CC = g_pUniverse->GetCC();

	if (strEquals(sName, PROPERTY_ACCEPTED_ON))
		return (m_fAcceptedByPlayer ? CC.CreateInteger(m_dwAcceptedOn) : CC.CreateNil());

	else if (strEquals(sName, PROPERTY_CAN_BE_DELETED))
		return CC.CreateBool(m_pType->CanBeDeleted());

	else if (strEquals(sName, PROPERTY_DEBRIEFER_ID))
		{
		if (m_pDebriefer.GetID() != OBJID_NULL)
			return CC.CreateInteger(m_pDebriefer.GetID());
		else if (m_pOwner.GetID() != OBJID_NULL)
			return CC.CreateInteger(m_pOwner.GetID());
		else
			return CC.CreateNil();
		}

	else if (strEquals(sName, PROPERTY_FORCE_UNDOCK_AFTER_DEBRIEF))
		return CC.CreateBool(m_pType->ForceUndockAfterDebrief());

	else if (strEquals(sName, PROPERTY_IS_ACTIVE))
		return CC.CreateBool(IsActive());

	else if (strEquals(sName, PROPERTY_IS_COMPLETED))
		return CC.CreateBool(IsCompleted());

	else if (strEquals(sName, PROPERTY_IS_DEBRIEFED))
		return CC.CreateBool(m_fDebriefed);

	else if (strEquals(sName, PROPERTY_IS_DECLINED))
		return CC.CreateBool(m_fDeclined);

	else if (strEquals(sName, PROPERTY_IS_FAILURE))
		return CC.CreateBool(IsFailure());

	else if (strEquals(sName, PROPERTY_IS_INTRO_SHOWN))
		return CC.CreateBool(m_fIntroShown);

	else if (strEquals(sName, PROPERTY_IS_OPEN))
		return CC.CreateBool(m_iStatus == statusOpen);

	else if (strEquals(sName, PROPERTY_IS_RECORDED))
		return CC.CreateBool(IsRecorded());

	else if (strEquals(sName, PROPERTY_IS_SUCCESS))
		return CC.CreateBool(IsSuccess());

	else if (strEquals(sName, PROPERTY_IS_UNAVAILABLE))
		return CC.CreateBool(IsUnavailable());

	else if (strEquals(sName, PROPERTY_NAME))
		return CC.CreateString(m_sTitle);

	else if (strEquals(sName, PROPERTY_NODE_ID))
		return (m_sNodeID.IsBlank() ? CC.CreateNil() : CC.CreateString(m_sNodeID));

	else if (strEquals(sName, PROPERTY_OWNER_ID))
		{
		if (m_pOwner.GetID() == OBJID_NULL)
			return CC.CreateNil();
		else
			return CC.CreateInteger(m_pOwner.GetID());
		}

	else if (strEquals(sName, PROPERTY_SUMMARY))
		return CC.CreateString(m_sInstructions);

	else if (strEquals(sName, PROPERTY_UNID))
		return CC.CreateInteger(m_pType->GetUNID());

	else
		return CSpaceObject::GetProperty(Ctx, sName);
	}