119 120 public: 121 void check_is_loaded() const { assert(is_loaded(), "not loaded"); } 122 123 // Basic method information. 124 ciFlags flags() const { check_is_loaded(); return _flags; } 125 ciSymbol* name() const { return _name; } 126 ciInstanceKlass* holder() const { return _holder; } 127 ciMethodData* method_data(); 128 ciMethodData* method_data_or_null(); 129 130 // Signature information. 131 ciSignature* signature() const { return _signature; } 132 ciType* return_type() const { return _signature->return_type(); } 133 int arg_size_no_receiver() const { return _signature->size(); } 134 // Can only be used on loaded ciMethods 135 int arg_size() const { 136 check_is_loaded(); 137 return _signature->size() + (_flags.is_static() ? 0 : 1); 138 } 139 // Report the number of elements on stack when invoking this method. 140 // This is different than the regular arg_size because invokedynamic 141 // has an implicit receiver. 142 int invoke_arg_size(Bytecodes::Code code) const { 143 if (is_loaded()) { 144 return arg_size(); 145 } else { 146 int arg_size = _signature->size(); 147 // Add a receiver argument, maybe: 148 if (code != Bytecodes::_invokestatic && 149 code != Bytecodes::_invokedynamic) { 150 arg_size++; 151 } 152 return arg_size; 153 } 154 } 155 156 Method* get_Method() const { 157 Method* m = (Method*)_metadata; 158 assert(m != NULL, "illegal use of unloaded method"); 159 return m; 160 } 161 162 // Method code and related information. 163 address code() { if (_code == NULL) load_code(); return _code; } 164 int code_size() const { check_is_loaded(); return _code_size; } 165 int max_stack() const { check_is_loaded(); return _max_stack; } 166 int max_locals() const { check_is_loaded(); return _max_locals; } 167 vmIntrinsics::ID intrinsic_id() const { check_is_loaded(); return _intrinsic_id; } | 119 120 public: 121 void check_is_loaded() const { assert(is_loaded(), "not loaded"); } 122 123 // Basic method information. 124 ciFlags flags() const { check_is_loaded(); return _flags; } 125 ciSymbol* name() const { return _name; } 126 ciInstanceKlass* holder() const { return _holder; } 127 ciMethodData* method_data(); 128 ciMethodData* method_data_or_null(); 129 130 // Signature information. 131 ciSignature* signature() const { return _signature; } 132 ciType* return_type() const { return _signature->return_type(); } 133 int arg_size_no_receiver() const { return _signature->size(); } 134 // Can only be used on loaded ciMethods 135 int arg_size() const { 136 check_is_loaded(); 137 return _signature->size() + (_flags.is_static() ? 0 : 1); 138 } 139 // Report the number of elements on stack when invoking the current method. 140 // If the method is loaded, arg_size() gives precise information about the 141 // number of stack elements (using the method's signature and its flags). 142 // However, if the method is not loaded, the number of stack elements must 143 // be determined differently, as the method's flags are not yet available. 144 // The invoke_arg_size() method assumes in that case that all bytecodes except 145 // invokestatic and invokedynamic have a receiver that is also pushed onto the 146 // stack by the caller of the current method. 147 int invoke_arg_size(Bytecodes::Code code) const { 148 if (is_loaded()) { 149 return arg_size(); 150 } else { 151 int arg_size = _signature->size(); 152 if (code != Bytecodes::_invokestatic && 153 code != Bytecodes::_invokedynamic) { 154 arg_size++; 155 } 156 return arg_size; 157 } 158 } 159 160 Method* get_Method() const { 161 Method* m = (Method*)_metadata; 162 assert(m != NULL, "illegal use of unloaded method"); 163 return m; 164 } 165 166 // Method code and related information. 167 address code() { if (_code == NULL) load_code(); return _code; } 168 int code_size() const { check_is_loaded(); return _code_size; } 169 int max_stack() const { check_is_loaded(); return _max_stack; } 170 int max_locals() const { check_is_loaded(); return _max_locals; } 171 vmIntrinsics::ID intrinsic_id() const { check_is_loaded(); return _intrinsic_id; } |