src/share/vm/opto/generateOptoStub.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6518907 Sdiff src/share/vm/opto

src/share/vm/opto/generateOptoStub.cpp

Print this page




  71 
  72   // Make up the parameters
  73   uint i;
  74   for( i = 0; i < parm_cnt; i++ )
  75     map()->init_req(i, _gvn.transform(new (C) ParmNode(start, i)));
  76   for( ; i<map()->req(); i++ )
  77     map()->init_req(i, top());      // For nicer debugging
  78 
  79   // GraphKit requires memory to be a MergeMemNode:
  80   set_all_memory(map()->memory());
  81 
  82   // Get base of thread-local storage area
  83   Node* thread = _gvn.transform( new (C) ThreadLocalNode() );
  84 
  85   const int NoAlias = Compile::AliasIdxBot;
  86 
  87   Node* adr_last_Java_pc = basic_plus_adr(top(),
  88                                             thread,
  89                                             in_bytes(JavaThread::frame_anchor_offset()) +
  90                                             in_bytes(JavaFrameAnchor::last_Java_pc_offset()));
  91 #if defined(SPARC) || defined(IA64)
  92   Node* adr_flags = basic_plus_adr(top(),
  93                                    thread,
  94                                    in_bytes(JavaThread::frame_anchor_offset()) +
  95                                    in_bytes(JavaFrameAnchor::flags_offset()));
  96 #endif /* defined(SPARC) || defined(IA64) */
  97 
  98 
  99   // Drop in the last_Java_sp.  last_Java_fp is not touched.
 100   // Always do this after the other "last_Java_frame" fields are set since
 101   // as soon as last_Java_sp != NULL the has_last_Java_frame is true and
 102   // users will look at the other fields.
 103   //
 104   Node *adr_sp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_sp_offset()));
 105 #ifndef IA64
 106   Node *last_sp = basic_plus_adr(top(), frameptr(), (intptr_t) STACK_BIAS);
 107   store_to_memory(NULL, adr_sp, last_sp, T_ADDRESS, NoAlias);
 108 #endif
 109 
 110   // Set _thread_in_native
 111   // The order of stores into TLS is critical!  Setting _thread_in_native MUST
 112   // be last, because a GC is allowed at any time after setting it and the GC
 113   // will require last_Java_pc and last_Java_sp.
 114   Node* adr_state = basic_plus_adr(top(), thread, in_bytes(JavaThread::thread_state_offset()));
 115 
 116   //-----------------------------
 117   // Compute signature for C call.  Varies from the Java signature!
 118   const Type **fields = TypeTuple::fields(2*parm_cnt+2);
 119   uint cnt = TypeFunc::Parms;
 120   // The C routines gets the base of thread-local storage passed in as an
 121   // extra argument.  Not all calls need it, but its cheap to add here.
 122   for( ; cnt<parm_cnt; cnt++ )
 123     fields[cnt] = jdomain->field_at(cnt);
 124   fields[cnt++] = TypeRawPtr::BOTTOM; // Thread-local storage
 125   // Also pass in the caller's PC, if asked for.
 126   if( return_pc )
 127     fields[cnt++] = TypeRawPtr::BOTTOM; // Return PC
 128 


 193     Node* retnode = _gvn.transform( new (C) ProjNode(call,TypeFunc::Parms) );
 194     // C-land is allowed to return sub-word values.  Convert to integer type.
 195     assert( retval != Type::TOP, "" );
 196     if (retval == TypeInt::BOOL) {
 197       retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0xFF)) );
 198     } else if (retval == TypeInt::CHAR) {
 199       retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0xFFFF)) );
 200     } else if (retval == TypeInt::BYTE) {
 201       retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(24)) );
 202       retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(24)) );
 203     } else if (retval == TypeInt::SHORT) {
 204       retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(16)) );
 205       retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(16)) );
 206     }
 207     map()->set_req( TypeFunc::Parms, retnode );
 208   }
 209 
 210   //-----------------------------
 211 
 212   // Clear last_Java_sp
 213 #ifdef IA64
 214   if( os::is_MP() ) insert_mem_bar(Op_MemBarRelease);
 215 #endif
 216 
 217   store_to_memory(NULL, adr_sp, null(), T_ADDRESS, NoAlias);
 218 #ifdef IA64
 219   if (os::is_MP() && UseMembar) insert_mem_bar(new MemBarVolatileNode());
 220 #endif // def IA64
 221   // Clear last_Java_pc and (optionally)_flags
 222   store_to_memory(NULL, adr_last_Java_pc, null(), T_ADDRESS, NoAlias);
 223 #if defined(SPARC) || defined(IA64)
 224   store_to_memory(NULL, adr_flags, intcon(0), T_INT, NoAlias);
 225 #endif /* defined(SPARC) || defined(IA64) */
 226 #ifdef IA64
 227   Node* adr_last_Java_fp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_fp_offset()));
 228   if( os::is_MP() ) insert_mem_bar(Op_MemBarRelease);
 229   store_to_memory(NULL, adr_last_Java_fp,    null(),    T_ADDRESS, NoAlias);
 230 #endif
 231 
 232   // For is-fancy-jump, the C-return value is also the branch target
 233   Node* target = map()->in(TypeFunc::Parms);
 234   // Runtime call returning oop in TLS?  Fetch it out
 235   if( pass_tls ) {
 236     Node* adr = basic_plus_adr(top(), thread, in_bytes(JavaThread::vm_result_offset()));
 237     Node* vm_result = make_load(NULL, adr, TypeOopPtr::BOTTOM, T_OBJECT, NoAlias, false);
 238     map()->set_req(TypeFunc::Parms, vm_result); // vm_result passed as result
 239     // clear thread-local-storage(tls)
 240     store_to_memory(NULL, adr, null(), T_ADDRESS, NoAlias);
 241   }
 242 
 243   //-----------------------------
 244   // check exception
 245   Node* adr = basic_plus_adr(top(), thread, in_bytes(Thread::pending_exception_offset()));




  71 
  72   // Make up the parameters
  73   uint i;
  74   for( i = 0; i < parm_cnt; i++ )
  75     map()->init_req(i, _gvn.transform(new (C) ParmNode(start, i)));
  76   for( ; i<map()->req(); i++ )
  77     map()->init_req(i, top());      // For nicer debugging
  78 
  79   // GraphKit requires memory to be a MergeMemNode:
  80   set_all_memory(map()->memory());
  81 
  82   // Get base of thread-local storage area
  83   Node* thread = _gvn.transform( new (C) ThreadLocalNode() );
  84 
  85   const int NoAlias = Compile::AliasIdxBot;
  86 
  87   Node* adr_last_Java_pc = basic_plus_adr(top(),
  88                                             thread,
  89                                             in_bytes(JavaThread::frame_anchor_offset()) +
  90                                             in_bytes(JavaFrameAnchor::last_Java_pc_offset()));
  91 #if defined(SPARC)
  92   Node* adr_flags = basic_plus_adr(top(),
  93                                    thread,
  94                                    in_bytes(JavaThread::frame_anchor_offset()) +
  95                                    in_bytes(JavaFrameAnchor::flags_offset()));
  96 #endif /* defined(SPARC) */
  97 
  98 
  99   // Drop in the last_Java_sp.  last_Java_fp is not touched.
 100   // Always do this after the other "last_Java_frame" fields are set since
 101   // as soon as last_Java_sp != NULL the has_last_Java_frame is true and
 102   // users will look at the other fields.
 103   //
 104   Node *adr_sp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_sp_offset()));

 105   Node *last_sp = basic_plus_adr(top(), frameptr(), (intptr_t) STACK_BIAS);
 106   store_to_memory(NULL, adr_sp, last_sp, T_ADDRESS, NoAlias);

 107 
 108   // Set _thread_in_native
 109   // The order of stores into TLS is critical!  Setting _thread_in_native MUST
 110   // be last, because a GC is allowed at any time after setting it and the GC
 111   // will require last_Java_pc and last_Java_sp.
 112   Node* adr_state = basic_plus_adr(top(), thread, in_bytes(JavaThread::thread_state_offset()));
 113 
 114   //-----------------------------
 115   // Compute signature for C call.  Varies from the Java signature!
 116   const Type **fields = TypeTuple::fields(2*parm_cnt+2);
 117   uint cnt = TypeFunc::Parms;
 118   // The C routines gets the base of thread-local storage passed in as an
 119   // extra argument.  Not all calls need it, but its cheap to add here.
 120   for( ; cnt<parm_cnt; cnt++ )
 121     fields[cnt] = jdomain->field_at(cnt);
 122   fields[cnt++] = TypeRawPtr::BOTTOM; // Thread-local storage
 123   // Also pass in the caller's PC, if asked for.
 124   if( return_pc )
 125     fields[cnt++] = TypeRawPtr::BOTTOM; // Return PC
 126 


 191     Node* retnode = _gvn.transform( new (C) ProjNode(call,TypeFunc::Parms) );
 192     // C-land is allowed to return sub-word values.  Convert to integer type.
 193     assert( retval != Type::TOP, "" );
 194     if (retval == TypeInt::BOOL) {
 195       retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0xFF)) );
 196     } else if (retval == TypeInt::CHAR) {
 197       retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0xFFFF)) );
 198     } else if (retval == TypeInt::BYTE) {
 199       retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(24)) );
 200       retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(24)) );
 201     } else if (retval == TypeInt::SHORT) {
 202       retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(16)) );
 203       retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(16)) );
 204     }
 205     map()->set_req( TypeFunc::Parms, retnode );
 206   }
 207 
 208   //-----------------------------
 209 
 210   // Clear last_Java_sp




 211   store_to_memory(NULL, adr_sp, null(), T_ADDRESS, NoAlias);



 212   // Clear last_Java_pc and (optionally)_flags
 213   store_to_memory(NULL, adr_last_Java_pc, null(), T_ADDRESS, NoAlias);
 214 #if defined(SPARC)
 215   store_to_memory(NULL, adr_flags, intcon(0), T_INT, NoAlias);
 216 #endif /* defined(SPARC) */
 217 #ifdef IA64
 218   Node* adr_last_Java_fp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_fp_offset()));
 219   if( os::is_MP() ) insert_mem_bar(Op_MemBarRelease);
 220   store_to_memory(NULL, adr_last_Java_fp,    null(),    T_ADDRESS, NoAlias);
 221 #endif
 222 
 223   // For is-fancy-jump, the C-return value is also the branch target
 224   Node* target = map()->in(TypeFunc::Parms);
 225   // Runtime call returning oop in TLS?  Fetch it out
 226   if( pass_tls ) {
 227     Node* adr = basic_plus_adr(top(), thread, in_bytes(JavaThread::vm_result_offset()));
 228     Node* vm_result = make_load(NULL, adr, TypeOopPtr::BOTTOM, T_OBJECT, NoAlias, false);
 229     map()->set_req(TypeFunc::Parms, vm_result); // vm_result passed as result
 230     // clear thread-local-storage(tls)
 231     store_to_memory(NULL, adr, null(), T_ADDRESS, NoAlias);
 232   }
 233 
 234   //-----------------------------
 235   // check exception
 236   Node* adr = basic_plus_adr(top(), thread, in_bytes(Thread::pending_exception_offset()));


src/share/vm/opto/generateOptoStub.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File