159 return dest;
160 }
161
162 char* Method::name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature, char* buf, int size) {
163 Symbol* klass_name = klass->name();
164 klass_name->as_klass_external_name(buf, size);
165 int len = (int)strlen(buf);
166
167 if (len < size - 1) {
168 buf[len++] = '.';
169
170 method_name->as_C_string(&(buf[len]), size - len);
171 len = (int)strlen(buf);
172
173 signature->as_C_string(&(buf[len]), size - len);
174 }
175
176 return buf;
177 }
178
179 int Method::fast_exception_handler_bci_for(const methodHandle& mh, Klass* ex_klass, int throw_bci, TRAPS) {
180 // exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index)
181 // access exception table
182 ExceptionTable table(mh());
183 int length = table.length();
184 // iterate through all entries sequentially
185 constantPoolHandle pool(THREAD, mh->constants());
186 for (int i = 0; i < length; i ++) {
187 //reacquire the table in case a GC happened
188 ExceptionTable table(mh());
189 int beg_bci = table.start_pc(i);
190 int end_bci = table.end_pc(i);
191 assert(beg_bci <= end_bci, "inconsistent exception table");
192 if (beg_bci <= throw_bci && throw_bci < end_bci) {
193 // exception handler bci range covers throw_bci => investigate further
194 int handler_bci = table.handler_pc(i);
195 int klass_index = table.catch_type_index(i);
196 if (klass_index == 0) {
197 return handler_bci;
198 } else if (ex_klass == NULL) {
|
159 return dest;
160 }
161
162 char* Method::name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature, char* buf, int size) {
163 Symbol* klass_name = klass->name();
164 klass_name->as_klass_external_name(buf, size);
165 int len = (int)strlen(buf);
166
167 if (len < size - 1) {
168 buf[len++] = '.';
169
170 method_name->as_C_string(&(buf[len]), size - len);
171 len = (int)strlen(buf);
172
173 signature->as_C_string(&(buf[len]), size - len);
174 }
175
176 return buf;
177 }
178
179 // Helper routine: get modifier list as C string. The string has a
180 // trailing whitespace if not empty. The string is allocated
181 // in resource area.
182 char* Method::modifiers_as_C_string() const {
183 stringStream ss;
184 access_flags().print_on(&ss);
185 return ss.as_string();
186 }
187
188 int Method::fast_exception_handler_bci_for(const methodHandle& mh, Klass* ex_klass, int throw_bci, TRAPS) {
189 // exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index)
190 // access exception table
191 ExceptionTable table(mh());
192 int length = table.length();
193 // iterate through all entries sequentially
194 constantPoolHandle pool(THREAD, mh->constants());
195 for (int i = 0; i < length; i ++) {
196 //reacquire the table in case a GC happened
197 ExceptionTable table(mh());
198 int beg_bci = table.start_pc(i);
199 int end_bci = table.end_pc(i);
200 assert(beg_bci <= end_bci, "inconsistent exception table");
201 if (beg_bci <= throw_bci && throw_bci < end_bci) {
202 // exception handler bci range covers throw_bci => investigate further
203 int handler_bci = table.handler_pc(i);
204 int klass_index = table.catch_type_index(i);
205 if (klass_index == 0) {
206 return handler_bci;
207 } else if (ex_klass == NULL) {
|