comparison src/share/vm/oops/instanceKlass.cpp @ 3464:be4ca325525a

Merge.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 27 Jul 2011 17:32:44 -0700
parents 0654ee04b214 2d4b2b833d29
children f198b24093f3
comparison
equal deleted inserted replaced
3239:7c4b4daac19b 3464:be4ca325525a
333 333
334 // also sets rewritten 334 // also sets rewritten
335 this_oop->rewrite_class(CHECK_false); 335 this_oop->rewrite_class(CHECK_false);
336 } 336 }
337 337
338 // relocate jsrs and link methods after they are all rewritten
339 this_oop->relocate_and_link_methods(CHECK_false);
340
338 // Initialize the vtable and interface table after 341 // Initialize the vtable and interface table after
339 // methods have been rewritten since rewrite may 342 // methods have been rewritten since rewrite may
340 // fabricate new methodOops. 343 // fabricate new methodOops.
341 // also does loader constraint checking 344 // also does loader constraint checking
342 if (!this_oop()->is_shared()) { 345 if (!this_oop()->is_shared()) {
363 return true; 366 return true;
364 } 367 }
365 368
366 369
367 // Rewrite the byte codes of all of the methods of a class. 370 // Rewrite the byte codes of all of the methods of a class.
368 // Three cases:
369 // During the link of a newly loaded class.
370 // During the preloading of classes to be written to the shared spaces.
371 // - Rewrite the methods and update the method entry points.
372 //
373 // During the link of a class in the shared spaces.
374 // - The methods were already rewritten, update the metho entry points.
375 //
376 // The rewriter must be called exactly once. Rewriting must happen after 371 // The rewriter must be called exactly once. Rewriting must happen after
377 // verification but before the first method of the class is executed. 372 // verification but before the first method of the class is executed.
378
379 void instanceKlass::rewrite_class(TRAPS) { 373 void instanceKlass::rewrite_class(TRAPS) {
380 assert(is_loaded(), "must be loaded"); 374 assert(is_loaded(), "must be loaded");
381 instanceKlassHandle this_oop(THREAD, this->as_klassOop()); 375 instanceKlassHandle this_oop(THREAD, this->as_klassOop());
382 if (this_oop->is_rewritten()) { 376 if (this_oop->is_rewritten()) {
383 assert(this_oop()->is_shared(), "rewriting an unshared class?"); 377 assert(this_oop()->is_shared(), "rewriting an unshared class?");
384 return; 378 return;
385 } 379 }
386 Rewriter::rewrite(this_oop, CHECK); // No exception can happen here 380 Rewriter::rewrite(this_oop, CHECK);
387 this_oop->set_rewritten(); 381 this_oop->set_rewritten();
382 }
383
384 // Now relocate and link method entry points after class is rewritten.
385 // This is outside is_rewritten flag. In case of an exception, it can be
386 // executed more than once.
387 void instanceKlass::relocate_and_link_methods(TRAPS) {
388 assert(is_loaded(), "must be loaded");
389 instanceKlassHandle this_oop(THREAD, this->as_klassOop());
390 Rewriter::relocate_and_link(this_oop, CHECK);
388 } 391 }
389 392
390 393
391 void instanceKlass::initialize_impl(instanceKlassHandle this_oop, TRAPS) { 394 void instanceKlass::initialize_impl(instanceKlassHandle this_oop, TRAPS) {
392 // Make sure klass is linked (verified) before initialization 395 // Make sure klass is linked (verified) before initialization