Beispiel #1
0
void ciMethodData::print_data_on(outputStream* st) {
  ResourceMark rm;
  ciProfileData* data;
  for (data = first_data(); is_valid(data); data = next_data(data)) {
    st->print("%d", dp_to_di(data->dp()));
    st->fill_to(6);
    data->print_data_on(st);
  }
  st->print_cr("--- Extra data:");
  DataLayout* dp  = data_layout_at(data_size());
  DataLayout* end = data_layout_at(data_size() + extra_data_size());
  for (; dp < end; dp = methodDataOopDesc::next_extra(dp)) {
    if (dp->tag() == DataLayout::no_tag)  continue;
    if (dp->tag() == DataLayout::bit_data_tag) {
      data = new BitData(dp);
    } else {
      assert(dp->tag() == DataLayout::arg_info_data_tag, "must be BitData or ArgInfo");
      data = new ciArgInfoData(dp);
      dp = end; // ArgInfoData is at the end of extra data section.
    }
    st->print("%d", dp_to_di(data->dp()));
    st->fill_to(6);
    data->print_data_on(st);
  }
}
Beispiel #2
0
// Translate a bci to its corresponding data, or NULL.
ciProfileData* ciMethodData::bci_to_data(int bci) {
  ciProfileData* data = data_before(bci);
  for ( ; is_valid(data); data = next_data(data)) {
    if (data->bci() == bci) {
      set_hint_di(dp_to_di(data->dp()));
      return data;
    } else if (data->bci() > bci) {
      break;
    }
  }
  // bci_to_extra_data(bci) ...
  DataLayout* dp  = data_layout_at(data_size());
  DataLayout* end = data_layout_at(data_size() + extra_data_size());
  for (; dp < end; dp = methodDataOopDesc::next_extra(dp)) {
    if (dp->tag() == DataLayout::no_tag) {
      _saw_free_extra_data = true;  // observed an empty slot (common case)
      return NULL;
    }
    if (dp->tag() == DataLayout::arg_info_data_tag) {
      break; // ArgInfoData is at the end of extra data section.
    }
    if (dp->bci() == bci) {
      assert(dp->tag() == DataLayout::bit_data_tag, "sane");
      return new ciBitData(dp);
    }
  }
  return NULL;
}
// Translate a bci to its corresponding data, or NULL.
ciProfileData* ciMethodData::bci_to_data(int bci, ciMethod* m) {
  // If m is not NULL we look for a SpeculativeTrapData entry
  if (m == NULL) {
    ciProfileData* data = data_before(bci);
    for ( ; is_valid(data); data = next_data(data)) {
      if (data->bci() == bci) {
        set_hint_di(dp_to_di(data->dp()));
        return data;
      } else if (data->bci() > bci) {
        break;
      }
    }
  }
  bool two_free_slots = false;
  ciProfileData* result = bci_to_extra_data(bci, m, two_free_slots);
  if (result != NULL) {
    return result;
  }
  if (m != NULL && !two_free_slots) {
    // We were looking for a SpeculativeTrapData entry we didn't
    // find. Room is not available for more SpeculativeTrapData
    // entries, look in the non SpeculativeTrapData entries.
    return bci_to_data(bci, NULL);
  }
  return NULL;
}
Beispiel #4
0
void process_data( const char *data, size_t length )
{
    if( length > 0 ) {

        std::string next_data(data, data + length);

        const size_t old_size = queue_->messages( ).size( );

        /// revert data block
        revertor_->transform( next_data );

        /**
         * message = transformed(<size>data)
         * we must revert data here
        **/

        //queue_->append( &next_data[0], next_data.size( ));

        queue_->append( next_data.empty( ) ? NULL : &next_data[0],
                        next_data.size( ) );
        queue_->process( );

        if( queue_->messages( ).size( ) > old_size ) {
            parent_->on_data_ready( );
        }
    }
}
Beispiel #5
0
void methodDataOopDesc::print_data_on(outputStream* st) {
  ResourceMark rm;
  ProfileData* data = first_data();
  for ( ; is_valid(data); data = next_data(data)) {
    st->print("%d", dp_to_di(data->dp()));
    st->fill_to(6);
    data->print_data_on(st);
  }
  st->print_cr("--- Extra data:");
  DataLayout* dp    = extra_data_base();
  DataLayout* end   = extra_data_limit();
  for (; dp < end; dp = next_extra(dp)) {
    // No need for "OrderAccess::load_acquire" ops,
    // since the data structure is monotonic.
    if (dp->tag() == DataLayout::no_tag)  continue;
    if (dp->tag() == DataLayout::bit_data_tag) {
      data = new BitData(dp);
    } else {
      assert(dp->tag() == DataLayout::arg_info_data_tag, "must be BitData or ArgInfo");
      data = new ArgInfoData(dp);
      dp = end; // ArgInfoData is at the end of extra data section.
    }
    st->print("%d", dp_to_di(data->dp()));
    st->fill_to(6);
    data->print_data_on(st);
  }
}
void ciMethodData::print_data_on(outputStream* st) {
  ResourceMark rm;
  ciProfileData* data;
  for (data = first_data(); is_valid(data); data = next_data(data)) {
    st->print("%d", dp_to_di(data->dp()));
    st->fill_to(6);
    data->print_data_on(st);
  }
}
Beispiel #7
0
// Give each of the data entries a chance to perform specific
// data initialization.
void methodDataOopDesc::post_initialize(BytecodeStream* stream) {
  ResourceMark rm;
  ProfileData* data;
  for (data = first_data(); is_valid(data); data = next_data(data)) {
    stream->set_start(data->bci());
    stream->next();
    data->post_initialize(stream, this);
  }
}
void ciMethodData::load_data() {
  MethodData* mdo = get_MethodData();
  if (mdo == NULL) {
    return;
  }

  // To do: don't copy the data if it is not "ripe" -- require a minimum #
  // of invocations.

  // Snapshot the data -- actually, take an approximate snapshot of
  // the data.  Any concurrently executing threads may be changing the
  // data as we copy it.
  Copy::disjoint_words((HeapWord*) mdo,
                       (HeapWord*) &_orig,
                       sizeof(_orig) / HeapWordSize);
  Arena* arena = CURRENT_ENV->arena();
  _data_size = mdo->data_size();
  _extra_data_size = mdo->extra_data_size();
  int total_size = _data_size + _extra_data_size;
  _data = (intptr_t *) arena->Amalloc(total_size);
  Copy::disjoint_words((HeapWord*) mdo->data_base(), (HeapWord*) _data, total_size / HeapWordSize);

  // Traverse the profile data, translating any oops into their
  // ci equivalents.
  ResourceMark rm;
  ciProfileData* ci_data = first_data();
  ProfileData* data = mdo->first_data();
  while (is_valid(ci_data)) {
    ci_data->translate_from(data);
    ci_data = next_data(ci_data);
    data = mdo->next_data(data);
  }
  if (mdo->parameters_type_data() != NULL) {
    _parameters = data_layout_at(mdo->parameters_type_data_di());
    ciParametersTypeData* parameters = new ciParametersTypeData(_parameters);
    parameters->translate_from(mdo->parameters_type_data());
  }

  load_extra_data();

  // Note:  Extra data are all BitData, and do not need translation.
  _current_mileage = MethodData::mileage_of(mdo->method());
  _invocation_counter = mdo->invocation_count();
  _backedge_counter = mdo->backedge_count();
  _state = mdo->is_mature()? mature_state: immature_state;

  _eflags = mdo->eflags();
  _arg_local = mdo->arg_local();
  _arg_stack = mdo->arg_stack();
  _arg_returned  = mdo->arg_returned();
#ifndef PRODUCT
  if (ReplayCompiles) {
    ciReplay::initialize(this);
  }
#endif
}
Beispiel #9
0
// Translate a bci to its corresponding data, or NULL.
ProfileData* methodDataOopDesc::bci_to_data(int bci) {
  ProfileData* data = data_before(bci);
  for ( ; is_valid(data); data = next_data(data)) {
    if (data->bci() == bci) {
      set_hint_di(dp_to_di(data->dp()));
      return data;
    } else if (data->bci() > bci) {
      break;
    }
  }
  return bci_to_extra_data(bci, false);
}
Beispiel #10
0
// Translate a bci to its corresponding data index (di).
address methodDataOopDesc::bci_to_dp(int bci) {
  ResourceMark rm;
  ProfileData* data = data_before(bci);
  ProfileData* prev = NULL;
  for ( ; is_valid(data); data = next_data(data)) {
    if (data->bci() >= bci) {
      if (data->bci() == bci)  set_hint_di(dp_to_di(data->dp()));
      else if (prev != NULL)   set_hint_di(dp_to_di(prev->dp()));
      return data->dp();
    }
    prev = data;
  }
  return (address)limit_data_position();
}
Beispiel #11
0
void ciMethodData::load_data() {
  methodDataOop mdo = get_methodDataOop();
  if (mdo == NULL) return;

  // To do: don't copy the data if it is not "ripe" -- require a minimum #
  // of invocations.

  // Snapshot the data -- actually, take an approximate snapshot of
  // the data.  Any concurrently executing threads may be changing the
  // data as we copy it.
  int skip_header = oopDesc::header_size();
  Copy::disjoint_words((HeapWord*) mdo              + skip_header,
                       (HeapWord*) &_orig           + skip_header,
                       sizeof(_orig) / HeapWordSize - skip_header);
  DEBUG_ONLY(*_orig.adr_method() = NULL);  // no dangling oops, please
  Arena* arena = CURRENT_ENV->arena();
  _data_size = mdo->data_size();
  _extra_data_size = mdo->extra_data_size();
  int total_size = _data_size + _extra_data_size;
  _data = (intptr_t *) arena->Amalloc(total_size);
  Copy::disjoint_words((HeapWord*) mdo->data_base(), (HeapWord*) _data, total_size / HeapWordSize);

  // Traverse the profile data, translating any oops into their
  // ci equivalents.
  ResourceMark rm;
  ciProfileData* ci_data = first_data();
  ProfileData* data = mdo->first_data();
  while (is_valid(ci_data)) {
    ci_data->translate_from(data);
    ci_data = next_data(ci_data);
    data = mdo->next_data(data);
  }
  // Note:  Extra data are all BitData, and do not need translation.
  _current_mileage = methodDataOopDesc::mileage_of(mdo->method());
  _state = mdo->is_mature()? mature_state: immature_state;

  _eflags = mdo->eflags();
  _arg_local = mdo->arg_local();
  _arg_stack = mdo->arg_stack();
  _arg_returned  = mdo->arg_returned();
}
void ciMethodData::print_data_on(outputStream* st) {
  ResourceMark rm;
  ciParametersTypeData* parameters = parameters_type_data();
  if (parameters != NULL) {
    parameters->print_data_on(st);
  }
  ciProfileData* data;
  for (data = first_data(); is_valid(data); data = next_data(data)) {
    st->print("%d", dp_to_di(data->dp()));
    st->fill_to(6);
    data->print_data_on(st);
  }
  st->print_cr("--- Extra data:");
  DataLayout* dp  = extra_data_base();
  DataLayout* end = args_data_limit();
  for (;; dp = MethodData::next_extra(dp)) {
    assert(dp < end, "moved past end of extra data");
    switch (dp->tag()) {
    case DataLayout::no_tag:
      continue;
    case DataLayout::bit_data_tag:
      data = new BitData(dp);
      break;
    case DataLayout::arg_info_data_tag:
      data = new ciArgInfoData(dp);
      dp = end; // ArgInfoData is at the end of extra data section.
      break;
    case DataLayout::speculative_trap_data_tag:
      data = new ciSpeculativeTrapData(dp);
      break;
    default:
      fatal(err_msg("unexpected tag %d", dp->tag()));
    }
    st->print("%d", dp_to_di(data->dp()));
    st->fill_to(6);
    data->print_data_on(st);
    if (dp >= end) return;
  }
}
void methodDataOopDesc::print_data_on(outputStream* st) {
  ResourceMark rm;
  ProfileData* data = first_data();
  for ( ; is_valid(data); data = next_data(data)) {
    st->print("%d", dp_to_di(data->dp()));
    st->fill_to(6);
    data->print_data_on(st);
  }
  DataLayout* dp    = extra_data_base();
  DataLayout* end   = extra_data_limit();
  for (; dp < end; dp = next_extra(dp)) {
    // No need for "OrderAccess::load_acquire" ops,
    // since the data structure is monotonic.
    if (dp->tag() == DataLayout::no_tag)  break;
    if (dp == extra_data_base())
      st->print_cr("--- Extra data:");
    data = new BitData(dp);
    st->print("%d", dp_to_di(data->dp()));
    st->fill_to(6);
    data->print_data_on(st);
  }
}
Beispiel #14
0
int next_imps(unsigned short *impbuf, int buflen, long timelen)
{
  static int toput;
  static int bitrem;
  static dbyte dirpulse;
  unsigned short *impbufend, *impbufstart;
  
  impbufstart = impbuf;
  impbufend = impbuf + buflen;
  
  while(impbuf < impbufend - 1 && timelen > 0) {
    switch(playstate) {
      
    case PL_PAUSE:
      if(currlev && lead_pause) {
    PULSE(IMP_1MS);
    lead_pause --;
      }
      else if(lead_pause > 10) {
    if(tapeopt.blanknoise && !(rb->rand() % 64)) 
      DPULSE(IMP_1MS * 10 - 1000, 1000); 
    else 
      DPULSE(IMP_1MS * 10, 0);
    lead_pause -= 10;
      }
      else if(lead_pause) {
    DPULSE(IMP_1MS, 0);
    lead_pause --;
      }
      else {
    if(tf_cseg.num || tf_cseg.sync1p || tf_cseg.sync2p ||
       tf_cseg.ptr != tf_cseg.len) finished = 0;

    switch (tf_cseg.type) {
    case ST_NORM: playstate = PL_LEADER; break;
    case ST_DIRE: playstate = PL_DIRE;   dirpulse = 0; break;
    case ST_PSEQ: playstate = PL_PSEQ;   break;
    default:      playstate = PL_NONE;
    }
      }
      break;

    case PL_LEADER:
      if(tf_cseg.num >= 2) {
    DPULSE(tf_cseg.pulse, tf_cseg.pulse);
    tf_cseg.num -= 2;
      }
      else
      if(tf_cseg.num) {
    PULSE(tf_cseg.pulse);
    tf_cseg.num --;
      }
      else { /* PL_SYNC */
    if(tf_cseg.sync1p || tf_cseg.sync2p) 
      DPULSE(tf_cseg.sync1p, tf_cseg.sync2p);
    bitrem = 0;
    playstate = PL_DATA;
      }
      break;
      
    case PL_DATA:
      if(!bitrem) {
    toput = next_data();
    if(toput < 0) {
      playstate = PL_END;
      break;
    }
    if(tf_cseg.ptr != tf_cseg.len) {
      if(timelen > 16 * max(tf_cseg.onep, tf_cseg.zerop) && 
         impbuf <= impbufend - 16) {
        int p1, p2, br, tp;
        
        p1 = tf_cseg.onep;
        p2 = tf_cseg.zerop;
        br = 8;
        tp = toput;
        
        while(br) {
          if(tp & 0x80) DPULSE(p1, p1);
          else          DPULSE(p2, p2);
          br--;
          tp <<= 1;
        }
        bitrem = 0;
        break;
      }
      bitrem = 8;
    }
    else {
      bitrem = tf_cseg.bused;
      if(!bitrem) break;
    }
      }
      if(toput & 0x80) DPULSE(tf_cseg.onep, tf_cseg.onep);
      else             DPULSE(tf_cseg.zerop, tf_cseg.zerop);
      bitrem--, toput <<= 1;
      break;

    case PL_PSEQ:
      {
    int b1, b2;
    dbyte pulse1, pulse2;
    b1 = next_data();
    b2 = next_data();
    if(b1 < 0 || b2 < 0) {
      playstate = PL_END;
      break;
    }
    pulse1 = b1 + (b2 << 8);

    b1 = next_data();
    b2 = next_data();
    if(b1 < 0 || b2 < 0) {
      PULSE(pulse1);
      playstate = PL_END;
      break;
    }
    pulse2 = b1 + (b2 << 8);
    DPULSE(pulse1, pulse2);
      }
      break;

    case PL_DIRE:
      for(;;) {
    if(!bitrem) {
      toput = next_data();
      if(toput < 0) {
        playstate = PL_END;
        DPULSE(dirpulse, 0);
        break;
      }
      if(tf_cseg.ptr != tf_cseg.len) bitrem = 8;
      else {
        bitrem = tf_cseg.bused;
        if(!bitrem) break;
      }
    }
    bitrem--;
    toput <<= 1;
    if(((toput & 0x0100) ^ (currlev ? 0x0100 : 0x00))) {
      PULSE(dirpulse);
      dirpulse = tf_cseg.pulse;
      break;
    }
    dirpulse += tf_cseg.pulse;
    if(dirpulse >= 0x8000) {
      DPULSE(dirpulse, 0);
      dirpulse = 0;
      break;
    }
      }
      break;

    case PL_END:
      if(tf_cseg.pause) {
    PULSE(IMP_1MS);
    tf_cseg.pause--;
    if(currlev) PULSE(0);
    finished = 1;
      }
      playstate = PL_NONE;
      break;
      
    case PL_NONE:
    default:
      return PTRDIFF(impbuf, impbufstart);
    }
  }

  return PTRDIFF(impbuf, impbufstart);
}
Beispiel #15
0
int next_byte(void)
{
  playstate = PL_NONE;
  return next_data();
}
Beispiel #16
0
static int interpret_tzx_header(byte *hb, struct seginfo *csp)
{
  int res;
  int segid;
  byte *hip;
  int offs;
  dbyte dtmp;

  segid = hb[0];
  hip = hb+1;
  
  switch(segid) {
  case 0x10:
    normal_segment(csp);
    csp->pause   = DBYTE(hip, 0x00);
    break;
    
  case 0x11:
    rb->snprintf(seg_desc,DESC_LEN, "Turbo Data");
    csp->type    = ST_NORM;
    csp->segtype = SEG_DATA_TURBO;
    csp->pulse   = DBYTE(hip, 0x00);
    csp->sync1p  = DBYTE(hip, 0x02);
    csp->sync2p  = DBYTE(hip, 0x04);
    csp->zerop   = DBYTE(hip, 0x06);
    csp->onep    = DBYTE(hip, 0x08);
    csp->num     = DBYTE(hip, 0x0A);
    csp->bused   = BYTE(hip, 0x0C);
    csp->pause   = DBYTE(hip, 0x0D);
    break;
    
  case 0x12:
    rb->snprintf(seg_desc,DESC_LEN, "Pure Tone");
    csp->type    = ST_NORM;
    csp->segtype = SEG_OTHER;
    csp->pulse   = DBYTE(hip, 0x00);
    csp->num     = DBYTE(hip, 0x02);
    csp->sync1p  = 0;
    csp->sync2p  = 0;
    csp->zerop   = 0;
    csp->onep    = 0;
    csp->bused   = 0;
    csp->pause   = 0;
    break;
    
  case 0x13:
    rb->snprintf(seg_desc,DESC_LEN, "Pulse Sequence");
    csp->type    = ST_PSEQ;
    csp->segtype = SEG_OTHER;
    csp->pause   = 0;
    break;
    
  case 0x14:
    rb->snprintf(seg_desc,DESC_LEN, "Pure Data");
    csp->type    = ST_NORM;
    csp->segtype = SEG_DATA_PURE;
    csp->zerop   = DBYTE(hip, 0x00);
    csp->onep    = DBYTE(hip, 0x02);
    csp->bused   = BYTE(hip, 0x04);
    csp->pause   = DBYTE(hip, 0x05);
    csp->pulse   = 0;
    csp->num     = 0;
    csp->sync1p  = 0;
    csp->sync2p  = 0;
    break;
    
  case 0x15:
    rb->snprintf(seg_desc,DESC_LEN, "Direct Recording");
    csp->type    = ST_DIRE;
    csp->segtype = SEG_OTHER; 
    csp->pulse   = DBYTE(hip, 0x00);
    csp->pause   = DBYTE(hip, 0x02);
    csp->bused   = BYTE(hip, 0x04);
    break;
    
  case 0x20:
    dtmp = DBYTE(hip, 0x00);
    if(dtmp == 0) {
      if(!tapeopt.stoppause) {
    csp->type = ST_MISC;
    csp->segtype = SEG_STOP;
      }
      else {
    csp->pause = tapeopt.stoppause * 1000;
    csp->type = ST_NORM;
    csp->segtype = SEG_PAUSE;
      }
      rb->snprintf(seg_desc,DESC_LEN, "Stop the Tape Mark");
    }
    else {
      csp->pause = dtmp;
      csp->type = ST_NORM;
      csp->segtype = SEG_PAUSE;
      rb->snprintf(seg_desc,DESC_LEN, "Pause for %i.%03is", 
          csp->pause / 1000, csp->pause % 1000);
    }
    csp->pulse   = 0;
    csp->num     = 0;
    csp->sync1p  = 0;
    csp->sync2p  = 0;
    csp->zerop   = 0;
    csp->onep    = 0;
    csp->bused   = 0;
    break;
    
  case 0x21:
    csp->type    = ST_MISC;
    csp->segtype = SEG_GRP_BEG;
    res = readbuf(rbuf, csp->len, tapefd);
    if(res != (int) csp->len) {
      premature(csp);
      return 0;
    }
    csp->ptr += csp->len;
    {
      int blen;
      rb->snprintf(seg_desc,DESC_LEN, "Begin Group: ");
      blen = (int) rb->strlen(seg_desc);
      rb->strlcpy(seg_desc+blen, (char *) rbuf, (unsigned) csp->len + 1);
    }
    break;

  case 0x22:
    rb->snprintf(seg_desc,DESC_LEN, "End Group");
    csp->type    = ST_MISC;
    csp->segtype = SEG_GRP_END;
    break;

  case 0x23:
    offs = (signed short) DBYTE(hip, 0x00);
    if(offs == 0) {
      rb->snprintf(seg_desc,DESC_LEN, "Infinite loop");
      csp->type = ST_MISC;
      csp->segtype = SEG_STOP;
    }
    else {
      csp->type = ST_MISC;
      csp->segtype = SEG_SKIP;
      rb->snprintf(seg_desc,DESC_LEN, "Jump to %i", segi+offs);
      jump_to_segment(segi + offs, csp);
    }
    break;

  case 0x24:
    loopctr = DBYTE(hip, 0x00);
    rb->snprintf(seg_desc,DESC_LEN, "Loop %i times", loopctr);
    loopbeg = segi+1;
    csp->type    = ST_MISC;
    csp->segtype = SEG_SKIP;
    break;

  case 0x25:
    csp->type    = ST_MISC;
    csp->segtype = SEG_SKIP;
    if(loopctr) loopctr--;
    if(loopctr) {
      jump_to_segment(loopbeg, csp);
      rb->snprintf(seg_desc,DESC_LEN, "Loop to: %i", loopbeg);
    }
    else rb->snprintf(seg_desc,DESC_LEN, "Loop End");
    break;

  case 0x26:
    csp->type    = ST_MISC;
    csp->segtype = SEG_SKIP;
    dtmp = DBYTE(hip, 0x00);
    if(callctr < dtmp) {
      int offset;
      callbeg = segi;
      /*fseek(tapefp, callctr*2, SEEK_CUR);*/
      rb->lseek(tapefd, callctr*2, SEEK_CUR);
      csp->ptr += callctr*2;
      res = readbuf(rbuf, 2, tapefd);
      if(res != 2) {
    premature(csp);
    return 0;
      }
      csp->ptr += 2;
      offset = (signed short) DBYTE(rbuf, 0x00);
      rb->snprintf(seg_desc,DESC_LEN, "Call to %i", segi+offset);
      jump_to_segment(segi+offset, csp);
      callctr++;
    }
    else {
      callctr = 0;
      rb->snprintf(seg_desc,DESC_LEN, "Call Sequence End");
    }
    break;

  case 0x27:
    csp->type    = ST_MISC;
    csp->segtype = SEG_SKIP;
    rb->snprintf(seg_desc,DESC_LEN, "Return");
    if(callctr > 0) jump_to_segment(callbeg, csp);
    break;

  case 0x28:
    rb->snprintf(seg_desc,DESC_LEN, "Selection (Not yet supported)");
    csp->type    = ST_MISC;
    csp->segtype = SEG_SKIP;
    break;

  case 0x2A:
    if(tapeopt.machine == MACHINE_48) { 
      rb->snprintf(seg_desc,DESC_LEN, "Stop the Tape in 48k Mode (Stopped)");
      csp->type = ST_MISC;
      csp->segtype = SEG_STOP;
    }
    else {
      rb->snprintf(seg_desc,DESC_LEN, "Stop the Tape in 48k Mode (Not Stopped)");
      csp->type = ST_MISC;
      csp->segtype = SEG_SKIP;
    }
    break;

  case 0x31:
  case 0x30:
    csp->type    = ST_MISC;
    csp->segtype = SEG_SKIP;
    res = readbuf(rbuf, csp->len, tapefd);
    if(res != (int) csp->len) {
      premature(csp);
      return 0;
    }
    csp->ptr += csp->len;
    rb->strlcpy(seg_desc, (char *) rbuf, (unsigned) csp->len + 1);
    break;

  case 0x32:
    csp->type    = ST_MISC;
    csp->segtype = SEG_SKIP;
    {
      int numstr, i;
      
      i = 0;
      numstr = next_data();
      for(;numstr > 0; numstr--) {
    int tlen, tid, b;

    tid = next_data();
    tlen = next_data();
    if(tid < 0 || tlen < 0) return 0;
    
    for(; tlen; tlen--) {
      b = next_data();
      if(b < 0) return 0;
      seg_desc[i++] = b;
    }
    seg_desc[i++] = '\n';
      }
      seg_desc[i] = '\0';
    }
    break;
    
  case 0x33:
    rb->snprintf(seg_desc,DESC_LEN, "Hardware Information (Not yet supported)");
    csp->type    = ST_MISC;
    csp->segtype = SEG_SKIP;
    break;

  case 0x34:
    rb->snprintf(seg_desc, DESC_LEN,"Emulation Information (Not yet supported)");
    csp->type    = ST_MISC;
    csp->segtype = SEG_SKIP;
    break;

  case 0x35:
    rb->snprintf(seg_desc,DESC_LEN, "Custom Information (Not yet supported)");
    csp->type    = ST_MISC;
    csp->segtype = SEG_SKIP;
    break;

  case 0x40:
    rb->snprintf(seg_desc, DESC_LEN,"Snapshot (Not yet supported)");
    csp->type    = ST_MISC;
    csp->segtype = SEG_SKIP;
    break;

  case 0x5A:
    rb->snprintf(seg_desc, DESC_LEN,"Tapefile Concatenation Point");
    csp->type    = ST_MISC;
    csp->segtype = SEG_SKIP;
    
  default:
    csp->type    = ST_MISC;
    csp->segtype = SEG_SKIP;
    rb->snprintf(seg_desc,DESC_LEN, "Unknown TZX block (id: %02X, version: %i.%02i)", 
        segid, tf_tpi.tzxmajver, tf_tpi.tzxminver);
    break;
  }

  return 1;
}
 static void xact_out(usb_addr_t addr, usb_endp_t endpoint, uint8_t *data, uint16_t len)
 {
     send_token(PID_OUT, addr, endpoint);
     send_data(next_data(), data, len);
     recv_handshake();
 }
