Beispiel #1
0
void ExecutionConsumer::Prepare(CompilationContext &compilation_ctx) {
  CodeGen &codegen = compilation_ctx.GetCodeGen();
  QueryState &query_state = compilation_ctx.GetQueryState();
  executor_ctx_type_ = ExecutorContextProxy::GetType(codegen);
  executor_ctx_id_ = query_state.RegisterState(
      "executorContext", executor_ctx_type_->getPointerTo());
}
// Constructor
TableScanTranslator::TableScanTranslator(const planner::SeqScanPlan &scan,
                                         CompilationContext &context,
                                         Pipeline &pipeline)
    : OperatorTranslator(context, pipeline),
      scan_(scan),
      table_(*scan_.GetTable()) {
  LOG_DEBUG("Constructing TableScanTranslator ...");

  // The restriction, if one exists
  const auto *predicate = GetScanPlan().GetPredicate();

  if (predicate != nullptr) {
    // If there is a predicate, prepare a translator for it
    context.Prepare(*predicate);

    // If the scan's predicate is SIMDable, install a boundary at the output
    if (predicate->IsSIMDable()) {
      pipeline.InstallBoundaryAtOutput(this);
    }
  }

  auto &codegen = GetCodeGen();
  auto &runtime_state = context.GetRuntimeState();
  selection_vector_id_ = runtime_state.RegisterState(
      "scanSelVec",
      codegen.VectorType(codegen.Int32Type(), Vector::kDefaultVectorSize),
      true);

  LOG_DEBUG("Finished constructing TableScanTranslator ...");
}
Beispiel #3
0
 virtual void run () {
     CompilationContext* cc = getCompilationContext();
     CompilationInterface* ci = cc->getVMCompilationInterface();
     ci->lockMethodData();
     MethodDesc* methDesc = ci->getMethodToCompile();
     if (methDesc->getCodeBlockSize(0) > 0 || methDesc->getCodeBlockSize(1) > 0){
         cc->setCompilationFinished(true);
         ci->unlockMethodData();
     }
 }
Beispiel #4
0
DeleteTranslator::DeleteTranslator(const planner::DeletePlan &delete_plan,
                                   CompilationContext &context,
                                   Pipeline &pipeline)
    : OperatorTranslator(delete_plan, context, pipeline),
      table_(*delete_plan.GetTable()) {
  pipeline.SetSerial();

  // Also create the translator for our child.
  context.Prepare(*delete_plan.GetChild(0), pipeline);

  // Register the deleter
  deleter_state_id_ = context.GetQueryState().RegisterState(
      "deleter", DeleterProxy::GetType(GetCodeGen()));
}
Beispiel #5
0
// this is the regular routine to be used to generate IR for a method
void TranslatorSession::translate() {
    CompilationContext* cc = getCompilationContext();
    IRManager* irm = cc->getHIRManager();
    assert(irm);
    irm->getTypeManager().setLazyResolutionMode(flags.lazyResolution);
    MethodDesc& methodDesc = irm->getMethodDesc();
    //create IRBuilder
    MemoryManager& mm = cc->getCompilationLevelMemoryManager();
    TranslatorAction* myAction = (TranslatorAction*)getAction();
    IRBuilder* irb = (IRBuilder*)myAction->getIRBuilderAction()->createSession(mm);
    irb->setCompilationContext(cc);
    MemoryManager tmpMM("IRBuilder::tmpMM");
    irb->init(irm, &flags, tmpMM);
    JavaTranslator::translateMethod(*cc->getVMCompilationInterface(), methodDesc, *irb);
}
ExpressionTranslator::ExpressionTranslator(
    const expression::AbstractExpression &expression, CompilationContext &ctx)
    : expression_(expression) {
  if (expression::ExpressionUtil::IsAggregateExpression(
          expression.GetExpressionType()))
    return;
  for (uint32_t i = 0; i < expression_.GetChildrenSize(); i++) {
    ctx.Prepare(*expression_.GetChild(i));
  }
}
Beispiel #7
0
//
// code generator entry point
//
void HIR2LIRSelectorSessionAction::run() {

#if defined(_IPF_)
#else
    CompilationContext* cc = getCompilationContext();
    IRManager& irManager = *cc->getHIRManager();
    CompilationInterface* ci = cc->getVMCompilationInterface();
    MethodDesc* methodDesc  = ci->getMethodToCompile();
    OpndManager& opndManager = irManager.getOpndManager();
    const OptimizerFlags& optFlags = irManager.getOptimizerFlags();
    VarOpnd* varOpnds   = opndManager.getVarOpnds();
    MemoryManager& mm  = cc->getCompilationLevelMemoryManager();

    MethodCodeSelector* mcs = new (mm) _MethodCodeSelector(irManager,methodDesc,varOpnds,&irManager.getFlowGraph(),
        opndManager, optFlags.sink_constants, optFlags.sink_constants1);

    Ia32::CodeGenerator cg;
    cg.genCode(this, *mcs);
#endif
}
// Constructor
TableScanTranslator::TableScanTranslator(const planner::SeqScanPlan &scan,
                                         CompilationContext &context,
                                         Pipeline &pipeline)
    : OperatorTranslator(context, pipeline),
      scan_(scan),
      table_(*scan_.GetTable()) {
  LOG_DEBUG("Constructing TableScanTranslator ...");

  // The restriction, if one exists
  const auto *predicate = GetScanPlan().GetPredicate();
  if (predicate != nullptr) {
    // If there is a predicate, prepare a translator for it
    context.Prepare(*predicate);

    // If the scan's predicate is SIMDable, install a boundary at the output
    if (predicate->IsSIMDable()) {
      pipeline.InstallBoundaryAtOutput(this);
    }
  }
  LOG_DEBUG("Finished constructing TableScanTranslator ...");
}
 TopLevelVariableHandler(CompilationContext& context) :
     VariableHandler<VType>(context, context.precedence())
 {
 } // VariableHandler