Example #1
0
void InterpreterCodelet::print_on(outputStream* st) const {
  if (PrintInterpreter) {
    st->cr();
    st->print_cr("----------------------------------------------------------------------");
  }

  if (description() != NULL) st->print("%s  ", description());
  if (bytecode()    >= 0   ) st->print("%d %s  ", bytecode(), Bytecodes::name(bytecode()));
  st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "]  %d bytes",
                code_begin(), code_end(), code_size());

  if (PrintInterpreter) {
    st->cr();
    Disassembler::decode(code_begin(), code_end(), st);
  }
}
 // Verify that there is enough space remaining for one instruction
 void force_space_in_buffer(int inst_size, int stubs_size, int const_size, int locs_size) {
   if ( allow_resizing() &&
        ( ((address)  code_end() + inst_size  >= (address)  code_limit()) ||
          ((address)  stub_end() + stubs_size >= (address)  stub_limit()) ||
          ((address)ctable_end() + const_size >= (address)ctable_limit()) ||
          ((address)  locs_end() + locs_size  >= (address)  locs_limit())) )
     resize();
 }
Example #3
0
void InterpreterCodelet::print_on(outputStream* st) const {
  ttyLocker ttyl;

  if (PrintInterpreter) {
    st->cr();
    st->print_cr("----------------------------------------------------------------------");
  }

  if (description() != NULL) st->print("%s  ", description());
  if (bytecode()    >= 0   ) st->print("%d %s  ", bytecode(), Bytecodes::name(bytecode()));
  st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "]  %d bytes",
                p2i(code_begin()), p2i(code_end()), code_size());

  if (PrintInterpreter) {
    st->cr();
    Disassembler::decode(code_begin(), code_end(), st, DEBUG_ONLY(_strings) NOT_DEBUG(CodeStrings()));
  }
}
Example #4
0
code_t* code_append(code_t*code, code_t*toappend)
{
    if(!code)
        return code_end(toappend);
    if(!toappend)
        return code_end(code);
    //find end of first list
    while(code->next) {
        code = code->next;
    }
    code_t*start=toappend;
    //and start of second list
    while(start->prev) {
        start = start->prev;
    }
    code->next = start;
    start->prev = code;
    return code_end(toappend);
}
Example #5
0
void ConstMethod::verify_on(outputStream* st) {
  guarantee(is_constMethod(), "object must be constMethod");

  // Verification can occur during oop construction before the method or
  // other fields have been initialized.
  guarantee(method()->is_method(), "should be method");

  address m_end = (address)((intptr_t) this + size());
  address compressed_table_start = code_end();
  guarantee(compressed_table_start <= m_end, "invalid method layout");
  address compressed_table_end = compressed_table_start;
  // Verify line number table
  if (has_linenumber_table()) {
    CompressedLineNumberReadStream stream(compressed_linenumber_table());
    while (stream.read_pair()) {
      guarantee(stream.bci() >= 0 && stream.bci() <= code_size(), "invalid bci in line number table");
    }
    compressed_table_end += stream.position();
  }
  guarantee(compressed_table_end <= m_end, "invalid method layout");
  // Verify checked exceptions, exception table and local variable tables
  if (has_method_parameters()) {
    u2* addr = method_parameters_length_addr();
    guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
  }
  if (has_checked_exceptions()) {
    u2* addr = checked_exceptions_length_addr();
    guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
  }
  if (has_exception_handler()) {
    u2* addr = exception_table_length_addr();
     guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
  }
  if (has_localvariable_table()) {
    u2* addr = localvariable_table_length_addr();
    guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
  }
  // Check compressed_table_end relative to uncompressed_table_start
  u2* uncompressed_table_start;
  if (has_localvariable_table()) {
    uncompressed_table_start = (u2*) localvariable_table_start();
  } else if (has_exception_handler()) {
    uncompressed_table_start = (u2*) exception_table_start();
  } else if (has_checked_exceptions()) {
      uncompressed_table_start = (u2*) checked_exceptions_start();
  } else if (has_method_parameters()) {
      uncompressed_table_start = (u2*) method_parameters_start();
  } else {
      uncompressed_table_start = (u2*) m_end;
  }
  int gap = (intptr_t) uncompressed_table_start - (intptr_t) compressed_table_end;
  int max_gap = align_metadata_size(1)*BytesPerWord;
  guarantee(gap >= 0 && gap < max_gap, "invalid method layout");
}
Example #6
0
code_t*code_cut(code_t*c)
{
    if(!c) return c;
    code_t*prev = c->prev;
    code_t*next = c->next;
    c->prev = 0;
    c->next = 0;
    if(prev) prev->next=next;
    if(next) next->prev=prev;
    code_free(c);

    if(next) return code_end(next);
    else     return prev;
}
Example #7
0
u_char* ConstMethod::compressed_linenumber_table() const {
  // Located immediately following the bytecodes.
  assert(has_linenumber_table(), "called only if table is present");
  return code_end();
}
Example #8
0
void VtableStub::print_on(outputStream* st) const {
  st->print("vtable stub (index = %d, receiver_location = %d, code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "[)",
             index(), receiver_location(), code_begin(), code_end());
}
 // Interpreter-specific attributes
 int         code_size() const                  { return code_end() - code_begin(); }
 bool	    contains(address pc) const  { return (code_begin() <= pc && pc < code_end()); }
void VtableStub::print() {
  tty->print("vtable stub (index = %d, receiver_location = %d, code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "[)",
	     index(), receiver_location(), code_begin(), code_end());
}
inline void CodeBuffer::set_code_end_after_constants(address& c_end, address& c_overflow) {
  c_end          = code_end();
  c_overflow     = code_limit();
  _instsEnd      = ctable_end();
  _instsOverflow = ctable_limit();
}
 bool in_code(address pc) const      { return code_begin() <= pc && pc <= code_end(); }