< prev index next >

src/hotspot/share/opto/generateOptoStub.cpp

Print this page

 30 #include "opto/convertnode.hpp"
 31 #include "opto/locknode.hpp"
 32 #include "opto/memnode.hpp"
 33 #include "opto/mulnode.hpp"
 34 #include "opto/node.hpp"
 35 #include "opto/parse.hpp"
 36 #include "opto/phaseX.hpp"
 37 #include "opto/rootnode.hpp"
 38 #include "opto/runtime.hpp"
 39 #include "opto/type.hpp"
 40 #include "runtime/stubRoutines.hpp"
 41 
 42 //--------------------gen_stub-------------------------------
 43 void GraphKit::gen_stub(address C_function,
 44                         const char *name,
 45                         int is_fancy_jump,
 46                         bool pass_tls,
 47                         bool return_pc) {
 48   ResourceMark rm;
 49 
 50   const TypeTuple *jdomain = C->tf()->domain();
 51   const TypeTuple *jrange  = C->tf()->range();
 52 
 53   // The procedure start
 54   StartNode* start = new StartNode(root(), jdomain);
 55   _gvn.set_type_bottom(start);
 56 
 57   // Make a map, with JVM state
 58   uint parm_cnt = jdomain->cnt();
 59   uint max_map = MAX2(2*parm_cnt+1, jrange->cnt());
 60   // %%% SynchronizationEntryBCI is redundant; use InvocationEntryBci in interfaces
 61   assert(SynchronizationEntryBCI == InvocationEntryBci, "");
 62   JVMState* jvms = new (C) JVMState(0);
 63   jvms->set_bci(InvocationEntryBci);
 64   jvms->set_monoff(max_map);
 65   jvms->set_scloff(max_map);
 66   jvms->set_endoff(max_map);
 67   {
 68     SafePointNode *map = new SafePointNode( max_map, jvms );
 69     jvms->set_map(map);
 70     set_jvms(jvms);
 71     assert(map == this->map(), "kit.map is set");

251   assert (StubRoutines::forward_exception_entry() != nullptr, "must be generated before");
252   Node *to_exc = new ForwardExceptionNode(if_not_null,
253                                           i_o(),
254                                           exit_memory,
255                                           frameptr(),
256                                           returnadr());
257   root()->add_req(_gvn.transform(to_exc));  // bind to root to keep live
258   C->verify_start(start);
259 
260   //-----------------------------
261   // If this is a normal subroutine return, issue the return and be done.
262   Node *ret = nullptr;
263   switch( is_fancy_jump ) {
264   case 0:                       // Make a return instruction
265     // Return to caller, free any space for return address
266     ret = new ReturnNode(TypeFunc::Parms, if_null,
267                          i_o(),
268                          exit_memory,
269                          frameptr(),
270                          returnadr());
271     if (C->tf()->range()->cnt() > TypeFunc::Parms)
272       ret->add_req( map()->in(TypeFunc::Parms) );
273     break;
274   case 1:    // This is a fancy tail-call jump.  Jump to computed address.
275     // Jump to new callee; leave old return address alone.
276     ret = new TailCallNode(if_null,
277                            i_o(),
278                            exit_memory,
279                            frameptr(),
280                            returnadr(),
281                            target, map()->in(TypeFunc::Parms));
282     break;
283   case 2:                       // Pop return address & jump
284     // Throw away old return address; jump to new computed address
285     //assert(C_function == CAST_FROM_FN_PTR(address, OptoRuntime::rethrow_C), "fancy_jump==2 only for rethrow");
286     ret = new TailJumpNode(if_null,
287                                i_o(),
288                                exit_memory,
289                                frameptr(),
290                                target, map()->in(TypeFunc::Parms));
291     break;

 30 #include "opto/convertnode.hpp"
 31 #include "opto/locknode.hpp"
 32 #include "opto/memnode.hpp"
 33 #include "opto/mulnode.hpp"
 34 #include "opto/node.hpp"
 35 #include "opto/parse.hpp"
 36 #include "opto/phaseX.hpp"
 37 #include "opto/rootnode.hpp"
 38 #include "opto/runtime.hpp"
 39 #include "opto/type.hpp"
 40 #include "runtime/stubRoutines.hpp"
 41 
 42 //--------------------gen_stub-------------------------------
 43 void GraphKit::gen_stub(address C_function,
 44                         const char *name,
 45                         int is_fancy_jump,
 46                         bool pass_tls,
 47                         bool return_pc) {
 48   ResourceMark rm;
 49 
 50   const TypeTuple *jdomain = C->tf()->domain_sig();
 51   const TypeTuple *jrange  = C->tf()->range_sig();
 52 
 53   // The procedure start
 54   StartNode* start = new StartNode(root(), jdomain);
 55   _gvn.set_type_bottom(start);
 56 
 57   // Make a map, with JVM state
 58   uint parm_cnt = jdomain->cnt();
 59   uint max_map = MAX2(2*parm_cnt+1, jrange->cnt());
 60   // %%% SynchronizationEntryBCI is redundant; use InvocationEntryBci in interfaces
 61   assert(SynchronizationEntryBCI == InvocationEntryBci, "");
 62   JVMState* jvms = new (C) JVMState(0);
 63   jvms->set_bci(InvocationEntryBci);
 64   jvms->set_monoff(max_map);
 65   jvms->set_scloff(max_map);
 66   jvms->set_endoff(max_map);
 67   {
 68     SafePointNode *map = new SafePointNode( max_map, jvms );
 69     jvms->set_map(map);
 70     set_jvms(jvms);
 71     assert(map == this->map(), "kit.map is set");

251   assert (StubRoutines::forward_exception_entry() != nullptr, "must be generated before");
252   Node *to_exc = new ForwardExceptionNode(if_not_null,
253                                           i_o(),
254                                           exit_memory,
255                                           frameptr(),
256                                           returnadr());
257   root()->add_req(_gvn.transform(to_exc));  // bind to root to keep live
258   C->verify_start(start);
259 
260   //-----------------------------
261   // If this is a normal subroutine return, issue the return and be done.
262   Node *ret = nullptr;
263   switch( is_fancy_jump ) {
264   case 0:                       // Make a return instruction
265     // Return to caller, free any space for return address
266     ret = new ReturnNode(TypeFunc::Parms, if_null,
267                          i_o(),
268                          exit_memory,
269                          frameptr(),
270                          returnadr());
271     if (C->tf()->range_sig()->cnt() > TypeFunc::Parms)
272       ret->add_req( map()->in(TypeFunc::Parms) );
273     break;
274   case 1:    // This is a fancy tail-call jump.  Jump to computed address.
275     // Jump to new callee; leave old return address alone.
276     ret = new TailCallNode(if_null,
277                            i_o(),
278                            exit_memory,
279                            frameptr(),
280                            returnadr(),
281                            target, map()->in(TypeFunc::Parms));
282     break;
283   case 2:                       // Pop return address & jump
284     // Throw away old return address; jump to new computed address
285     //assert(C_function == CAST_FROM_FN_PTR(address, OptoRuntime::rethrow_C), "fancy_jump==2 only for rethrow");
286     ret = new TailJumpNode(if_null,
287                                i_o(),
288                                exit_memory,
289                                frameptr(),
290                                target, map()->in(TypeFunc::Parms));
291     break;
< prev index next >