comparison src/share/vm/code/stubs.cpp @ 7066:7d815d842ee0

Merge.
author Christian Haeubl <haeubl@ssw.jku.at>
date Fri, 23 Nov 2012 11:50:27 +0100
parents 8c5333c80cfd b9a9ed0f8eeb
children a7a93887b4c4
comparison
equal deleted inserted replaced
7065:cfacf5d5bade 7066:7d815d842ee0
1 /* 1 /*
2 * Copyright (c) 1997, 2010, 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.
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 }