virtual void print_inlining_late(const char* msg) {
   CallNode* call = call_node();
   Compile* C = Compile::current();
   C->print_inlining_assert_ready();
   C->print_inlining(method(), call->jvms()->depth()-1, call->jvms()->bci(), msg);
   C->print_inlining_move_to(this);
   C->print_inlining_update_delayed(this);
 }
 virtual JVMState* generate(JVMState* jvms, Parse* parent_parser) {
   JVMState* new_jvms = LateInlineCallGenerator::generate(jvms, parent_parser);
   if (_input_not_const) {
     // inlining won't be possible so no need to enqueue right now.
     call_node()->set_generator(this);
   } else {
     Compile::current()->add_late_inline(this);
   }
   return new_jvms;
 }
bool LateInlineMHCallGenerator::do_late_inline_check(JVMState* jvms) {

  CallGenerator* cg = for_method_handle_inline(jvms, _caller, method(), _input_not_const);

  if (!_input_not_const) {
    _attempt++;
  }

  if (cg != NULL) {
    assert(!cg->is_late_inline() && cg->is_inline(), "we're doing late inlining");
    _inline_cg = cg;
    Compile::current()->dec_number_of_mh_late_inlines();
    return true;
  }

  call_node()->set_generator(this);
  return false;
}
void LateInlineCallGenerator::do_late_inline() {
  // Can't inline it
  CallStaticJavaNode* call = call_node();
  if (call == NULL || call->outcnt() == 0 ||
      call->in(0) == NULL || call->in(0)->is_top()) {
    return;
  }

  const TypeTuple *r = call->tf()->domain();
  for (int i1 = 0; i1 < method()->arg_size(); i1++) {
    if (call->in(TypeFunc::Parms + i1)->is_top() && r->field_at(TypeFunc::Parms + i1) != Type::HALF) {
      assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing");
      return;
    }
  }

  if (call->in(TypeFunc::Memory)->is_top()) {
    assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing");
    return;
  }

  Compile* C = Compile::current();
  // Remove inlined methods from Compiler's lists.
  if (call->is_macro()) {
    C->remove_macro_node(call);
  }

  // Make a clone of the JVMState that appropriate to use for driving a parse
  JVMState* old_jvms = call->jvms();
  JVMState* jvms = old_jvms->clone_shallow(C);
  uint size = call->req();
  SafePointNode* map = new (C) SafePointNode(size, jvms);
  for (uint i1 = 0; i1 < size; i1++) {
    map->init_req(i1, call->in(i1));
  }

  // Make sure the state is a MergeMem for parsing.
  if (!map->in(TypeFunc::Memory)->is_MergeMem()) {
    Node* mem = MergeMemNode::make(C, map->in(TypeFunc::Memory));
    C->initial_gvn()->set_type_bottom(mem);
    map->set_req(TypeFunc::Memory, mem);
  }

  uint nargs = method()->arg_size();
  // blow away old call arguments
  Node* top = C->top();
  for (uint i1 = 0; i1 < nargs; i1++) {
    map->set_req(TypeFunc::Parms + i1, top);
  }
  jvms->set_map(map);

  // Make enough space in the expression stack to transfer
  // the incoming arguments and return value.
  map->ensure_stack(jvms, jvms->method()->max_stack());
  for (uint i1 = 0; i1 < nargs; i1++) {
    map->set_argument(jvms, i1, call->in(TypeFunc::Parms + i1));
  }

  // This check is done here because for_method_handle_inline() method
  // needs jvms for inlined state.
  if (!do_late_inline_check(jvms)) {
    map->disconnect_inputs(NULL, C);
    return;
  }

  C->print_inlining_insert(this);

  CompileLog* log = C->log();
  if (log != NULL) {
    log->head("late_inline method='%d'", log->identify(method()));
    JVMState* p = jvms;
    while (p != NULL) {
      log->elem("jvms bci='%d' method='%d'", p->bci(), log->identify(p->method()));
      p = p->caller();
    }
    log->tail("late_inline");
  }

  // Setup default node notes to be picked up by the inlining
  Node_Notes* old_nn = C->default_node_notes();
  if (old_nn != NULL) {
    Node_Notes* entry_nn = old_nn->clone(C);
    entry_nn->set_jvms(jvms);
    C->set_default_node_notes(entry_nn);
  }

  // Now perform the inling using the synthesized JVMState
  JVMState* new_jvms = _inline_cg->generate(jvms, NULL);
  if (new_jvms == NULL)  return;  // no change
  if (C->failing())      return;

  // Capture any exceptional control flow
  GraphKit kit(new_jvms);

  // Find the result object
  Node* result = C->top();
  int   result_size = method()->return_type()->size();
  if (result_size != 0 && !kit.stopped()) {
    result = (result_size == 1) ? kit.pop() : kit.pop_pair();
  }

  C->set_has_loops(C->has_loops() || _inline_cg->method()->has_loops());
  C->env()->notice_inlined_method(_inline_cg->method());
  C->set_inlining_progress(true);

  kit.replace_call(call, result);
}
 virtual void print_inlining_late(const char* msg) {
   CallNode* call = call_node();
   Compile* C = Compile::current();
   C->print_inlining_insert(this);
   C->print_inlining(method(), call->jvms()->depth()-1, call->jvms()->bci(), msg);
 }
