comparison src/share/vm/code/codeBlob.cpp @ 1330:4a9cc99938e3

Merge
author acorn
date Fri, 26 Mar 2010 11:10:26 -0400
parents 9eba43136cb5
children c18cbe5936b8 1a5913bf5e19
comparison
equal deleted inserted replaced
1329:84043c7507b9 1330:4a9cc99938e3
1 /* 1 /*
2 * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 1998-2010 Sun Microsystems, Inc. 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.
247 // align the size to CodeEntryAlignment 247 // align the size to CodeEntryAlignment
248 size = align_code_offset(size); 248 size = align_code_offset(size);
249 size += round_to(buffer_size, oopSize); 249 size += round_to(buffer_size, oopSize);
250 assert(name != NULL, "must provide a name"); 250 assert(name != NULL, "must provide a name");
251 { 251 {
252
253 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); 252 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
254 blob = new (size) BufferBlob(name, size); 253 blob = new (size) BufferBlob(name, size);
255 } 254 }
256 // Track memory usage statistic after releasing CodeCache_lock 255 // Track memory usage statistic after releasing CodeCache_lock
257 MemoryService::track_code_cache_memory_usage(); 256 MemoryService::track_code_cache_memory_usage();
269 268
270 BufferBlob* blob = NULL; 269 BufferBlob* blob = NULL;
271 unsigned int size = allocation_size(cb, sizeof(BufferBlob)); 270 unsigned int size = allocation_size(cb, sizeof(BufferBlob));
272 assert(name != NULL, "must provide a name"); 271 assert(name != NULL, "must provide a name");
273 { 272 {
274
275 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); 273 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
276 blob = new (size) BufferBlob(name, size, cb); 274 blob = new (size) BufferBlob(name, size, cb);
277 } 275 }
278 // Track memory usage statistic after releasing CodeCache_lock 276 // Track memory usage statistic after releasing CodeCache_lock
279 MemoryService::track_code_cache_memory_usage(); 277 MemoryService::track_code_cache_memory_usage();
296 } 294 }
297 // Track memory usage statistic after releasing CodeCache_lock 295 // Track memory usage statistic after releasing CodeCache_lock
298 MemoryService::track_code_cache_memory_usage(); 296 MemoryService::track_code_cache_memory_usage();
299 } 297 }
300 298
301 bool BufferBlob::is_adapter_blob() const { 299
302 return (strcmp(AdapterHandlerEntry::name, name()) == 0); 300 //----------------------------------------------------------------------------------------------------
303 } 301 // Implementation of AdapterBlob
302
303 AdapterBlob* AdapterBlob::create(CodeBuffer* cb) {
304 ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
305
306 AdapterBlob* blob = NULL;
307 unsigned int size = allocation_size(cb, sizeof(AdapterBlob));
308 {
309 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
310 blob = new (size) AdapterBlob(size, cb);
311 }
312 // Track memory usage statistic after releasing CodeCache_lock
313 MemoryService::track_code_cache_memory_usage();
314
315 return blob;
316 }
317
318
319 //----------------------------------------------------------------------------------------------------
320 // Implementation of MethodHandlesAdapterBlob
321
322 MethodHandlesAdapterBlob* MethodHandlesAdapterBlob::create(int buffer_size) {
323 ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
324
325 MethodHandlesAdapterBlob* blob = NULL;
326 unsigned int size = sizeof(MethodHandlesAdapterBlob);
327 // align the size to CodeEntryAlignment
328 size = align_code_offset(size);
329 size += round_to(buffer_size, oopSize);
330 {
331 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
332 blob = new (size) MethodHandlesAdapterBlob(size);
333 }
334 // Track memory usage statistic after releasing CodeCache_lock
335 MemoryService::track_code_cache_memory_usage();
336
337 return blob;
338 }
339
304 340
305 //---------------------------------------------------------------------------------------------------- 341 //----------------------------------------------------------------------------------------------------
306 // Implementation of RuntimeStub 342 // Implementation of RuntimeStub
307 343
308 RuntimeStub::RuntimeStub( 344 RuntimeStub::RuntimeStub(