< prev index next >

src/share/vm/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 
  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();
  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");


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


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