Example #6
0
void LateInlineCallGenerator::do_late_inline() {
  // Can't inline it
  if (call_node() == NULL || call_node()->outcnt() == 0 ||
      call_node()->in(0) == NULL || call_node()->in(0)->is_top())
    return;

  CallStaticJavaNode* call = call_node();

  // Make a clone of the JVMState that appropriate to use for driving a parse
  Compile* C = Compile::current();
  JVMState* jvms     = call->jvms()->clone_shallow(C);
  uint size = call->req();
  SafePointNode* map = new (C, size) SafePointNode(size, jvms);
  for (uint i1 = 0; i1 < size; i1++) {
    map->init_req(i1, call->in(i1));
  }

  // Make sure the state is a MergeMem for parsing.
  if (!map->in(TypeFunc::Memory)->is_MergeMem()) {
    map->set_req(TypeFunc::Memory, MergeMemNode::make(C, map->in(TypeFunc::Memory)));
  }

  // Make enough space for the expression stack and transfer the incoming arguments
  int nargs    = method()->arg_size();
  jvms->set_map(map);
  map->ensure_stack(jvms, jvms->method()->max_stack());
  if (nargs > 0) {
    for (int i1 = 0; i1 < nargs; i1++) {
      map->set_req(i1 + jvms->argoff(), call->in(TypeFunc::Parms + i1));
    }
  }

  CompileLog* log = C->log();
  if (log != NULL) {
    log->head("late_inline method='%d'", log->identify(method()));
    JVMState* p = jvms;
    while (p != NULL) {
      log->elem("jvms bci='%d' method='%d'", p->bci(), log->identify(p->method()));
      p = p->caller();
    }
    log->tail("late_inline");
  }

  // Setup default node notes to be picked up by the inlining
  Node_Notes* old_nn = C->default_node_notes();
  if (old_nn != NULL) {
    Node_Notes* entry_nn = old_nn->clone(C);
    entry_nn->set_jvms(jvms);
    C->set_default_node_notes(entry_nn);
  }

  // Now perform the inling using the synthesized JVMState
  JVMState* new_jvms = _inline_cg->generate(jvms);
  if (new_jvms == NULL)  return;  // no change
  if (C->failing())      return;

  // Capture any exceptional control flow
  GraphKit kit(new_jvms);

  // Find the result object
  Node* result = C->top();
  int   result_size = method()->return_type()->size();
  if (result_size != 0 && !kit.stopped()) {
    result = (result_size == 1) ? kit.pop() : kit.pop_pair();
  }

  kit.replace_call(call, result);
}
Example #7
0
int context::circle()
{
  char r[200];int last=0;

  mst=0;

  default_queue.node.homedir="d:\\temp\\out";
  while(1){
    if (!bmodeminit()) return 7;
    init_circle(0);

    while(1){
      if (f->cn->p = f->cn->getkey())
        if (f->cn->p->EventType==KEY_EVENT&&f->cn->p->Event.KeyEvent.bKeyDown){
          
          switch(f->cn->p->Event.KeyEvent.uChar.AsciiChar){
            case 'a': case 'A': if (mst==0||mst==3) answer_node();break;
            case 'c': case 'C': if (mst==0) call_node();break;
            case 'r': case 'R': TestDialogItem();break;
            case 'x': 
              if (mst==0&&(f->cn->p->Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED))) return 0;
              break;

          }

          switch(f->cn->p->Event.KeyEvent.wVirtualKeyCode){
            case VK_F1: ShowHelp();break;
            case VK_F2: MakeConfig();break;
            case VK_SPACE: case VK_ESCAPE:
                switch(mst){
                  case 0: time(&yo);if (v.circle>end_time-yo) init_circle(1);break;
                  case 1: stop_call();break;
                  case 2: stop_answer();break;
                  case 3: f->conresult(15,"NO MORE RINGS",0);init_circle(0);break;
                }
                break;
          }
        }
      Sleep(10);
      if (mst!=-1){
        time(&yo);
        if (current!=yo){
          current=yo;
          if (yo>=end_time){
            switch(mst){
              case 0: init_circle(1);break;
              case 1: stop_call();Sleep(400);call_node();break;
              case 2: stop_answer();break;
              case 3: f->conresult(15,"NO MORE RINGS");init_circle(0);break;
            }
            continue;
          }
          int i = end_time - yo;
          sprintf(s,"%02i:%02i",i/60,i%60);
          f->conresult(15,s);
        }
      }
      if (int q=bmodemgetchar()){
        if (q==13||q==10){
          r[last]=0;
          if (last){
            if (checkstring(v.ncarrier+"|"+v.no_dial+"|"+v.busy,r,'|')){
              f->conresult(14,r);
              if (mst==1) Sleep(400),call_node();
                else init_circle(0);
            } else if (v.ring==r){
              if (mst!=3) ringno=0;
              next_ring();
            } else if (!strncmp(r,v.connect,v.connect.GetLength())){
              f->conresult(14,v.connect);
              if (mst==1)
                emsi_connect_out(r,default_queue);
              else 
                emsi_connect_in(r);
              last=0;
              break;
            }
            last=0;
          }
        } else {
          if (last>198) last=0;
          r[last++]=q;
        }
      }
    }
  }
}