< prev index next >

src/share/vm/interpreter/rewriter.cpp

Print this page


  77 void Rewriter::restore_bytecodes() {
  78   int len = _methods->length();
  79   bool invokespecial_error = false;
  80 
  81   for (int i = len-1; i >= 0; i--) {
  82     Method* method = _methods->at(i);
  83     scan_method(method, true, &invokespecial_error);
  84     assert(!invokespecial_error, "reversing should not get an invokespecial error");
  85   }
  86 }
  87 
  88 // Creates a constant pool cache given a CPC map
  89 void Rewriter::make_constant_pool_cache(TRAPS) {
  90   ClassLoaderData* loader_data = _pool->pool_holder()->class_loader_data();
  91   ConstantPoolCache* cache =
  92       ConstantPoolCache::allocate(loader_data, _cp_cache_map,
  93                                   _invokedynamic_cp_cache_map,
  94                                   _invokedynamic_references_map, CHECK);
  95 
  96   // initialize object cache in constant pool





  97   _pool->initialize_resolved_references(loader_data, _resolved_references_map,
  98                                         _resolved_reference_limit,
  99                                         CHECK);
 100   _pool->set_cache(cache);
 101   cache->set_constant_pool(_pool());
 102 }
 103 
 104 
 105 
 106 // The new finalization semantics says that registration of
 107 // finalizable objects must be performed on successful return from the
 108 // Object.<init> constructor.  We could implement this trivially if
 109 // <init> were never rewritten but since JVMTI allows this to occur, a
 110 // more complicated solution is required.  A special return bytecode
 111 // is used only by Object.<init> to signal the finalization
 112 // registration point.  Additionally local 0 must be preserved so it's
 113 // available to pass to the registration function.  For simplicity we
 114 // require that local 0 is never overwritten so it's available as an
 115 // argument for registration.
 116 
 117 void Rewriter::rewrite_Object_init(methodHandle method, TRAPS) {
 118   RawBytecodeStream bcs(method);
 119   while (!bcs.is_last_bytecode()) {
 120     Bytecodes::Code opcode = bcs.raw_next();
 121     switch (opcode) {




  77 void Rewriter::restore_bytecodes() {
  78   int len = _methods->length();
  79   bool invokespecial_error = false;
  80 
  81   for (int i = len-1; i >= 0; i--) {
  82     Method* method = _methods->at(i);
  83     scan_method(method, true, &invokespecial_error);
  84     assert(!invokespecial_error, "reversing should not get an invokespecial error");
  85   }
  86 }
  87 
  88 // Creates a constant pool cache given a CPC map
  89 void Rewriter::make_constant_pool_cache(TRAPS) {
  90   ClassLoaderData* loader_data = _pool->pool_holder()->class_loader_data();
  91   ConstantPoolCache* cache =
  92       ConstantPoolCache::allocate(loader_data, _cp_cache_map,
  93                                   _invokedynamic_cp_cache_map,
  94                                   _invokedynamic_references_map, CHECK);
  95 
  96   // initialize object cache in constant pool
  97   _pool->set_cache(cache);
  98   cache->set_constant_pool(_pool());
  99 
 100   // _resolved_references is stored in pool->cache(), so need to be done after
 101   // the above lines.
 102   _pool->initialize_resolved_references(loader_data, _resolved_references_map,
 103                                         _resolved_reference_limit,
 104                                         CHECK);


 105 }
 106 
 107 
 108 
 109 // The new finalization semantics says that registration of
 110 // finalizable objects must be performed on successful return from the
 111 // Object.<init> constructor.  We could implement this trivially if
 112 // <init> were never rewritten but since JVMTI allows this to occur, a
 113 // more complicated solution is required.  A special return bytecode
 114 // is used only by Object.<init> to signal the finalization
 115 // registration point.  Additionally local 0 must be preserved so it's
 116 // available to pass to the registration function.  For simplicity we
 117 // require that local 0 is never overwritten so it's available as an
 118 // argument for registration.
 119 
 120 void Rewriter::rewrite_Object_init(methodHandle method, TRAPS) {
 121   RawBytecodeStream bcs(method);
 122   while (!bcs.is_last_bytecode()) {
 123     Bytecodes::Code opcode = bcs.raw_next();
 124     switch (opcode) {


< prev index next >