Пример #1
0
oop processOopClass::TWAINS_prim(objVectorOop resultArg, 
                                 bool stepping, oop stop, void *FH) {
  if (SignalInterface::are_self_signals_blocked())
    warning("_TWAINS: signals are blocked (with _BlockSignals)");
  
  Process* proc= TWAINS_receiver_check(FH);
  if (proc == NULL) return NULL;
  if (!TWAINS_result_vector_check( resultArg, FH)) return NULL;
  vframeOop stop_vfo= TWAINS_stop_activation_check(proc, stop, FH);
  if (stop_vfo == vframeOop(badOop)) return NULL;
  if (!TWAINS_parallel_check(FH)) return NULL;

  preemptCause = cNoCause;
  twainsProcess = currentProcess;
  if (PendingSelfSignals::are_any_pending() && !SignalInterface::are_self_signals_blocked()) {
    // return immediately - have unhandled signals
    preemptCause = cSignal;
  }
  else if (proc != twainsProcess) {
    TWAINS_transfer_to_another_process(proc, resultArg, stepping, stop_vfo);
  }
  else {
    TWAINS_await_signal();
  }
  twainsProcess = NULL;
  
  oop res = get_result(resultArg);
  LOG_EVENT3("TWAINS: res = %#lx { %#lx, %#lx, ... }", res,
             resultArg->obj_at(0), resultArg->obj_at(1));
  preemptCause = cNoCause;
  return res;
}
Пример #2
0
void blockOopClass::remap(Map* newMap, frame* newHome) {
  LOG_EVENT3("remapping block %#lx from %#lx/%#lx...",
             this, map(), scope(true));
  LOG_EVENT2("...to %#lx/%#lx", newMap, newHome);
  set_map(newMap);
  setScope(newHome->block_scope_of_home_frame());
  // debugging aid: set block's hash (almost all blocks have an uninitialized
  // hash value, so if a block has a hash it's likely to be a remapped block)
  identity_hash();
}
Пример #3
0
void InterpretedIC::replace(LookupResult result, klassOop receiver_klass) {
  // IC entries before modification - used for loging only
  Bytecodes::Code code_before  = send_code();
  oop             word1_before = first_word();
  oop             word2_before = second_word();
  int             transition   = 0;
  // modify IC
  guarantee(word2_before == receiver_klass, "klass should be the same");
  if (result.is_empty()) {
    clear();
    transition = 1;
  } else if (result.is_method()) {
    if (send_type() == Bytecodes::megamorphic_send) {
      set(send_code(), result.method(), receiver_klass);
      transition = 2;
    } else {
      // Please Fix this Robert
      // implement set_monomorphic(klass, method)
      clear();
      transition = 3;
    }
  } else {
    if (send_type() == Bytecodes::megamorphic_send) {
      set(send_code(), oop(result.entry()), receiver_klass);
      transition = 4;
    } else {
      assert(result.is_entry(), "must be jump table entry");
      // a jump table entry of a nmethod is found so let's update the current send
      set(Bytecodes::compiled_send_code_for(send_code()), oop(result.entry()), receiver_klass);
      transition = 5;
    }
  }
  // IC entries after modification - used for loging only
  Bytecodes::Code code_after  = send_code();
  oop             word1_after = first_word();
  oop             word2_after = second_word();
  // log modification
  LOG_EVENT3("InterpretedIC::replace: IC at 0x%x: entry for klass 0x%x replaced (transition %d)", this, receiver_klass, transition);
  LOG_EVENT3("  from (%s, 0x%x, 0x%x)", Bytecodes::name(code_before), word1_before, word2_before);
  LOG_EVENT3("  to   (%s, 0x%x, 0x%x)", Bytecodes::name(code_after ), word1_after , word2_after );
}
Пример #4
0
void sendDesc::sendMessagePrologue( oop  receiver, frame* lookupFrame ) {
                                   
  NumberOfLookups++;

  assert(receiver != Memory->deadBlockObj, "should have created real block");
  assert(Byte_Map_Base() == Memory->remembered_set->byte_map_base(),
         "byte map base reg corrupted");
  assert(!processSemaphore, "processSemaphore shouldn't be set");

  if (SilentTrace)
    LOG_EVENT3("sendDesc::sendMessage %#lx %#lx %#lx",
               this,
               receiver,
               lookupFrame);
}
Пример #5
0
void InterpretedIC::replace(nmethod* nm) {
  // replace entry with nm's klass by nm (if entry exists)
  smiOop entry_point = smiOop(nm->jump_table_entry()->entry_point());
  assert(selector() == nm->key.selector(), "mismatched selector");
  if (is_empty()) return;

  switch (send_type()) {
    case Bytecodes::accessor_send:    // fall through
    case Bytecodes::primitive_send:   // fall through
    case Bytecodes::predicted_send:   // fall through
    case Bytecodes::interpreted_send:
      { // replace the monomorphic interpreted send with compiled send
        klassOop receiver_klass = klassOop(second_word());
        assert(receiver_klass->is_klass(), "receiver klass must be a klass");
        if (receiver_klass == nm->key.klass()) {
          set(Bytecodes::compiled_send_code_for(send_code()), entry_point, nm->key.klass());
        }
      }
      break;
    case Bytecodes::compiled_send:   // fall through
    case Bytecodes::megamorphic_send:
      // replace the monomorphic compiled send with compiled send
      set(send_code(), entry_point, nm->key.klass());
      break;
    case Bytecodes::polymorphic_send:
      { objArrayOop pic = pic_array();
      for (int index = pic->length(); index > 0; index -= 2) {
        klassOop receiver_klass = klassOop(pic->obj_at(index));
        assert(receiver_klass->is_klass(), "receiver klass must be klass");
        if (receiver_klass == nm->key.klass()) {
          pic->obj_at_put(index-1, entry_point);
          return;
        }
      }
      }
      // did not find klass
      break;
    default: fatal("unknown send type");
  }
  LOG_EVENT3("interpreted IC at 0x%x: new nmethod 0x%x for klass 0x%x replaces old entry", this, nm, nm->key.klass());
}
Пример #6
0
// Handle an OS signal that won't be passed to Self
void SignalInterface::handle_OS_signal(int ossig, char* addr, int32 code) {

  FlagSettingInt fs(errno, 0);  // save errno

  if (eventLog != NULL) // might not exist yet
    LOG_EVENT3("signal %ld pc %#lx npc %#lx",
               ossig, InterruptedContext::the_interrupted_context->pc(), InterruptedContext::the_interrupted_context->next_pc());
            
  # if TARGET_OS_VERSION != MACOSX_VERSION
  assert(!is_off_signal_stack(), "should be on interrupt stack");
  # endif
  // Linux???
  
  if (handle_SIC_OS_signal(ossig, addr, code))
    return;
# if TARGET_OS_VERSION == LINUX_VERSION
  lprintf("\nInternal error: signal %d code %d addr 0x%lx pc 0x%lx.\n",
         (void*)ossig, (void*)code, (void*)(long unsigned)addr,
         (void*)(long unsigned)(InterruptedContext::the_interrupted_context->pc()));
# else
  lprintf("\nInternal error: signal %d (sig%s) code %d addr 0x%lx pc 0x%lx.\n",
         (void*)ossig, (void*)sys_signame[ossig],
         (void*)code, (void*)(long unsigned)addr,
         (void*)(long unsigned)(InterruptedContext::the_interrupted_context->pc()));
# endif
  error_breakpoint();
  if (WizardAbortMode) {
    // for better VM debugging - see regs and stack undisturbed, but
    // printing/traversing Self stack may break
    InterruptedContext::fatal_menu();
  } 
  else {
    // let user print the stack etc; easier to do in user context
    WizardAbortMode = true; // next bit might fail over and over
    InterruptedContext::continue_abort_at(first_inst_addr(InterruptedContext::fatal_menu), true);
    AbortContext.set(InterruptedContext::the_interrupted_context);
  }
}
Пример #7
0
void processOopClass::TWAINS_transfer_to_another_process(
                        Process* proc,
                        objVectorOop& resultArg, 
                        bool stepping,
                        vframeOop stop_vfo) {
                        
  if (proc->hasStack() || proc->allocate()) {
    // transfer to the other process
    preserved pres1(resultArg);
    if (stepping) {
      proc->setSingleStepping();
      preemptCause = cSingleStepped;    // so it isn't overridden by signals
    }
    if (stop_vfo) proc->setStopPoint(stop_vfo);
    LOG_EVENT3("TWAINS: transfer to %#lx %s stop=%#lx", proc, 
           stepping ? "stepping" : "", stop_vfo); 
    proc->transfer();           // run the other process
    resultArg = objVectorOop(pres1.value);
    if (stepping) {
      assert(preemptCause == cSingleStepped ||
         isFatalCause(preemptCause), "wrong preemptCause");
      proc->resetSingleStepping();
    }
    if (proc->stopping) {
      // returned from stopActivation (but could be way past it, e.g.
      // when process was aborted)
      proc->resetStopping();
      if (!isFatalCause(preemptCause)) preemptCause = cFinishedActivation;
    }
    proc->setStopPoint(NULL);
  } else {
    // couldn't allocate stack
    preemptCause= cCouldntAllocateStack;
    proc->state= aborting;
  }
}