示例#1
0
constMethodOop constMethodKlass::allocate(int byte_code_size,
                                          int compressed_line_number_size,
                                          int localvariable_table_length,
                                          int checked_exceptions_length,
                                          bool is_conc_safe,
                                          TRAPS) {

  int size = constMethodOopDesc::object_size(byte_code_size,
                                             compressed_line_number_size,
                                             localvariable_table_length,
                                             checked_exceptions_length);
  KlassHandle h_k(THREAD, as_klassOop());
  constMethodOop cm = (constMethodOop)
    CollectedHeap::permanent_obj_allocate(h_k, size, CHECK_NULL);
  assert(!cm->is_parsable(), "Not yet safely parsable");
  No_Safepoint_Verifier no_safepoint;
  cm->set_interpreter_kind(Interpreter::invalid);
  cm->init_fingerprint();
  cm->set_method(NULL);
  cm->set_stackmap_data(NULL);
  cm->set_exception_table(NULL);
  cm->set_code_size(byte_code_size);
  cm->set_constMethod_size(size);
  cm->set_inlined_tables_length(checked_exceptions_length,
                                compressed_line_number_size,
                                localvariable_table_length);
  assert(cm->size() == size, "wrong size for object");
  cm->set_is_conc_safe(is_conc_safe);
  cm->set_partially_loaded();
  assert(cm->is_parsable(), "Is safely parsable by gc");
  return cm;
}
示例#2
0
// The exception_table is the last field set when loading an object.
void constMethodKlass::oop_set_partially_loaded(oop obj) {
  assert(obj->is_constMethod(), "object must be klass");
  constMethodOop m = constMethodOop(obj);
  // Temporarily set exception_table to point to self
  m->set_exception_table((typeArrayOop)obj);
}