comparison src/share/vm/prims/methodHandleWalk.hpp @ 3905:c26de9aef2ed

7071307: MethodHandle bimorphic inlining should consider the frequency Reviewed-by: twisti, roland, kvn, iveresov
author never
date Fri, 02 Sep 2011 20:58:21 -0700
parents ddd894528dbc
children
comparison
equal deleted inserted replaced
3902:11a4af030e4b 3905:c26de9aef2ed
72 void next(TRAPS) { 72 void next(TRAPS) {
73 assert(!is_last(), ""); 73 assert(!is_last(), "");
74 set_method_handle(MethodHandle_vmtarget_oop(), THREAD); 74 set_method_handle(MethodHandle_vmtarget_oop(), THREAD);
75 } 75 }
76 76
77 Handle root() { return _root; }
77 Handle method_handle() { return _method_handle; } 78 Handle method_handle() { return _method_handle; }
78 oop method_handle_oop() { return _method_handle(); } 79 oop method_handle_oop() { return _method_handle(); }
79 oop method_type_oop() { return MethodHandle_type_oop(); } 80 oop method_type_oop() { return MethodHandle_type_oop(); }
80 oop vmtarget_oop() { return MethodHandle_vmtarget_oop(); } 81 oop vmtarget_oop() { return MethodHandle_vmtarget_oop(); }
81 82
108 #ifdef ASSERT 109 #ifdef ASSERT
109 // Print a symbolic description of a method handle chain, including 110 // Print a symbolic description of a method handle chain, including
110 // the signature for each method. The signatures are printed in 111 // the signature for each method. The signatures are printed in
111 // slot order to make it easier to understand. 112 // slot order to make it easier to understand.
112 void print(); 113 void print();
113 static void print(Handle mh);
114 static void print(oopDesc* mh); 114 static void print(oopDesc* mh);
115 #endif 115 #endif
116 }; 116 };
117 117
118 118
275 KlassHandle _rklass; // Return type for casting. 275 KlassHandle _rklass; // Return type for casting.
276 BasicType _rtype; 276 BasicType _rtype;
277 KlassHandle _target_klass; 277 KlassHandle _target_klass;
278 Thread* _thread; 278 Thread* _thread;
279 279
280 int _selectAlternative_bci; // These are used for capturing profiles from GWTs
281 int _taken_count;
282 int _not_taken_count;
283
280 // Values used by the compiler. 284 // Values used by the compiler.
281 static jvalue zero_jvalue; 285 static jvalue zero_jvalue;
282 static jvalue one_jvalue; 286 static jvalue one_jvalue;
283 287
284 // Fake constant pool entry. 288 // Fake constant pool entry.
370 assert(_cur_stack >= 0, "sanity"); 374 assert(_cur_stack >= 0, "sanity");
371 } 375 }
372 376
373 unsigned char* bytecode() const { return _bytecode.adr_at(0); } 377 unsigned char* bytecode() const { return _bytecode.adr_at(0); }
374 int bytecode_length() const { return _bytecode.length(); } 378 int bytecode_length() const { return _bytecode.length(); }
379 int cur_bci() const { return _bytecode.length(); }
375 380
376 // Fake constant pool. 381 // Fake constant pool.
377 int cpool_oop_put(int tag, Handle con) { 382 int cpool_oop_put(int tag, Handle con) {
378 if (con.is_null()) return 0; 383 if (con.is_null()) return 0;
379 ConstantValue* cv = new ConstantValue(tag, con); 384 ConstantValue* cv = new ConstantValue(tag, con);
434 int cpool_name_and_type_put(int name_index, int signature_index) { 439 int cpool_name_and_type_put(int name_index, int signature_index) {
435 return cpool_oop_reference_put(JVM_CONSTANT_NameAndType, name_index, signature_index, methodHandle()); 440 return cpool_oop_reference_put(JVM_CONSTANT_NameAndType, name_index, signature_index, methodHandle());
436 } 441 }
437 442
438 void emit_bc(Bytecodes::Code op, int index = 0, int args_size = -1); 443 void emit_bc(Bytecodes::Code op, int index = 0, int args_size = -1);
444 void update_branch_dest(int src, int dst);
445 void emit_load(ArgToken arg);
439 void emit_load(BasicType bt, int index); 446 void emit_load(BasicType bt, int index);
440 void emit_store(BasicType bt, int index); 447 void emit_store(BasicType bt, int index);
441 void emit_load_constant(ArgToken arg); 448 void emit_load_constant(ArgToken arg);
442 449
443 virtual ArgToken make_parameter(BasicType type, klassOop tk, int argnum, TRAPS) { 450 virtual ArgToken make_parameter(BasicType type, klassOop tk, int argnum, TRAPS) {
453 460
454 virtual ArgToken make_conversion(BasicType type, klassOop tk, Bytecodes::Code op, const ArgToken& src, TRAPS); 461 virtual ArgToken make_conversion(BasicType type, klassOop tk, Bytecodes::Code op, const ArgToken& src, TRAPS);
455 virtual ArgToken make_fetch(BasicType type, klassOop tk, Bytecodes::Code op, const ArgToken& base, const ArgToken& offset, TRAPS); 462 virtual ArgToken make_fetch(BasicType type, klassOop tk, Bytecodes::Code op, const ArgToken& base, const ArgToken& offset, TRAPS);
456 virtual ArgToken make_invoke(methodHandle m, vmIntrinsics::ID iid, Bytecodes::Code op, bool tailcall, int argc, ArgToken* argv, TRAPS); 463 virtual ArgToken make_invoke(methodHandle m, vmIntrinsics::ID iid, Bytecodes::Code op, bool tailcall, int argc, ArgToken* argv, TRAPS);
457 464
465 // Check for profiling information on a GWT and return true if it's found
466 bool fetch_counts(ArgToken a1, ArgToken a2);
467
458 // Get a real constant pool. 468 // Get a real constant pool.
459 constantPoolHandle get_constant_pool(TRAPS) const; 469 constantPoolHandle get_constant_pool(TRAPS) const;
460 470
461 // Get a real methodOop. 471 // Get a real methodOop.
462 methodHandle get_method_oop(TRAPS) const; 472 methodHandle get_method_oop(TRAPS);
463 473
464 public: 474 public:
465 MethodHandleCompiler(Handle root, Symbol* name, Symbol* signature, int invoke_count, bool for_invokedynamic, TRAPS); 475 MethodHandleCompiler(Handle root, Symbol* name, Symbol* signature, int invoke_count, bool for_invokedynamic, TRAPS);
466 476
467 // Compile the given MH chain into bytecode. 477 // Compile the given MH chain into bytecode.