Beispiel #18
0
/* "mutate" function for struct mc_class. */
static void
sparse_xarray_mc_mutate (struct mc *mc, const void *ots_)
{
  struct test_params *params = mc_get_aux (mc);
  size_t n_columns = params->n_columns;
  const struct test_state *ots = ots_;
  struct test_model otm;
  int i;

  test_model_extract (params, ots, &otm);
  for (i = 0; i < params->n_xarrays; i++)
    {
      unsigned char value;
      int row, col, n, src, dst;

      /* Write all possible values to each possible single cell. */
      if (params->write_cells)
        for (row = 0; row < params->max_rows; row++)
          for (col = 0; col < n_columns; col++)
            for (value = 0; value < params->n_values; value++)
              if (mc_include_state (mc))
                {
                  struct test_state *ts = test_state_clone (params, ots);
                  struct sparse_xarray *sx = ts->xarrays[i];
                  struct test_model tm = otm;
                  struct xarray_model *model = &tm.models[i];

                  mc_name_operation (mc, "xarray %d: set (%d,%d) to %d",
                                     i, row, col, value);
                  if (!sparse_xarray_write (sx, row, col, 1, &value))
                    NOT_REACHED ();
                  model->data[row][col] = value;
                  model->contains_row[row] = true;
                  check_state (mc, ts, &tm);
                }

      /* Write all possible row contents to each row. */
      if (params->write_rows)
        for (row = 0; row < params->max_rows; row++)
          {
            struct test_model tm = otm;
            struct xarray_model *model = &tm.models[i];

            memset (model->data[row], 0, n_columns);
            model->contains_row[row] = true;
            do
              {
                if (mc_include_state (mc))
                  {
                    struct test_state *ts = test_state_clone (params, ots);
                    struct sparse_xarray *sx = ts->xarrays[i];
                    char row_string[MAX_COLS + 1];

                    mc_name_operation (mc, "xarray %d: set row %d to %s",
                                       i, row, row_string);
                    for (col = 0; col < n_columns; col++)
                      {
                        value = model->data[row][col];
                        row_string[col] = value < 10 ? '0' + value : '*';
                      }
                    row_string[n_columns] = '\0';
                    if (!sparse_xarray_write (sx, row, 0, n_columns,
                                              model->data[row]))
                      NOT_REACHED ();
                    check_state (mc, ts, &tm);
                  }
              }
            while (next_data (model->data[row], n_columns, params->n_values));
          }

      /* Write all possible values to each possible column. */
      if (params->write_columns)
        for (col = 0; col < n_columns; col++)
          for (value = 0; value < params->n_values; value++)
            if (mc_include_state (mc))
              {
                struct test_state *ts = test_state_clone (params, ots);
                struct sparse_xarray *sx = ts->xarrays[i];
                struct test_model tm = otm;
                struct xarray_model *model = &tm.models[i];

                mc_name_operation (mc, "xarray %d: write value %d to "
                                   "column %d", i, value, col);
                if (!sparse_xarray_write_columns (sx, col, 1, &value))
                  NOT_REACHED ();
                for (row = 0; row < params->max_rows; row++)
                  model->data[row][col] = value;
                check_state (mc, ts, &tm);
              }

      /* Copy all possible column ranges within a single sparse_xarray. */
      if (params->copy_within_xarray)
        for (n = 1; n <= n_columns; n++)
          for (src = 0; src <= n_columns - n; src++)
            for (dst = 0; dst <= n_columns - n; dst++)
              if (mc_include_state (mc))
                {
                  struct copy_columns_params copy_aux;
                  struct test_state *ts = test_state_clone (params, ots);
                  struct sparse_xarray *sx = ts->xarrays[i];
                  struct test_model tm = otm;
                  struct xarray_model *model = &tm.models[i];

                  mc_name_operation (mc, "xarray %d: copy %d columns from "
                                     "offset %d to offset %d", i, n, src, dst);

                  copy_aux.n = n;
                  copy_aux.src = src;
                  copy_aux.dst = dst;
                  if (!sparse_xarray_copy (sx, sx, copy_columns, &copy_aux))
                    NOT_REACHED ();

                  for (row = 0; row < params->max_rows; row++)
                    memmove (&model->data[row][dst],
                             &model->data[row][src], n);

                  check_state (mc, ts, &tm);
                }
    }

  if (params->n_xarrays == 2)
    {
      int row, n, src, dst;

      /* Copy all possible column ranges from xarrays[0] to xarrays[1]. */
      for (n = 1; n <= n_columns; n++)
        for (src = 0; src <= n_columns - n; src++)
          for (dst = 0; dst <= n_columns - n; dst++)
            if (mc_include_state (mc))
              {
                struct copy_columns_params copy_aux;
                struct test_state *ts = test_state_clone (params, ots);
                struct test_model tm = otm;

                mc_name_operation (mc, "copy %d columns from offset %d in "
                                   "xarray 0 to offset %d in xarray 1",
                                   n, src, dst);

                copy_aux.n = n;
                copy_aux.src = src;
                copy_aux.dst = dst;
                if (!sparse_xarray_copy (ts->xarrays[0], ts->xarrays[1],
                                         copy_columns, &copy_aux))
                  NOT_REACHED ();

                for (row = 0; row < params->max_rows; row++)
                  {
                    if (tm.models[0].contains_row[row])
                      tm.models[1].contains_row[row] = true;
                    memmove (&tm.models[1].data[row][dst],
                             &tm.models[0].data[row][src], n);
                  }

                check_state (mc, ts, &tm);
              }
    }
}
void ciMethodData::dump_replay_data(outputStream* out) {
  ResourceMark rm;
  MethodData* mdo = get_MethodData();
  Method* method = mdo->method();
  Klass* holder = method->method_holder();
  out->print("ciMethodData %s %s %s %d %d",
             holder->name()->as_quoted_ascii(),
             method->name()->as_quoted_ascii(),
             method->signature()->as_quoted_ascii(),
             _state,
             current_mileage());

  // dump the contents of the MDO header as raw data
  unsigned char* orig = (unsigned char*)&_orig;
  int length = sizeof(_orig);
  out->print(" orig %d", length);
  for (int i = 0; i < length; i++) {
    out->print(" %d", orig[i]);
  }

  // dump the MDO data as raw data
  int elements = (data_size() + extra_data_size()) / sizeof(intptr_t);
  out->print(" data %d", elements);
  for (int i = 0; i < elements; i++) {
    // We could use INTPTR_FORMAT here but that's a zero justified
    // which makes comparing it with the SA version of this output
    // harder.
#ifdef _LP64
    out->print(" 0x%" FORMAT64_MODIFIER "x", data()[i]);
#else
    out->print(" 0x%x", data()[i]);
#endif
  }

  // The MDO contained oop references as ciObjects, so scan for those
  // and emit pairs of offset and klass name so that they can be
  // reconstructed at runtime.  The first round counts the number of
  // oop references and the second actually emits them.
  ciParametersTypeData* parameters = parameters_type_data();
  for (int count = 0, round = 0; round < 2; round++) {
    if (round == 1) out->print(" oops %d", count);
    ProfileData* pdata = first_data();
    for ( ; is_valid(pdata); pdata = next_data(pdata)) {
      if (pdata->is_VirtualCallData()) {
        ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
        dump_replay_data_receiver_type_helper<ciVirtualCallData>(out, round, count, vdata);
        if (pdata->is_VirtualCallTypeData()) {
          ciVirtualCallTypeData* call_type_data = (ciVirtualCallTypeData*)pdata;
          dump_replay_data_call_type_helper<ciVirtualCallTypeData>(out, round, count, call_type_data);
        }
      } else if (pdata->is_ReceiverTypeData()) {
        ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
        dump_replay_data_receiver_type_helper<ciReceiverTypeData>(out, round, count, vdata);
      } else if (pdata->is_CallTypeData()) {
          ciCallTypeData* call_type_data = (ciCallTypeData*)pdata;
          dump_replay_data_call_type_helper<ciCallTypeData>(out, round, count, call_type_data);
      }
    }
    if (parameters != NULL) {
      for (int i = 0; i < parameters->number_of_parameters(); i++) {
        dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i));
      }
    }
  }
  for (int count = 0, round = 0; round < 2; round++) {
    if (round == 1) out->print(" methods %d", count);
    dump_replay_data_extra_data_helper(out, round, count);
  }
  out->cr();
}