hotspot/src/share/vm/c1/c1_Runtime1.cpp
changeset 31620 53be635ad49c
parent 30764 fec48bf5a827
child 33208 5ec6ffa63c57
child 33089 f4e956ed8b43
equal deleted inserted replaced
31618:8b074d70d72c 31620:53be635ad49c
    31 #include "c1/c1_MacroAssembler.hpp"
    31 #include "c1/c1_MacroAssembler.hpp"
    32 #include "c1/c1_Runtime1.hpp"
    32 #include "c1/c1_Runtime1.hpp"
    33 #include "classfile/systemDictionary.hpp"
    33 #include "classfile/systemDictionary.hpp"
    34 #include "classfile/vmSymbols.hpp"
    34 #include "classfile/vmSymbols.hpp"
    35 #include "code/codeBlob.hpp"
    35 #include "code/codeBlob.hpp"
       
    36 #include "code/codeCacheExtensions.hpp"
    36 #include "code/compiledIC.hpp"
    37 #include "code/compiledIC.hpp"
    37 #include "code/pcDesc.hpp"
    38 #include "code/pcDesc.hpp"
    38 #include "code/scopeDesc.hpp"
    39 #include "code/scopeDesc.hpp"
    39 #include "code/vtableStubs.hpp"
    40 #include "code/vtableStubs.hpp"
    40 #include "compiler/disassembler.hpp"
    41 #include "compiler/disassembler.hpp"
   181   assert(0 <= id && id < number_of_ids, "illegal stub id");
   182   assert(0 <= id && id < number_of_ids, "illegal stub id");
   182   ResourceMark rm;
   183   ResourceMark rm;
   183   // create code buffer for code storage
   184   // create code buffer for code storage
   184   CodeBuffer code(buffer_blob);
   185   CodeBuffer code(buffer_blob);
   185 
   186 
   186   Compilation::setup_code_buffer(&code, 0);
       
   187 
       
   188   // create assembler for code generation
       
   189   StubAssembler* sasm = new StubAssembler(&code, name_for(id), id);
       
   190   // generate code for runtime stub
       
   191   OopMapSet* oop_maps;
   187   OopMapSet* oop_maps;
   192   oop_maps = generate_code_for(id, sasm);
   188   int frame_size;
   193   assert(oop_maps == NULL || sasm->frame_size() != no_frame_size,
   189   bool must_gc_arguments;
   194          "if stub has an oop map it must have a valid frame size");
   190 
       
   191   if (!CodeCacheExtensions::skip_compiler_support()) {
       
   192     // bypass useless code generation
       
   193     Compilation::setup_code_buffer(&code, 0);
       
   194 
       
   195     // create assembler for code generation
       
   196     StubAssembler* sasm = new StubAssembler(&code, name_for(id), id);
       
   197     // generate code for runtime stub
       
   198     oop_maps = generate_code_for(id, sasm);
       
   199     assert(oop_maps == NULL || sasm->frame_size() != no_frame_size,
       
   200            "if stub has an oop map it must have a valid frame size");
   195 
   201 
   196 #ifdef ASSERT
   202 #ifdef ASSERT
   197   // Make sure that stubs that need oopmaps have them
   203     // Make sure that stubs that need oopmaps have them
   198   switch (id) {
   204     switch (id) {
   199     // These stubs don't need to have an oopmap
   205       // These stubs don't need to have an oopmap
   200     case dtrace_object_alloc_id:
   206     case dtrace_object_alloc_id:
   201     case g1_pre_barrier_slow_id:
   207     case g1_pre_barrier_slow_id:
   202     case g1_post_barrier_slow_id:
   208     case g1_post_barrier_slow_id:
   203     case slow_subtype_check_id:
   209     case slow_subtype_check_id:
   204     case fpu2long_stub_id:
   210     case fpu2long_stub_id:
   207 #if defined(SPARC) || defined(PPC)
   213 #if defined(SPARC) || defined(PPC)
   208     case handle_exception_nofpu_id:  // Unused on sparc
   214     case handle_exception_nofpu_id:  // Unused on sparc
   209 #endif
   215 #endif
   210       break;
   216       break;
   211 
   217 
   212     // All other stubs should have oopmaps
   218       // All other stubs should have oopmaps
   213     default:
   219     default:
   214       assert(oop_maps != NULL, "must have an oopmap");
   220       assert(oop_maps != NULL, "must have an oopmap");
   215   }
   221     }
   216 #endif
   222 #endif
   217 
   223 
   218   // align so printing shows nop's instead of random code at the end (SimpleStubs are aligned)
   224     // align so printing shows nop's instead of random code at the end (SimpleStubs are aligned)
   219   sasm->align(BytesPerWord);
   225     sasm->align(BytesPerWord);
   220   // make sure all code is in code buffer
   226     // make sure all code is in code buffer
   221   sasm->flush();
   227     sasm->flush();
       
   228 
       
   229     frame_size = sasm->frame_size();
       
   230     must_gc_arguments = sasm->must_gc_arguments();
       
   231   } else {
       
   232     /* ignored values */
       
   233     oop_maps = NULL;
       
   234     frame_size = 0;
       
   235     must_gc_arguments = false;
       
   236   }
   222   // create blob - distinguish a few special cases
   237   // create blob - distinguish a few special cases
   223   CodeBlob* blob = RuntimeStub::new_runtime_stub(name_for(id),
   238   CodeBlob* blob = RuntimeStub::new_runtime_stub(name_for(id),
   224                                                  &code,
   239                                                  &code,
   225                                                  CodeOffsets::frame_never_safe,
   240                                                  CodeOffsets::frame_never_safe,
   226                                                  sasm->frame_size(),
   241                                                  frame_size,
   227                                                  oop_maps,
   242                                                  oop_maps,
   228                                                  sasm->must_gc_arguments());
   243                                                  must_gc_arguments);
   229   // install blob
   244   // install blob
   230   assert(blob != NULL, "blob must exist");
   245   assert(blob != NULL, "blob must exist");
   231   _blobs[id] = blob;
   246   _blobs[id] = blob;
   232 }
   247 }
   233 
   248 
   397   methodHandle enclosing_method(THREAD, nm->method());
   412   methodHandle enclosing_method(THREAD, nm->method());
   398 
   413 
   399   CompLevel level = (CompLevel)nm->comp_level();
   414   CompLevel level = (CompLevel)nm->comp_level();
   400   int bci = InvocationEntryBci;
   415   int bci = InvocationEntryBci;
   401   if (branch_bci != InvocationEntryBci) {
   416   if (branch_bci != InvocationEntryBci) {
   402     // Compute desination bci
   417     // Compute destination bci
   403     address pc = method()->code_base() + branch_bci;
   418     address pc = method()->code_base() + branch_bci;
   404     Bytecodes::Code branch = Bytecodes::code_at(method(), pc);
   419     Bytecodes::Code branch = Bytecodes::code_at(method(), pc);
   405     int offset = 0;
   420     int offset = 0;
   406     switch (branch) {
   421     switch (branch) {
   407       case Bytecodes::_if_icmplt: case Bytecodes::_iflt:
   422       case Bytecodes::_if_icmplt: case Bytecodes::_iflt: