< prev index next >

src/hotspot/share/runtime/javaCalls.hpp

Print this page
rev 52749 : Bootstrap method consolidation
* clean up and simplify JDK support code for BSM invocation
* simplify JVM bootstrap handshake: use BootstrapCallInfo only
* remove unused JVM paths and data fields
* move bootstrap argument processing from MethodHandleNatives to ConstantPool
* remove ConstantGroup; merge argument access into BootstrapCallInfo
* adjust BSM argument access: remove copyArguments, add argumentRef API
* add metadata-free BSM modes, including symbolic arguments from CP


 146 
 147 #if INCLUDE_JVMCI
 148   void set_alternative_target(nmethod* target) {
 149     _alternative_target = target;
 150   }
 151 
 152   nmethod* alternative_target() {
 153     return _alternative_target;
 154   }
 155 #endif
 156 
 157   // The possible values for _value_state elements.
 158   enum {
 159     value_state_primitive,
 160     value_state_oop,
 161     value_state_handle,
 162     value_state_jobject,
 163     value_state_limit
 164   };
 165 




 166   inline void push_oop(Handle h) {

 167     _value_state[_size] = value_state_handle;
 168     _size = push_oop_impl(h.raw_value(), _size);
 169   }
 170 
 171   inline void push_jobject(jobject h) {

 172     _value_state[_size] = value_state_jobject;
 173     _size = push_oop_impl(h, _size);
 174   }
 175 
 176   inline void push_int(int i) {

 177     _value_state[_size] = value_state_primitive;
 178     JNITypes::put_int(i, _value, _size);
 179   }
 180 
 181   inline void push_double(double d) {

 182     _value_state[_size] = value_state_primitive;
 183     _value_state[_size + 1] = value_state_primitive;
 184     JNITypes::put_double(d, _value, _size);
 185   }
 186 
 187   inline void push_long(jlong l) {

 188     _value_state[_size] = value_state_primitive;
 189     _value_state[_size + 1] = value_state_primitive;
 190     JNITypes::put_long(l, _value, _size);
 191   }
 192 
 193   inline void push_float(float f) {

 194     _value_state[_size] = value_state_primitive;
 195     JNITypes::put_float(f, _value, _size);
 196   }
 197 
 198   // receiver
 199   Handle receiver() {
 200     assert(_size > 0, "must at least be one argument");
 201     assert(_value_state[0] == value_state_handle,
 202            "first argument must be an oop");
 203     assert(_value[0] != 0, "receiver must be not-null");
 204     return Handle((oop*)_value[0], false);
 205   }
 206 
 207   void set_receiver(Handle h) {
 208     assert(_start_at_zero == false, "can only be called once");
 209     _start_at_zero = true;
 210     _value_state--;
 211     _value--;
 212     _size++;

 213     _value_state[0] = value_state_handle;
 214     push_oop_impl(h.raw_value(), 0);
 215   }
 216 
 217   // Converts all Handles to oops, and returns a reference to parameter vector
 218   intptr_t* parameters() ;
 219   int   size_of_parameters() const { return _size; }
 220 
 221   // Verify that pushed arguments fits a given method
 222   void verify(const methodHandle& method, BasicType return_type);
 223 };
 224 
 225 // All calls to Java have to go via JavaCalls. Sets up the stack frame
 226 // and makes sure that the last_Java_frame pointers are chained correctly.
 227 //
 228 
 229 class JavaCalls: AllStatic {
 230   static void call_helper(JavaValue* result, const methodHandle& method, JavaCallArguments* args, TRAPS);
 231  public:
 232   // call_special




 146 
 147 #if INCLUDE_JVMCI
 148   void set_alternative_target(nmethod* target) {
 149     _alternative_target = target;
 150   }
 151 
 152   nmethod* alternative_target() {
 153     return _alternative_target;
 154   }
 155 #endif
 156 
 157   // The possible values for _value_state elements.
 158   enum {
 159     value_state_primitive,
 160     value_state_oop,
 161     value_state_handle,
 162     value_state_jobject,
 163     value_state_limit
 164   };
 165 
 166   void size_check(int words = 1) {
 167     assert(_size + (words-1) < _max_size, "oob: increase max_size argument to JavaCallArguments");
 168   }
 169 
 170   inline void push_oop(Handle h) {
 171     size_check();
 172     _value_state[_size] = value_state_handle;
 173     _size = push_oop_impl(h.raw_value(), _size);
 174   }
 175 
 176   inline void push_jobject(jobject h) {
 177     size_check();
 178     _value_state[_size] = value_state_jobject;
 179     _size = push_oop_impl(h, _size);
 180   }
 181 
 182   inline void push_int(int i) {
 183     size_check();
 184     _value_state[_size] = value_state_primitive;
 185     JNITypes::put_int(i, _value, _size);
 186   }
 187 
 188   inline void push_double(double d) {
 189     size_check(2);
 190     _value_state[_size] = value_state_primitive;
 191     _value_state[_size + 1] = value_state_primitive;
 192     JNITypes::put_double(d, _value, _size);
 193   }
 194 
 195   inline void push_long(jlong l) {
 196     size_check(2);
 197     _value_state[_size] = value_state_primitive;
 198     _value_state[_size + 1] = value_state_primitive;
 199     JNITypes::put_long(l, _value, _size);
 200   }
 201 
 202   inline void push_float(float f) {
 203     size_check();
 204     _value_state[_size] = value_state_primitive;
 205     JNITypes::put_float(f, _value, _size);
 206   }
 207 
 208   // receiver
 209   Handle receiver() {
 210     assert(_size > 0, "must at least be one argument");
 211     assert(_value_state[0] == value_state_handle,
 212            "first argument must be an oop");
 213     assert(_value[0] != 0, "receiver must be not-null");
 214     return Handle((oop*)_value[0], false);
 215   }
 216 
 217   void set_receiver(Handle h) {
 218     assert(_start_at_zero == false, "can only be called once");
 219     _start_at_zero = true;
 220     _value_state--;
 221     _value--;
 222     _size++;
 223     DEBUG_ONLY(_max_size++);
 224     _value_state[0] = value_state_handle;
 225     push_oop_impl(h.raw_value(), 0);
 226   }
 227 
 228   // Converts all Handles to oops, and returns a reference to parameter vector
 229   intptr_t* parameters() ;
 230   int   size_of_parameters() const { return _size; }
 231 
 232   // Verify that pushed arguments fits a given method
 233   void verify(const methodHandle& method, BasicType return_type);
 234 };
 235 
 236 // All calls to Java have to go via JavaCalls. Sets up the stack frame
 237 // and makes sure that the last_Java_frame pointers are chained correctly.
 238 //
 239 
 240 class JavaCalls: AllStatic {
 241   static void call_helper(JavaValue* result, const methodHandle& method, JavaCallArguments* args, TRAPS);
 242  public:
 243   // call_special


< prev index next >