Ejemplo n.º 1
0
Error FDRTraceWriter::visit(FunctionRecord &R) {
  // Write out the data in "field" order, to be endian-aware.
  uint32_t TypeRecordFuncId = uint32_t{R.functionId() & ~uint32_t{0x0Fu << 28}};
  TypeRecordFuncId <<= 3;
  TypeRecordFuncId |= static_cast<uint32_t>(R.recordType());
  TypeRecordFuncId <<= 1;
  TypeRecordFuncId &= ~uint32_t{0x01};
  OS.write(TypeRecordFuncId);
  OS.write(R.delta());
  return Error::success();
}
Ejemplo n.º 2
0
Error TraceExpander::visit(FunctionRecord &R) {
  resetCurrentRecord();
  if (!IgnoringRecords) {
    BaseTSC += R.delta();
    CurrentRecord.Type = R.recordType();
    CurrentRecord.FuncId = R.functionId();
    CurrentRecord.TSC = BaseTSC;
    CurrentRecord.PId = PID;
    CurrentRecord.TId = TID;
    CurrentRecord.CPU = CPUId;
    BuildingRecord = true;
  }
  return Error::success();
}
Ejemplo n.º 3
0
 VariableRecord_Impl::VariableRecord_Impl(const analysis::Variable& variable,
                                          const VariableRecordType& variableRecordType,
                                          FunctionRecord& functionRecord,
                                          int variableVectorIndex,
                                          boost::optional<double> functionCoefficient)
   : ObjectRecord_Impl(functionRecord.projectDatabase(),
                       variable.uuid(),
                       variable.name(),
                       variable.displayName(),
                       variable.description(),
                       variable.versionUUID()),
     m_functionRecordId(functionRecord.id()),
     m_variableVectorIndex(variableVectorIndex),
     m_functionCoefficient(functionCoefficient),
     m_variableRecordType(variableRecordType)
 {}
Ejemplo n.º 4
0
double evaluateSyntaxTree(SyntaxTree **head)
{
	Token t = (*head)->token;
	
	if (t.type == VALUE)
		return t.value.number;
	
	else if (t.type == FUNCTION)
	{
		SyntaxTree *child;
		unsigned int i;
		double value;
		double *argList;
		unsigned int numChildren = (*head)->numChildren;
		const FunctionRecord fn = functionTable[t.value.fnIndex];

		if ((fn.argType == ARGS_FIXED && numChildren != fn.numArgs) || (fn.argType == ARGS_VARIADIC && numChildren < fn.numArgs))
			die("Invalid number of arguments");
		
		argList = calloc(numChildren, sizeof(double));

#ifdef DEBUG
		printf("Function %s has %d children.\n", fn.name, numChildren);
#endif

		for (i = 0, child = (*head)->firstChild; child != NULL; i++, child = child->next)
		{
#ifdef DEBUG
			printf("i = %d, child = %p\n", i, child);
#endif
			argList[i] = evaluateSyntaxTree(&child);
		}

		value = fn.function(numChildren, argList);

		free(argList);

		return value;
	}

	die("Malformed syntax tree");
}
OutputAttributeVariableRecord::OutputAttributeVariableRecord(
    const analysis::OutputAttributeVariable& outputAttributeVariable,
    FunctionRecord& functionRecord,
    int variableVectorIndex,
    boost::optional<double> functionCoefficient)
  : OutputVariableRecord(boost::shared_ptr<detail::OutputAttributeVariableRecord_Impl>(
        new detail::OutputAttributeVariableRecord_Impl(outputAttributeVariable,
                                                       functionRecord,
                                                       variableVectorIndex,
                                                       functionCoefficient)),
        functionRecord.projectDatabase())
{
  BOOST_ASSERT(getImpl<detail::OutputAttributeVariableRecord_Impl>());
}
Ejemplo n.º 6
0
MeasureGroupRecord::MeasureGroupRecord(const analysis::MeasureGroup& measureGroup,
                                       FunctionRecord& functionRecord,
                                       int variableVectorIndex,
                                       boost::optional<double> functionCoefficient)
  : DiscreteVariableRecord(std::shared_ptr<detail::MeasureGroupRecord_Impl>(
        new detail::MeasureGroupRecord_Impl(measureGroup,
                                            functionRecord,
                                            variableVectorIndex,
                                            functionCoefficient)),
        functionRecord.projectDatabase(),
        measureGroup)
{
  OS_ASSERT(getImpl<detail::MeasureGroupRecord_Impl>());

  constructMeasureRecords(measureGroup);
}
RubyContinuousVariableRecord::RubyContinuousVariableRecord(
    const analysis::RubyContinuousVariable& rubyContinuousVariable,
    FunctionRecord& functionRecord,
    int variableVectorIndex,
    boost::optional<double> functionCoefficient)
  : ContinuousVariableRecord(boost::shared_ptr<detail::RubyContinuousVariableRecord_Impl>(
        new detail::RubyContinuousVariableRecord_Impl(rubyContinuousVariable,
                                                      functionRecord,
                                                      variableVectorIndex,
                                                      functionCoefficient)),
        functionRecord.projectDatabase(),
        rubyContinuousVariable)
{
  OS_ASSERT(getImpl<detail::RubyContinuousVariableRecord_Impl>());

  constructRelatedRecords(rubyContinuousVariable);
}
Ejemplo n.º 8
0
bool FunctionRecordFunctionVectorIndexLess::operator()(const FunctionRecord& left,
                                                       const FunctionRecord& right) const
{
  return (left.functionVectorIndex() < right.functionVectorIndex());
}