comparison src/share/vm/code/stubs.cpp @ 6796:b31471cdc53e

7200163: add CodeComments functionality to assember stubs Summary: Pass the codeBuffer to the Stub constructor, and adapts the disassembler to print the comments. Reviewed-by: jrose, kvn, twisti Contributed-by: goetz.lindenmaier@sap.com
author kvn
date Mon, 24 Sep 2012 10:30:14 -0700
parents f95d63e2154a
children b9a9ed0f8eeb
comparison
equal deleted inserted replaced
6795:7eca5de9e0b6 6796:b31471cdc53e
99 } 99 }
100 100
101 101
102 Stub* StubQueue::request_committed(int code_size) { 102 Stub* StubQueue::request_committed(int code_size) {
103 Stub* s = request(code_size); 103 Stub* s = request(code_size);
104 if (s != NULL) commit(code_size); 104 CodeComments comments;
105 if (s != NULL) commit(code_size, comments);
105 return s; 106 return s;
106 } 107 }
107 108
108 109
109 Stub* StubQueue::request(int requested_code_size) { 110 Stub* StubQueue::request(int requested_code_size) {
116 // Queue: |...|XXXXXXX|.............| 117 // Queue: |...|XXXXXXX|.............|
117 // ^0 ^begin ^end ^size = limit 118 // ^0 ^begin ^end ^size = limit
118 assert(_buffer_limit == _buffer_size, "buffer must be fully usable"); 119 assert(_buffer_limit == _buffer_size, "buffer must be fully usable");
119 if (_queue_end + requested_size <= _buffer_size) { 120 if (_queue_end + requested_size <= _buffer_size) {
120 // code fits in at the end => nothing to do 121 // code fits in at the end => nothing to do
121 stub_initialize(s, requested_size); 122 CodeComments comments;
123 stub_initialize(s, requested_size, comments);
122 return s; 124 return s;
123 } else { 125 } else {
124 // stub doesn't fit in at the queue end 126 // stub doesn't fit in at the queue end
125 // => reduce buffer limit & wrap around 127 // => reduce buffer limit & wrap around
126 assert(!is_empty(), "just checkin'"); 128 assert(!is_empty(), "just checkin'");
133 assert(!is_contiguous(), "just checkin'"); 135 assert(!is_contiguous(), "just checkin'");
134 assert(_buffer_limit <= _buffer_size, "queue invariant broken"); 136 assert(_buffer_limit <= _buffer_size, "queue invariant broken");
135 // Queue: |XXX|.......|XXXXXXX|.......| 137 // Queue: |XXX|.......|XXXXXXX|.......|
136 // ^0 ^end ^begin ^limit ^size 138 // ^0 ^end ^begin ^limit ^size
137 s = current_stub(); 139 s = current_stub();
138 stub_initialize(s, requested_size); 140 CodeComments comments;
141 stub_initialize(s, requested_size, comments);
139 return s; 142 return s;
140 } 143 }
141 // Not enough space left 144 // Not enough space left
142 if (_mutex != NULL) _mutex->unlock(); 145 if (_mutex != NULL) _mutex->unlock();
143 return NULL; 146 return NULL;
144 } 147 }
145 148
146 149
147 void StubQueue::commit(int committed_code_size) { 150 void StubQueue::commit(int committed_code_size, CodeComments& comments) {
148 assert(committed_code_size > 0, "committed_code_size must be > 0"); 151 assert(committed_code_size > 0, "committed_code_size must be > 0");
149 int committed_size = round_to(stub_code_size_to_size(committed_code_size), CodeEntryAlignment); 152 int committed_size = round_to(stub_code_size_to_size(committed_code_size), CodeEntryAlignment);
150 Stub* s = current_stub(); 153 Stub* s = current_stub();
151 assert(committed_size <= stub_size(s), "committed size must not exceed requested size"); 154 assert(committed_size <= stub_size(s), "committed size must not exceed requested size");
152 stub_initialize(s, committed_size); 155 stub_initialize(s, committed_size, comments);
153 _queue_end += committed_size; 156 _queue_end += committed_size;
154 _number_of_stubs++; 157 _number_of_stubs++;
155 if (_mutex != NULL) _mutex->unlock(); 158 if (_mutex != NULL) _mutex->unlock();
156 debug_only(stub_verify(s);) 159 debug_only(stub_verify(s);)
157 } 160 }