hotspot/src/share/vm/c1/c1_Runtime1.cpp
changeset 31620 53be635ad49c
parent 30764 fec48bf5a827
child 33208 5ec6ffa63c57
child 33089 f4e956ed8b43
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Tue Jun 30 15:26:20 2015 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Wed Jul 01 10:53:26 2015 +0200
@@ -33,6 +33,7 @@
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "code/codeBlob.hpp"
+#include "code/codeCacheExtensions.hpp"
 #include "code/compiledIC.hpp"
 #include "code/pcDesc.hpp"
 #include "code/scopeDesc.hpp"
@@ -183,20 +184,25 @@
   // create code buffer for code storage
   CodeBuffer code(buffer_blob);
 
-  Compilation::setup_code_buffer(&code, 0);
+  OopMapSet* oop_maps;
+  int frame_size;
+  bool must_gc_arguments;
 
-  // create assembler for code generation
-  StubAssembler* sasm = new StubAssembler(&code, name_for(id), id);
-  // generate code for runtime stub
-  OopMapSet* oop_maps;
-  oop_maps = generate_code_for(id, sasm);
-  assert(oop_maps == NULL || sasm->frame_size() != no_frame_size,
-         "if stub has an oop map it must have a valid frame size");
+  if (!CodeCacheExtensions::skip_compiler_support()) {
+    // bypass useless code generation
+    Compilation::setup_code_buffer(&code, 0);
+
+    // create assembler for code generation
+    StubAssembler* sasm = new StubAssembler(&code, name_for(id), id);
+    // generate code for runtime stub
+    oop_maps = generate_code_for(id, sasm);
+    assert(oop_maps == NULL || sasm->frame_size() != no_frame_size,
+           "if stub has an oop map it must have a valid frame size");
 
 #ifdef ASSERT
-  // Make sure that stubs that need oopmaps have them
-  switch (id) {
-    // These stubs don't need to have an oopmap
+    // Make sure that stubs that need oopmaps have them
+    switch (id) {
+      // These stubs don't need to have an oopmap
     case dtrace_object_alloc_id:
     case g1_pre_barrier_slow_id:
     case g1_post_barrier_slow_id:
@@ -209,23 +215,32 @@
 #endif
       break;
 
-    // All other stubs should have oopmaps
+      // All other stubs should have oopmaps
     default:
       assert(oop_maps != NULL, "must have an oopmap");
-  }
+    }
 #endif
 
-  // align so printing shows nop's instead of random code at the end (SimpleStubs are aligned)
-  sasm->align(BytesPerWord);
-  // make sure all code is in code buffer
-  sasm->flush();
+    // align so printing shows nop's instead of random code at the end (SimpleStubs are aligned)
+    sasm->align(BytesPerWord);
+    // make sure all code is in code buffer
+    sasm->flush();
+
+    frame_size = sasm->frame_size();
+    must_gc_arguments = sasm->must_gc_arguments();
+  } else {
+    /* ignored values */
+    oop_maps = NULL;
+    frame_size = 0;
+    must_gc_arguments = false;
+  }
   // create blob - distinguish a few special cases
   CodeBlob* blob = RuntimeStub::new_runtime_stub(name_for(id),
                                                  &code,
                                                  CodeOffsets::frame_never_safe,
-                                                 sasm->frame_size(),
+                                                 frame_size,
                                                  oop_maps,
-                                                 sasm->must_gc_arguments());
+                                                 must_gc_arguments);
   // install blob
   assert(blob != NULL, "blob must exist");
   _blobs[id] = blob;
@@ -399,7 +414,7 @@
   CompLevel level = (CompLevel)nm->comp_level();
   int bci = InvocationEntryBci;
   if (branch_bci != InvocationEntryBci) {
-    // Compute desination bci
+    // Compute destination bci
     address pc = method()->code_base() + branch_bci;
     Bytecodes::Code branch = Bytecodes::code_at(method(), pc);
     int offset = 0;