< prev index next >

src/hotspot/share/opto/generateOptoStub.cpp

Print this page

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

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

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

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