Mercurial > hg > truffle
comparison src/share/vm/oops/generateOopMap.cpp @ 11009:f75faf51e8c4
7158805: Better rewriting of nested subroutine calls
Reviewed-by: mschoene, coleenp
author | hseigel |
---|---|
date | Thu, 07 Mar 2013 11:49:38 -0500 |
parents | 2eef6d34833b |
children | 9ae5189791f4 |
comparison
equal
deleted
inserted
replaced
10121:6c560f9ebb3e | 11009:f75faf51e8c4 |
---|---|
640 | 640 |
641 // | 641 // |
642 // CellType handling methods | 642 // CellType handling methods |
643 // | 643 // |
644 | 644 |
645 // Allocate memory and throw LinkageError if failure. | |
646 #define ALLOC_RESOURCE_ARRAY(var, type, count) \ | |
647 var = NEW_RESOURCE_ARRAY_RETURN_NULL(type, count); \ | |
648 if (var == NULL) { \ | |
649 report_error("Cannot reserve enough memory to analyze this method"); \ | |
650 return; \ | |
651 } | |
652 | |
653 | |
645 void GenerateOopMap::init_state() { | 654 void GenerateOopMap::init_state() { |
646 _state_len = _max_locals + _max_stack + _max_monitors; | 655 _state_len = _max_locals + _max_stack + _max_monitors; |
647 _state = NEW_RESOURCE_ARRAY(CellTypeState, _state_len); | 656 ALLOC_RESOURCE_ARRAY(_state, CellTypeState, _state_len); |
648 memset(_state, 0, _state_len * sizeof(CellTypeState)); | 657 memset(_state, 0, _state_len * sizeof(CellTypeState)); |
649 _state_vec_buf = NEW_RESOURCE_ARRAY(char, MAX3(_max_locals, _max_stack, _max_monitors) + 1/*for null terminator char */); | 658 int count = MAX3(_max_locals, _max_stack, _max_monitors) + 1/*for null terminator char */; |
659 ALLOC_RESOURCE_ARRAY(_state_vec_buf, char, count); | |
650 } | 660 } |
651 | 661 |
652 void GenerateOopMap::make_context_uninitialized() { | 662 void GenerateOopMap::make_context_uninitialized() { |
653 CellTypeState* vs = vars(); | 663 CellTypeState* vs = vars(); |
654 | 664 |
903 // Note: Could consider reserving only the needed space for each BB's state | 913 // Note: Could consider reserving only the needed space for each BB's state |
904 // (entry stack may not be of maximal height for every basic block). | 914 // (entry stack may not be of maximal height for every basic block). |
905 // But cumbersome since we don't know the stack heights yet. (Nor the | 915 // But cumbersome since we don't know the stack heights yet. (Nor the |
906 // monitor stack heights...) | 916 // monitor stack heights...) |
907 | 917 |
908 _basic_blocks = NEW_RESOURCE_ARRAY(BasicBlock, _bb_count); | 918 ALLOC_RESOURCE_ARRAY(_basic_blocks, BasicBlock, _bb_count); |
909 | 919 |
910 // Make a pass through the bytecodes. Count the number of monitorenters. | 920 // Make a pass through the bytecodes. Count the number of monitorenters. |
911 // This can be used an upper bound on the monitor stack depth in programs | 921 // This can be used an upper bound on the monitor stack depth in programs |
912 // which obey stack discipline with their monitor usage. Initialize the | 922 // which obey stack discipline with their monitor usage. Initialize the |
913 // known information about basic blocks. | 923 // known information about basic blocks. |
974 report_error("The amount of memory required to analyze this method " | 984 report_error("The amount of memory required to analyze this method " |
975 "exceeds addressable range"); | 985 "exceeds addressable range"); |
976 return; | 986 return; |
977 } | 987 } |
978 | 988 |
979 CellTypeState *basicBlockState = | 989 CellTypeState *basicBlockState; |
980 NEW_RESOURCE_ARRAY(CellTypeState, bbNo * _state_len); | 990 ALLOC_RESOURCE_ARRAY(basicBlockState, CellTypeState, bbNo * _state_len); |
981 memset(basicBlockState, 0, bbNo * _state_len * sizeof(CellTypeState)); | 991 memset(basicBlockState, 0, bbNo * _state_len * sizeof(CellTypeState)); |
982 | 992 |
983 // Make a pass over the basicblocks and assign their state vectors. | 993 // Make a pass over the basicblocks and assign their state vectors. |
984 for (int blockNum=0; blockNum < bbNo; blockNum++) { | 994 for (int blockNum=0; blockNum < bbNo; blockNum++) { |
985 BasicBlock *bb = _basic_blocks + blockNum; | 995 BasicBlock *bb = _basic_blocks + blockNum; |