提交 b683d293 编写于 作者: B brutisso

7156764: Remove unused size parameter from some CollectedHeap methods

Summary: Some minor cleanups
Reviewed-by: tonyp, jwilhelm
上级 3bde2ce7
...@@ -940,10 +940,9 @@ public: ...@@ -940,10 +940,9 @@ public:
return _bytes_copied_during_gc; return _bytes_copied_during_gc;
} }
// Determine whether the next GC should be mixed. Called to determine // Determine whether there are candidate regions so that the
// whether to start mixed GCs or whether to carry on doing mixed // next GC should be mixed. The two action strings are used
// GCs. The two action strings are used in the ergo output when the // in the ergo output when the method returns true or false.
// method returns true or false.
bool next_gc_should_be_mixed(const char* true_action_str, bool next_gc_should_be_mixed(const char* true_action_str,
const char* false_action_str); const char* false_action_str);
......
...@@ -333,7 +333,7 @@ CollectedHeap::fill_with_array(HeapWord* start, size_t words, bool zap) ...@@ -333,7 +333,7 @@ CollectedHeap::fill_with_array(HeapWord* start, size_t words, bool zap)
// Set the length first for concurrent GC. // Set the length first for concurrent GC.
((arrayOop)start)->set_length((int)len); ((arrayOop)start)->set_length((int)len);
post_allocation_setup_common(Universe::intArrayKlassObj(), start, words); post_allocation_setup_common(Universe::intArrayKlassObj(), start);
DEBUG_ONLY(zap_filler_array(start, words, zap);) DEBUG_ONLY(zap_filler_array(start, words, zap);)
} }
...@@ -346,8 +346,7 @@ CollectedHeap::fill_with_object_impl(HeapWord* start, size_t words, bool zap) ...@@ -346,8 +346,7 @@ CollectedHeap::fill_with_object_impl(HeapWord* start, size_t words, bool zap)
fill_with_array(start, words, zap); fill_with_array(start, words, zap);
} else if (words > 0) { } else if (words > 0) {
assert(words == min_fill_size(), "unaligned size"); assert(words == min_fill_size(), "unaligned size");
post_allocation_setup_common(SystemDictionary::Object_klass(), start, post_allocation_setup_common(SystemDictionary::Object_klass(), start);
words);
} }
} }
...@@ -477,7 +476,7 @@ oop CollectedHeap::Class_obj_allocate(KlassHandle klass, int size, KlassHandle r ...@@ -477,7 +476,7 @@ oop CollectedHeap::Class_obj_allocate(KlassHandle klass, int size, KlassHandle r
assert(ScavengeRootsInCode > 0, "must be"); assert(ScavengeRootsInCode > 0, "must be");
obj = common_mem_allocate_init(size, CHECK_NULL); obj = common_mem_allocate_init(size, CHECK_NULL);
} }
post_allocation_setup_common(klass, obj, size); post_allocation_setup_common(klass, obj);
assert(Universe::is_bootstrapping() || assert(Universe::is_bootstrapping() ||
!((oop)obj)->blueprint()->oop_is_array(), "must not be an array"); !((oop)obj)->blueprint()->oop_is_array(), "must not be an array");
NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size));
......
...@@ -149,18 +149,14 @@ class CollectedHeap : public CHeapObj { ...@@ -149,18 +149,14 @@ class CollectedHeap : public CHeapObj {
inline static HeapWord* common_permanent_mem_allocate_init(size_t size, TRAPS); inline static HeapWord* common_permanent_mem_allocate_init(size_t size, TRAPS);
// Helper functions for (VM) allocation. // Helper functions for (VM) allocation.
inline static void post_allocation_setup_common(KlassHandle klass, inline static void post_allocation_setup_common(KlassHandle klass, HeapWord* obj);
HeapWord* obj, size_t size);
inline static void post_allocation_setup_no_klass_install(KlassHandle klass, inline static void post_allocation_setup_no_klass_install(KlassHandle klass,
HeapWord* objPtr, HeapWord* objPtr);
size_t size);
inline static void post_allocation_setup_obj(KlassHandle klass, inline static void post_allocation_setup_obj(KlassHandle klass, HeapWord* obj);
HeapWord* obj, size_t size);
inline static void post_allocation_setup_array(KlassHandle klass, inline static void post_allocation_setup_array(KlassHandle klass,
HeapWord* obj, size_t size, HeapWord* obj, int length);
int length);
// Clears an allocated object. // Clears an allocated object.
inline static void init_obj(HeapWord* obj, size_t size); inline static void init_obj(HeapWord* obj, size_t size);
...@@ -368,9 +364,7 @@ class CollectedHeap : public CHeapObj { ...@@ -368,9 +364,7 @@ class CollectedHeap : public CHeapObj {
inline static oop permanent_obj_allocate_no_klass_install(KlassHandle klass, inline static oop permanent_obj_allocate_no_klass_install(KlassHandle klass,
int size, int size,
TRAPS); TRAPS);
inline static void post_allocation_install_obj_klass(KlassHandle klass, inline static void post_allocation_install_obj_klass(KlassHandle klass, oop obj);
oop obj,
int size);
inline static oop permanent_array_allocate(KlassHandle klass, int size, int length, TRAPS); inline static oop permanent_array_allocate(KlassHandle klass, int size, int length, TRAPS);
// Raw memory allocation facilities // Raw memory allocation facilities
...@@ -664,9 +658,6 @@ class CollectedHeap : public CHeapObj { ...@@ -664,9 +658,6 @@ class CollectedHeap : public CHeapObj {
} }
} }
// Allocate GCHeapLog during VM startup
static void initialize_heap_log();
// Heap verification // Heap verification
virtual void verify(bool allow_dirty, bool silent, VerifyOption option) = 0; virtual void verify(bool allow_dirty, bool silent, VerifyOption option) = 0;
......
/* /*
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -50,15 +50,13 @@ ...@@ -50,15 +50,13 @@
// Inline allocation implementations. // Inline allocation implementations.
void CollectedHeap::post_allocation_setup_common(KlassHandle klass, void CollectedHeap::post_allocation_setup_common(KlassHandle klass,
HeapWord* obj, HeapWord* obj) {
size_t size) { post_allocation_setup_no_klass_install(klass, obj);
post_allocation_setup_no_klass_install(klass, obj, size); post_allocation_install_obj_klass(klass, oop(obj));
post_allocation_install_obj_klass(klass, oop(obj), (int) size);
} }
void CollectedHeap::post_allocation_setup_no_klass_install(KlassHandle klass, void CollectedHeap::post_allocation_setup_no_klass_install(KlassHandle klass,
HeapWord* objPtr, HeapWord* objPtr) {
size_t size) {
oop obj = (oop)objPtr; oop obj = (oop)objPtr;
assert(obj != NULL, "NULL object pointer"); assert(obj != NULL, "NULL object pointer");
...@@ -71,8 +69,7 @@ void CollectedHeap::post_allocation_setup_no_klass_install(KlassHandle klass, ...@@ -71,8 +69,7 @@ void CollectedHeap::post_allocation_setup_no_klass_install(KlassHandle klass,
} }
void CollectedHeap::post_allocation_install_obj_klass(KlassHandle klass, void CollectedHeap::post_allocation_install_obj_klass(KlassHandle klass,
oop obj, oop obj) {
int size) {
// These asserts are kind of complicated because of klassKlass // These asserts are kind of complicated because of klassKlass
// and the beginning of the world. // and the beginning of the world.
assert(klass() != NULL || !Universe::is_fully_initialized(), "NULL klass"); assert(klass() != NULL || !Universe::is_fully_initialized(), "NULL klass");
...@@ -101,9 +98,8 @@ inline void post_allocation_notify(KlassHandle klass, oop obj) { ...@@ -101,9 +98,8 @@ inline void post_allocation_notify(KlassHandle klass, oop obj) {
} }
void CollectedHeap::post_allocation_setup_obj(KlassHandle klass, void CollectedHeap::post_allocation_setup_obj(KlassHandle klass,
HeapWord* obj, HeapWord* obj) {
size_t size) { post_allocation_setup_common(klass, obj);
post_allocation_setup_common(klass, obj, size);
assert(Universe::is_bootstrapping() || assert(Universe::is_bootstrapping() ||
!((oop)obj)->blueprint()->oop_is_array(), "must not be an array"); !((oop)obj)->blueprint()->oop_is_array(), "must not be an array");
// notify jvmti and dtrace // notify jvmti and dtrace
...@@ -112,14 +108,13 @@ void CollectedHeap::post_allocation_setup_obj(KlassHandle klass, ...@@ -112,14 +108,13 @@ void CollectedHeap::post_allocation_setup_obj(KlassHandle klass,
void CollectedHeap::post_allocation_setup_array(KlassHandle klass, void CollectedHeap::post_allocation_setup_array(KlassHandle klass,
HeapWord* obj, HeapWord* obj,
size_t size,
int length) { int length) {
// Set array length before setting the _klass field // Set array length before setting the _klass field
// in post_allocation_setup_common() because the klass field // in post_allocation_setup_common() because the klass field
// indicates that the object is parsable by concurrent GC. // indicates that the object is parsable by concurrent GC.
assert(length >= 0, "length should be non-negative"); assert(length >= 0, "length should be non-negative");
((arrayOop)obj)->set_length(length); ((arrayOop)obj)->set_length(length);
post_allocation_setup_common(klass, obj, size); post_allocation_setup_common(klass, obj);
assert(((oop)obj)->blueprint()->oop_is_array(), "must be an array"); assert(((oop)obj)->blueprint()->oop_is_array(), "must be an array");
// notify jvmti and dtrace (must be after length is set for dtrace) // notify jvmti and dtrace (must be after length is set for dtrace)
post_allocation_notify(klass, (oop)obj); post_allocation_notify(klass, (oop)obj);
...@@ -256,7 +251,7 @@ oop CollectedHeap::obj_allocate(KlassHandle klass, int size, TRAPS) { ...@@ -256,7 +251,7 @@ oop CollectedHeap::obj_allocate(KlassHandle klass, int size, TRAPS) {
assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed"); assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
assert(size >= 0, "int won't convert to size_t"); assert(size >= 0, "int won't convert to size_t");
HeapWord* obj = common_mem_allocate_init(size, CHECK_NULL); HeapWord* obj = common_mem_allocate_init(size, CHECK_NULL);
post_allocation_setup_obj(klass, obj, size); post_allocation_setup_obj(klass, obj);
NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size));
return (oop)obj; return (oop)obj;
} }
...@@ -269,7 +264,7 @@ oop CollectedHeap::array_allocate(KlassHandle klass, ...@@ -269,7 +264,7 @@ oop CollectedHeap::array_allocate(KlassHandle klass,
assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed"); assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
assert(size >= 0, "int won't convert to size_t"); assert(size >= 0, "int won't convert to size_t");
HeapWord* obj = common_mem_allocate_init(size, CHECK_NULL); HeapWord* obj = common_mem_allocate_init(size, CHECK_NULL);
post_allocation_setup_array(klass, obj, size, length); post_allocation_setup_array(klass, obj, length);
NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size));
return (oop)obj; return (oop)obj;
} }
...@@ -283,7 +278,7 @@ oop CollectedHeap::array_allocate_nozero(KlassHandle klass, ...@@ -283,7 +278,7 @@ oop CollectedHeap::array_allocate_nozero(KlassHandle klass,
assert(size >= 0, "int won't convert to size_t"); assert(size >= 0, "int won't convert to size_t");
HeapWord* obj = common_mem_allocate_noinit(size, CHECK_NULL); HeapWord* obj = common_mem_allocate_noinit(size, CHECK_NULL);
((oop)obj)->set_klass_gap(0); ((oop)obj)->set_klass_gap(0);
post_allocation_setup_array(klass, obj, size, length); post_allocation_setup_array(klass, obj, length);
#ifndef PRODUCT #ifndef PRODUCT
const size_t hs = oopDesc::header_size()+1; const size_t hs = oopDesc::header_size()+1;
Universe::heap()->check_for_non_bad_heap_word_value(obj+hs, size-hs); Universe::heap()->check_for_non_bad_heap_word_value(obj+hs, size-hs);
...@@ -293,7 +288,7 @@ oop CollectedHeap::array_allocate_nozero(KlassHandle klass, ...@@ -293,7 +288,7 @@ oop CollectedHeap::array_allocate_nozero(KlassHandle klass,
oop CollectedHeap::permanent_obj_allocate(KlassHandle klass, int size, TRAPS) { oop CollectedHeap::permanent_obj_allocate(KlassHandle klass, int size, TRAPS) {
oop obj = permanent_obj_allocate_no_klass_install(klass, size, CHECK_NULL); oop obj = permanent_obj_allocate_no_klass_install(klass, size, CHECK_NULL);
post_allocation_install_obj_klass(klass, obj, size); post_allocation_install_obj_klass(klass, obj);
NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value((HeapWord*) obj, NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value((HeapWord*) obj,
size)); size));
return obj; return obj;
...@@ -306,7 +301,7 @@ oop CollectedHeap::permanent_obj_allocate_no_klass_install(KlassHandle klass, ...@@ -306,7 +301,7 @@ oop CollectedHeap::permanent_obj_allocate_no_klass_install(KlassHandle klass,
assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed"); assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
assert(size >= 0, "int won't convert to size_t"); assert(size >= 0, "int won't convert to size_t");
HeapWord* obj = common_permanent_mem_allocate_init(size, CHECK_NULL); HeapWord* obj = common_permanent_mem_allocate_init(size, CHECK_NULL);
post_allocation_setup_no_klass_install(klass, obj, size); post_allocation_setup_no_klass_install(klass, obj);
#ifndef PRODUCT #ifndef PRODUCT
const size_t hs = oopDesc::header_size(); const size_t hs = oopDesc::header_size();
Universe::heap()->check_for_bad_heap_word_value(obj+hs, size-hs); Universe::heap()->check_for_bad_heap_word_value(obj+hs, size-hs);
...@@ -322,7 +317,7 @@ oop CollectedHeap::permanent_array_allocate(KlassHandle klass, ...@@ -322,7 +317,7 @@ oop CollectedHeap::permanent_array_allocate(KlassHandle klass,
assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed"); assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
assert(size >= 0, "int won't convert to size_t"); assert(size >= 0, "int won't convert to size_t");
HeapWord* obj = common_permanent_mem_allocate_init(size, CHECK_NULL); HeapWord* obj = common_permanent_mem_allocate_init(size, CHECK_NULL);
post_allocation_setup_array(klass, obj, size, length); post_allocation_setup_array(klass, obj, length);
NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size));
return (oop)obj; return (oop)obj;
} }
......
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -174,10 +174,9 @@ KlassHandle Klass::base_create_klass(KlassHandle& klass, int size, ...@@ -174,10 +174,9 @@ KlassHandle Klass::base_create_klass(KlassHandle& klass, int size,
} }
void Klass_vtbl::post_new_init_klass(KlassHandle& klass, void Klass_vtbl::post_new_init_klass(KlassHandle& klass,
klassOop new_klass, klassOop new_klass) const {
int size) const {
assert(!new_klass->klass_part()->null_vtbl(), "Not a complete klass"); assert(!new_klass->klass_part()->null_vtbl(), "Not a complete klass");
CollectedHeap::post_allocation_install_obj_klass(klass, new_klass, size); CollectedHeap::post_allocation_install_obj_klass(klass, new_klass);
} }
void* Klass_vtbl::operator new(size_t ignored, KlassHandle& klass, void* Klass_vtbl::operator new(size_t ignored, KlassHandle& klass,
......
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -149,7 +149,7 @@ class Klass_vtbl { ...@@ -149,7 +149,7 @@ class Klass_vtbl {
// by the shared "base_create" subroutines. // by the shared "base_create" subroutines.
// //
virtual void* allocate_permanent(KlassHandle& klass, int size, TRAPS) const = 0; virtual void* allocate_permanent(KlassHandle& klass, int size, TRAPS) const = 0;
void post_new_init_klass(KlassHandle& klass, klassOop obj, int size) const; void post_new_init_klass(KlassHandle& klass, klassOop obj) const;
// Every subclass on which vtbl_value is called must include this macro. // Every subclass on which vtbl_value is called must include this macro.
// Delay the installation of the klassKlass pointer until after the // Delay the installation of the klassKlass pointer until after the
...@@ -160,7 +160,7 @@ class Klass_vtbl { ...@@ -160,7 +160,7 @@ class Klass_vtbl {
if (HAS_PENDING_EXCEPTION) return NULL; \ if (HAS_PENDING_EXCEPTION) return NULL; \
klassOop new_klass = ((Klass*) result)->as_klassOop(); \ klassOop new_klass = ((Klass*) result)->as_klassOop(); \
OrderAccess::storestore(); \ OrderAccess::storestore(); \
post_new_init_klass(klass_klass, new_klass, size); \ post_new_init_klass(klass_klass, new_klass); \
return result; \ return result; \
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册