Mercurial > hg > truffle
comparison src/share/vm/oops/generateOopMap.cpp @ 6213:8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
Summary: Change constMethodOop::_exception_table to optionally inlined u2 table.
Reviewed-by: bdelsart, coleenp, kamg
author | jiangli |
---|---|
date | Tue, 26 Jun 2012 19:08:44 -0400 |
parents | 9f12ede5571a |
children | 1d7922586cf6 |
comparison
equal
deleted
inserted
replaced
6177:06320b1578cb | 6213:8150fa46d2ed |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
398 initialize_bb(); | 398 initialize_bb(); |
399 | 399 |
400 bool fellThrough = false; // False to get first BB marked. | 400 bool fellThrough = false; // False to get first BB marked. |
401 | 401 |
402 // First mark all exception handlers as start of a basic-block | 402 // First mark all exception handlers as start of a basic-block |
403 typeArrayOop excps = method()->exception_table(); | 403 ExceptionTable excps(method()); |
404 for(int i = 0; i < excps->length(); i += 4) { | 404 for(int i = 0; i < excps.length(); i ++) { |
405 int handler_pc_idx = i+2; | 405 bb_mark_fct(this, excps.handler_pc(i), NULL); |
406 bb_mark_fct(this, excps->int_at(handler_pc_idx), NULL); | |
407 } | 406 } |
408 | 407 |
409 // Then iterate through the code | 408 // Then iterate through the code |
410 BytecodeStream bcs(_method); | 409 BytecodeStream bcs(_method); |
411 Bytecodes::Code bytecode; | 410 Bytecodes::Code bytecode; |
448 void GenerateOopMap::mark_reachable_code() { | 447 void GenerateOopMap::mark_reachable_code() { |
449 int change = 1; // int to get function pointers to work | 448 int change = 1; // int to get function pointers to work |
450 | 449 |
451 // Mark entry basic block as alive and all exception handlers | 450 // Mark entry basic block as alive and all exception handlers |
452 _basic_blocks[0].mark_as_alive(); | 451 _basic_blocks[0].mark_as_alive(); |
453 typeArrayOop excps = method()->exception_table(); | 452 ExceptionTable excps(method()); |
454 for(int i = 0; i < excps->length(); i += 4) { | 453 for(int i = 0; i < excps.length(); i++) { |
455 int handler_pc_idx = i+2; | 454 BasicBlock *bb = get_basic_block_at(excps.handler_pc(i)); |
456 BasicBlock *bb = get_basic_block_at(excps->int_at(handler_pc_idx)); | |
457 // If block is not already alive (due to multiple exception handlers to same bb), then | 455 // If block is not already alive (due to multiple exception handlers to same bb), then |
458 // make it alive | 456 // make it alive |
459 if (bb->is_dead()) bb->mark_as_alive(); | 457 if (bb->is_dead()) bb->mark_as_alive(); |
460 } | 458 } |
461 | 459 |
1179 break; | 1177 break; |
1180 } | 1178 } |
1181 | 1179 |
1182 if (_has_exceptions) { | 1180 if (_has_exceptions) { |
1183 int bci = itr->bci(); | 1181 int bci = itr->bci(); |
1184 typeArrayOop exct = method()->exception_table(); | 1182 ExceptionTable exct(method()); |
1185 for(int i = 0; i< exct->length(); i+=4) { | 1183 for(int i = 0; i< exct.length(); i++) { |
1186 int start_pc = exct->int_at(i); | 1184 int start_pc = exct.start_pc(i); |
1187 int end_pc = exct->int_at(i+1); | 1185 int end_pc = exct.end_pc(i); |
1188 int handler_pc = exct->int_at(i+2); | 1186 int handler_pc = exct.handler_pc(i); |
1189 int catch_type = exct->int_at(i+3); | 1187 int catch_type = exct.catch_type_index(i); |
1190 | 1188 |
1191 if (start_pc <= bci && bci < end_pc) { | 1189 if (start_pc <= bci && bci < end_pc) { |
1192 BasicBlock *excBB = get_basic_block_at(handler_pc); | 1190 BasicBlock *excBB = get_basic_block_at(handler_pc); |
1193 CellTypeState *excStk = excBB->stack(); | 1191 CellTypeState *excStk = excBB->stack(); |
1194 CellTypeState *cOpStck = stack(); | 1192 CellTypeState *cOpStck = stack(); |
2053 // Initialize values | 2051 // Initialize values |
2054 _got_error = false; | 2052 _got_error = false; |
2055 _conflict = false; | 2053 _conflict = false; |
2056 _max_locals = method()->max_locals(); | 2054 _max_locals = method()->max_locals(); |
2057 _max_stack = method()->max_stack(); | 2055 _max_stack = method()->max_stack(); |
2058 _has_exceptions = (method()->exception_table()->length() > 0); | 2056 _has_exceptions = (method()->has_exception_handler()); |
2059 _nof_refval_conflicts = 0; | 2057 _nof_refval_conflicts = 0; |
2060 _init_vars = new GrowableArray<intptr_t>(5); // There are seldom more than 5 init_vars | 2058 _init_vars = new GrowableArray<intptr_t>(5); // There are seldom more than 5 init_vars |
2061 _report_result = false; | 2059 _report_result = false; |
2062 _report_result_for_send = false; | 2060 _report_result_for_send = false; |
2063 _new_var_map = NULL; | 2061 _new_var_map = NULL; |
2068 if (TraceNewOopMapGeneration) { | 2066 if (TraceNewOopMapGeneration) { |
2069 tty->print("Method name: %s\n", method()->name()->as_C_string()); | 2067 tty->print("Method name: %s\n", method()->name()->as_C_string()); |
2070 if (Verbose) { | 2068 if (Verbose) { |
2071 _method->print_codes(); | 2069 _method->print_codes(); |
2072 tty->print_cr("Exception table:"); | 2070 tty->print_cr("Exception table:"); |
2073 typeArrayOop excps = method()->exception_table(); | 2071 ExceptionTable excps(method()); |
2074 for(int i = 0; i < excps->length(); i += 4) { | 2072 for(int i = 0; i < excps.length(); i ++) { |
2075 tty->print_cr("[%d - %d] -> %d", excps->int_at(i + 0), excps->int_at(i + 1), excps->int_at(i + 2)); | 2073 tty->print_cr("[%d - %d] -> %d", |
2074 excps.start_pc(i), excps.end_pc(i), excps.handler_pc(i)); | |
2076 } | 2075 } |
2077 } | 2076 } |
2078 } | 2077 } |
2079 | 2078 |
2080 // if no code - do nothing | 2079 // if no code - do nothing |