src/share/vm/oops/klass.hpp

changeset 3675
9a9bb0010c91
parent 3487
34e2e90e7182
child 3711
b632e80fc9dc
equal deleted inserted replaced
3668:cc74fa5a91a9 3675:9a9bb0010c91
1 /* 1 /*
2 * Copyright (c) 1997, 2011, 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.
147 // that the factory knows how to initialize the C++ vtable with the 147 // that the factory knows how to initialize the C++ vtable with the
148 // right pointer value. All other common initializations are handled 148 // right pointer value. All other common initializations are handled
149 // by the shared "base_create" subroutines. 149 // by the shared "base_create" subroutines.
150 // 150 //
151 virtual void* allocate_permanent(KlassHandle& klass, int size, TRAPS) const = 0; 151 virtual void* allocate_permanent(KlassHandle& klass, int size, TRAPS) const = 0;
152 void post_new_init_klass(KlassHandle& klass, klassOop obj, int size) const; 152 void post_new_init_klass(KlassHandle& klass, klassOop obj) const;
153 153
154 // Every subclass on which vtbl_value is called must include this macro. 154 // Every subclass on which vtbl_value is called must include this macro.
155 // Delay the installation of the klassKlass pointer until after the 155 // Delay the installation of the klassKlass pointer until after the
156 // the vtable for a new klass has been installed (after the call to new()). 156 // the vtable for a new klass has been installed (after the call to new()).
157 #define DEFINE_ALLOCATE_PERMANENT(thisKlass) \ 157 #define DEFINE_ALLOCATE_PERMANENT(thisKlass) \
158 void* allocate_permanent(KlassHandle& klass_klass, int size, TRAPS) const { \ 158 void* allocate_permanent(KlassHandle& klass_klass, int size, TRAPS) const { \
159 void* result = new(klass_klass, size, THREAD) thisKlass(); \ 159 void* result = new(klass_klass, size, THREAD) thisKlass(); \
160 if (HAS_PENDING_EXCEPTION) return NULL; \ 160 if (HAS_PENDING_EXCEPTION) return NULL; \
161 klassOop new_klass = ((Klass*) result)->as_klassOop(); \ 161 klassOop new_klass = ((Klass*) result)->as_klassOop(); \
162 OrderAccess::storestore(); \ 162 OrderAccess::storestore(); \
163 post_new_init_klass(klass_klass, new_klass, size); \ 163 post_new_init_klass(klass_klass, new_klass); \
164 return result; \ 164 return result; \
165 } 165 }
166 166
167 bool null_vtbl() { return *(intptr_t*)this == 0; } 167 bool null_vtbl() { return *(intptr_t*)this == 0; }
168 168

mercurial