< prev index next >

src/hotspot/share/opto/runtime.cpp

Print this page

 127 #define gen(env, var, type_func_gen, c_func, fancy_jump, pass_tls, return_pc) \
 128   var = generate_stub(env, type_func_gen, CAST_FROM_FN_PTR(address, c_func), #var, fancy_jump, pass_tls, return_pc); \
 129   if (var == NULL) { return false; }
 130 
 131 bool OptoRuntime::generate(ciEnv* env) {
 132 
 133   generate_exception_blob();
 134 
 135   // Note: tls: Means fetching the return oop out of the thread-local storage
 136   //
 137   //   variable/name                       type-function-gen              , runtime method                  ,fncy_jp, tls,retpc
 138   // -------------------------------------------------------------------------------------------------------------------------------
 139   gen(env, _new_instance_Java              , new_instance_Type            , new_instance_C                  ,    0 , true, false);
 140   gen(env, _new_array_Java                 , new_array_Type               , new_array_C                     ,    0 , true, false);
 141   gen(env, _new_array_nozero_Java          , new_array_Type               , new_array_nozero_C              ,    0 , true, false);
 142   gen(env, _multianewarray2_Java           , multianewarray2_Type         , multianewarray2_C               ,    0 , true, false);
 143   gen(env, _multianewarray3_Java           , multianewarray3_Type         , multianewarray3_C               ,    0 , true, false);
 144   gen(env, _multianewarray4_Java           , multianewarray4_Type         , multianewarray4_C               ,    0 , true, false);
 145   gen(env, _multianewarray5_Java           , multianewarray5_Type         , multianewarray5_C               ,    0 , true, false);
 146   gen(env, _multianewarrayN_Java           , multianewarrayN_Type         , multianewarrayN_C               ,    0 , true, false);
 147   gen(env, _complete_monitor_locking_Java  , complete_monitor_enter_Type  , SharedRuntime::complete_monitor_locking_C, 0, false, false);
 148   gen(env, _monitor_notify_Java            , monitor_notify_Type          , monitor_notify_C                ,    0 , false, false);
 149   gen(env, _monitor_notifyAll_Java         , monitor_notify_Type          , monitor_notifyAll_C             ,    0 , false, false);
 150   gen(env, _rethrow_Java                   , rethrow_Type                 , rethrow_C                       ,    2 , true , true );
 151 
 152   gen(env, _slow_arraycopy_Java            , slow_arraycopy_Type          , SharedRuntime::slow_arraycopy_C ,    0 , false, false);
 153   gen(env, _register_finalizer_Java        , register_finalizer_Type      , register_finalizer              ,    0 , false, false);
 154 
 155   return true;
 156 }
 157 
 158 #undef gen
 159 
 160 
 161 // Helper method to do generation of RunTimeStub's
 162 address OptoRuntime::generate_stub(ciEnv* env,
 163                                    TypeFunc_generator gen, address C_function,
 164                                    const char *name, int is_fancy_jump,
 165                                    bool pass_tls,
 166                                    bool return_pc) {
 167 

 698 
 699   return TypeFunc::make(domain, range);
 700 }
 701 
 702 //-------------- currentTimeMillis, currentTimeNanos, etc
 703 
 704 const TypeFunc* OptoRuntime::void_long_Type() {
 705   // create input type (domain)
 706   const Type **fields = TypeTuple::fields(0);
 707   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+0, fields);
 708 
 709   // create result type (range)
 710   fields = TypeTuple::fields(2);
 711   fields[TypeFunc::Parms+0] = TypeLong::LONG;
 712   fields[TypeFunc::Parms+1] = Type::HALF;
 713   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+2, fields);
 714 
 715   return TypeFunc::make(domain, range);
 716 }
 717 

























































 718 // arraycopy stub variations:
 719 enum ArrayCopyType {
 720   ac_fast,                      // void(ptr, ptr, size_t)
 721   ac_checkcast,                 //  int(ptr, ptr, size_t, size_t, ptr)
 722   ac_slow,                      // void(ptr, int, ptr, int, int)
 723   ac_generic                    //  int(ptr, int, ptr, int, int)
 724 };
 725 
 726 static const TypeFunc* make_arraycopy_Type(ArrayCopyType act) {
 727   // create input type (domain)
 728   int num_args      = (act == ac_fast ? 3 : 5);
 729   int num_size_args = (act == ac_fast ? 1 : act == ac_checkcast ? 2 : 0);
 730   int argcnt = num_args;
 731   LP64_ONLY(argcnt += num_size_args); // halfwords for lengths
 732   const Type** fields = TypeTuple::fields(argcnt);
 733   int argp = TypeFunc::Parms;
 734   fields[argp++] = TypePtr::NOTNULL;    // src
 735   if (num_size_args == 0) {
 736     fields[argp++] = TypeInt::INT;      // src_pos
 737   }

 127 #define gen(env, var, type_func_gen, c_func, fancy_jump, pass_tls, return_pc) \
 128   var = generate_stub(env, type_func_gen, CAST_FROM_FN_PTR(address, c_func), #var, fancy_jump, pass_tls, return_pc); \
 129   if (var == NULL) { return false; }
 130 
 131 bool OptoRuntime::generate(ciEnv* env) {
 132 
 133   generate_exception_blob();
 134 
 135   // Note: tls: Means fetching the return oop out of the thread-local storage
 136   //
 137   //   variable/name                       type-function-gen              , runtime method                  ,fncy_jp, tls,retpc
 138   // -------------------------------------------------------------------------------------------------------------------------------
 139   gen(env, _new_instance_Java              , new_instance_Type            , new_instance_C                  ,    0 , true, false);
 140   gen(env, _new_array_Java                 , new_array_Type               , new_array_C                     ,    0 , true, false);
 141   gen(env, _new_array_nozero_Java          , new_array_Type               , new_array_nozero_C              ,    0 , true, false);
 142   gen(env, _multianewarray2_Java           , multianewarray2_Type         , multianewarray2_C               ,    0 , true, false);
 143   gen(env, _multianewarray3_Java           , multianewarray3_Type         , multianewarray3_C               ,    0 , true, false);
 144   gen(env, _multianewarray4_Java           , multianewarray4_Type         , multianewarray4_C               ,    0 , true, false);
 145   gen(env, _multianewarray5_Java           , multianewarray5_Type         , multianewarray5_C               ,    0 , true, false);
 146   gen(env, _multianewarrayN_Java           , multianewarrayN_Type         , multianewarrayN_C               ,    0 , true, false);
 147   gen(env, _complete_monitor_locking_Java  , complete_monitor_enter_Type  , SharedRuntime::complete_monitor_locking_C_inc_held_monitor_count, 0, false, false);
 148   gen(env, _monitor_notify_Java            , monitor_notify_Type          , monitor_notify_C                ,    0 , false, false);
 149   gen(env, _monitor_notifyAll_Java         , monitor_notify_Type          , monitor_notifyAll_C             ,    0 , false, false);
 150   gen(env, _rethrow_Java                   , rethrow_Type                 , rethrow_C                       ,    2 , true , true );
 151 
 152   gen(env, _slow_arraycopy_Java            , slow_arraycopy_Type          , SharedRuntime::slow_arraycopy_C ,    0 , false, false);
 153   gen(env, _register_finalizer_Java        , register_finalizer_Type      , register_finalizer              ,    0 , false, false);
 154 
 155   return true;
 156 }
 157 
 158 #undef gen
 159 
 160 
 161 // Helper method to do generation of RunTimeStub's
 162 address OptoRuntime::generate_stub(ciEnv* env,
 163                                    TypeFunc_generator gen, address C_function,
 164                                    const char *name, int is_fancy_jump,
 165                                    bool pass_tls,
 166                                    bool return_pc) {
 167 

 698 
 699   return TypeFunc::make(domain, range);
 700 }
 701 
 702 //-------------- currentTimeMillis, currentTimeNanos, etc
 703 
 704 const TypeFunc* OptoRuntime::void_long_Type() {
 705   // create input type (domain)
 706   const Type **fields = TypeTuple::fields(0);
 707   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+0, fields);
 708 
 709   // create result type (range)
 710   fields = TypeTuple::fields(2);
 711   fields[TypeFunc::Parms+0] = TypeLong::LONG;
 712   fields[TypeFunc::Parms+1] = Type::HALF;
 713   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+2, fields);
 714 
 715   return TypeFunc::make(domain, range);
 716 }
 717 
 718 const TypeFunc* OptoRuntime::void_void_Type() {
 719    // create input type (domain)
 720    const Type **fields = TypeTuple::fields(0);
 721    const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+0, fields);
 722 
 723    // create result type (range)
 724    fields = TypeTuple::fields(0);
 725    const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
 726    return TypeFunc::make(domain, range);
 727  }
 728 
 729  const TypeFunc* OptoRuntime::continuation_doYield_Type() {
 730    // create input type (domain)
 731    const Type **fields = TypeTuple::fields(0);
 732    const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+0, fields);
 733 
 734    // create result type (range)
 735    fields = TypeTuple::fields(1);
 736    fields[TypeFunc::Parms+0] = TypeInt::INT;
 737    const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields);
 738 
 739    return TypeFunc::make(domain, range);
 740  }
 741 
 742  const TypeFunc* OptoRuntime::continuation_jump_Type() {
 743   // create input type (domain)
 744   const Type **fields = TypeTuple::fields(6);
 745   fields[TypeFunc::Parms+0] = TypeLong::LONG;
 746   fields[TypeFunc::Parms+1] = Type::HALF;
 747   fields[TypeFunc::Parms+2] = TypeLong::LONG;
 748   fields[TypeFunc::Parms+3] = Type::HALF;
 749   fields[TypeFunc::Parms+4] = TypeLong::LONG;
 750   fields[TypeFunc::Parms+5] = Type::HALF;
 751   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+6, fields);
 752 
 753   // create result type (range)
 754   fields = TypeTuple::fields(0);
 755   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
 756   return TypeFunc::make(domain, range);
 757  }
 758 
 759 
 760  const TypeFunc* OptoRuntime::jfr_write_checkpoint_Type() {
 761    // create input type (domain)
 762    const Type **fields = TypeTuple::fields(2);
 763    fields[TypeFunc::Parms + 0] = TypeLong::LONG;
 764    fields[TypeFunc::Parms + 1] = Type::HALF;
 765    const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms + 2, fields);
 766 
 767    // create result type (range)
 768    fields = TypeTuple::fields(0);
 769    const TypeTuple *range = TypeTuple::make(TypeFunc::Parms + 0, fields);
 770 
 771    return TypeFunc::make(domain, range);
 772  }
 773 
 774 
 775 // arraycopy stub variations:
 776 enum ArrayCopyType {
 777   ac_fast,                      // void(ptr, ptr, size_t)
 778   ac_checkcast,                 //  int(ptr, ptr, size_t, size_t, ptr)
 779   ac_slow,                      // void(ptr, int, ptr, int, int)
 780   ac_generic                    //  int(ptr, int, ptr, int, int)
 781 };
 782 
 783 static const TypeFunc* make_arraycopy_Type(ArrayCopyType act) {
 784   // create input type (domain)
 785   int num_args      = (act == ac_fast ? 3 : 5);
 786   int num_size_args = (act == ac_fast ? 1 : act == ac_checkcast ? 2 : 0);
 787   int argcnt = num_args;
 788   LP64_ONLY(argcnt += num_size_args); // halfwords for lengths
 789   const Type** fields = TypeTuple::fields(argcnt);
 790   int argp = TypeFunc::Parms;
 791   fields[argp++] = TypePtr::NOTNULL;    // src
 792   if (num_size_args == 0) {
 793     fields[argp++] = TypeInt::INT;      // src_pos
 794   }
< prev index next >