< prev index next >

src/share/vm/opto/runtime.cpp

Print this page




  30 #include "code/icBuffer.hpp"
  31 #include "code/nmethod.hpp"
  32 #include "code/pcDesc.hpp"
  33 #include "code/scopeDesc.hpp"
  34 #include "code/vtableStubs.hpp"
  35 #include "compiler/compileBroker.hpp"
  36 #include "compiler/oopMap.hpp"
  37 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
  38 #include "gc/g1/heapRegion.hpp"
  39 #include "gc/shared/barrierSet.hpp"
  40 #include "gc/shared/collectedHeap.hpp"
  41 #include "gc/shared/gcLocker.inline.hpp"
  42 #include "interpreter/bytecode.hpp"
  43 #include "interpreter/interpreter.hpp"
  44 #include "interpreter/linkResolver.hpp"
  45 #include "logging/log.hpp"
  46 #include "memory/oopFactory.hpp"
  47 #include "oops/objArrayKlass.hpp"
  48 #include "oops/oop.inline.hpp"
  49 #include "oops/typeArrayOop.inline.hpp"

  50 #include "opto/ad.hpp"
  51 #include "opto/addnode.hpp"
  52 #include "opto/callnode.hpp"
  53 #include "opto/cfgnode.hpp"
  54 #include "opto/graphKit.hpp"
  55 #include "opto/machnode.hpp"
  56 #include "opto/matcher.hpp"
  57 #include "opto/memnode.hpp"
  58 #include "opto/mulnode.hpp"
  59 #include "opto/runtime.hpp"
  60 #include "opto/subnode.hpp"
  61 #include "runtime/atomic.inline.hpp"
  62 #include "runtime/fprofiler.hpp"
  63 #include "runtime/handles.inline.hpp"
  64 #include "runtime/interfaceSupport.hpp"
  65 #include "runtime/javaCalls.hpp"
  66 #include "runtime/sharedRuntime.hpp"
  67 #include "runtime/signature.hpp"
  68 #include "runtime/threadCritical.hpp"
  69 #include "runtime/vframe.hpp"


 249   JRT_BLOCK_END;
 250 
 251   if (GraphKit::use_ReduceInitialCardMarks()) {
 252     // inform GC that we won't do card marks for initializing writes.
 253     new_store_pre_barrier(thread);
 254   }
 255 JRT_END
 256 
 257 
 258 // array allocation
 259 JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_C(Klass* array_type, int len, JavaThread *thread))
 260   JRT_BLOCK;
 261 #ifndef PRODUCT
 262   SharedRuntime::_new_array_ctr++;            // new array requires GC
 263 #endif
 264   assert(check_compiled_frame(thread), "incorrect caller");
 265 
 266   // Scavenge and allocate an instance.
 267   oop result;
 268 
 269   if (array_type->is_typeArray_klass()) {





 270     // The oopFactory likes to work with the element type.
 271     // (We could bypass the oopFactory, since it doesn't add much value.)
 272     BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
 273     result = oopFactory::new_typeArray(elem_type, len, THREAD);
 274   } else {
 275     // Although the oopFactory likes to work with the elem_type,
 276     // the compiler prefers the array_type, since it must already have
 277     // that latter value in hand for the fast path.
 278     Klass* elem_type = ObjArrayKlass::cast(array_type)->element_klass();
 279     result = oopFactory::new_objArray(elem_type, len, THREAD);
 280   }
 281 
 282   // Pass oops back through thread local storage.  Our apparent type to Java
 283   // is that we return an oop, but we can block on exit from this routine and
 284   // a GC can trash the oop in C's return register.  The generated stub will
 285   // fetch the oop from TLS after any possible GC.
 286   deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
 287   thread->set_vm_result(result);
 288   JRT_BLOCK_END;
 289 




  30 #include "code/icBuffer.hpp"
  31 #include "code/nmethod.hpp"
  32 #include "code/pcDesc.hpp"
  33 #include "code/scopeDesc.hpp"
  34 #include "code/vtableStubs.hpp"
  35 #include "compiler/compileBroker.hpp"
  36 #include "compiler/oopMap.hpp"
  37 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
  38 #include "gc/g1/heapRegion.hpp"
  39 #include "gc/shared/barrierSet.hpp"
  40 #include "gc/shared/collectedHeap.hpp"
  41 #include "gc/shared/gcLocker.inline.hpp"
  42 #include "interpreter/bytecode.hpp"
  43 #include "interpreter/interpreter.hpp"
  44 #include "interpreter/linkResolver.hpp"
  45 #include "logging/log.hpp"
  46 #include "memory/oopFactory.hpp"
  47 #include "oops/objArrayKlass.hpp"
  48 #include "oops/oop.inline.hpp"
  49 #include "oops/typeArrayOop.inline.hpp"
  50 #include "oops/valueArrayKlass.hpp"
  51 #include "opto/ad.hpp"
  52 #include "opto/addnode.hpp"
  53 #include "opto/callnode.hpp"
  54 #include "opto/cfgnode.hpp"
  55 #include "opto/graphKit.hpp"
  56 #include "opto/machnode.hpp"
  57 #include "opto/matcher.hpp"
  58 #include "opto/memnode.hpp"
  59 #include "opto/mulnode.hpp"
  60 #include "opto/runtime.hpp"
  61 #include "opto/subnode.hpp"
  62 #include "runtime/atomic.inline.hpp"
  63 #include "runtime/fprofiler.hpp"
  64 #include "runtime/handles.inline.hpp"
  65 #include "runtime/interfaceSupport.hpp"
  66 #include "runtime/javaCalls.hpp"
  67 #include "runtime/sharedRuntime.hpp"
  68 #include "runtime/signature.hpp"
  69 #include "runtime/threadCritical.hpp"
  70 #include "runtime/vframe.hpp"


 250   JRT_BLOCK_END;
 251 
 252   if (GraphKit::use_ReduceInitialCardMarks()) {
 253     // inform GC that we won't do card marks for initializing writes.
 254     new_store_pre_barrier(thread);
 255   }
 256 JRT_END
 257 
 258 
 259 // array allocation
 260 JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_C(Klass* array_type, int len, JavaThread *thread))
 261   JRT_BLOCK;
 262 #ifndef PRODUCT
 263   SharedRuntime::_new_array_ctr++;            // new array requires GC
 264 #endif
 265   assert(check_compiled_frame(thread), "incorrect caller");
 266 
 267   // Scavenge and allocate an instance.
 268   oop result;
 269 
 270   if (array_type->is_valueArray_klass()) {
 271     // TODO refactor all these checks, is_typeArray_klass should not be true for a value type array
 272     // TODO use oopFactory::new_array
 273     Klass* elem_type = ValueArrayKlass::cast(array_type)->element_klass();
 274     result = oopFactory::new_valueArray(elem_type, len, THREAD);
 275   } else if (array_type->is_typeArray_klass()) {
 276     // The oopFactory likes to work with the element type.
 277     // (We could bypass the oopFactory, since it doesn't add much value.)
 278     BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
 279     result = oopFactory::new_typeArray(elem_type, len, THREAD);
 280   } else {
 281     // Although the oopFactory likes to work with the elem_type,
 282     // the compiler prefers the array_type, since it must already have
 283     // that latter value in hand for the fast path.
 284     Klass* elem_type = ObjArrayKlass::cast(array_type)->element_klass();
 285     result = oopFactory::new_objArray(elem_type, len, THREAD);
 286   }
 287 
 288   // Pass oops back through thread local storage.  Our apparent type to Java
 289   // is that we return an oop, but we can block on exit from this routine and
 290   // a GC can trash the oop in C's return register.  The generated stub will
 291   // fetch the oop from TLS after any possible GC.
 292   deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
 293   thread->set_vm_result(result);
 294   JRT_BLOCK_END;
 295 


< prev index next >