duke@435: /* duke@435: * Copyright 1999-2005 Sun Microsystems, Inc. All Rights Reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * duke@435: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@435: * CA 95054 USA or visit www.sun.com if you need additional information or duke@435: * have any questions. duke@435: * duke@435: */ duke@435: duke@435: void pd_init() { /* nothing to do */ } duke@435: duke@435: public: duke@435: void try_allocate( duke@435: Register obj, // result: pointer to object after successful allocation duke@435: Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise duke@435: int con_size_in_bytes, // object size in bytes if known at compile time duke@435: Register t1, // temp register duke@435: Register t2, // temp register duke@435: Label& slow_case // continuation point if fast allocation fails duke@435: ); duke@435: duke@435: void initialize_header(Register obj, Register klass, Register len, Register t1, Register t2); duke@435: void initialize_body(Register base, Register index); duke@435: duke@435: // locking/unlocking duke@435: void lock_object (Register Rmark, Register Roop, Register Rbox, Register Rscratch, Label& slow_case); duke@435: void unlock_object(Register Rmark, Register Roop, Register Rbox, Label& slow_case); duke@435: duke@435: void initialize_object( duke@435: Register obj, // result: pointer to object after successful allocation duke@435: Register klass, // object klass duke@435: Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise duke@435: int con_size_in_bytes, // object size in bytes if known at compile time duke@435: Register t1, // temp register duke@435: Register t2 // temp register duke@435: ); duke@435: duke@435: // allocation of fixed-size objects duke@435: // (can also be used to allocate fixed-size arrays, by setting duke@435: // hdr_size correctly and storing the array length afterwards) duke@435: void allocate_object( duke@435: Register obj, // result: pointer to object after successful allocation duke@435: Register t1, // temp register duke@435: Register t2, // temp register duke@435: Register t3, // temp register duke@435: int hdr_size, // object header size in words duke@435: int obj_size, // object size in words duke@435: Register klass, // object klass duke@435: Label& slow_case // continuation point if fast allocation fails duke@435: ); duke@435: duke@435: enum { duke@435: max_array_allocation_length = 0x01000000 // sparc friendly value, requires sethi only duke@435: }; duke@435: duke@435: // allocation of arrays duke@435: void allocate_array( duke@435: Register obj, // result: pointer to array after successful allocation duke@435: Register len, // array length duke@435: Register t1, // temp register duke@435: Register t2, // temp register duke@435: Register t3, // temp register duke@435: int hdr_size, // object header size in words duke@435: int elt_size, // element size in bytes duke@435: Register klass, // object klass duke@435: Label& slow_case // continuation point if fast allocation fails duke@435: ); duke@435: duke@435: // invalidates registers in this window duke@435: void invalidate_registers(bool iregisters, bool lregisters, bool oregisters, duke@435: Register preserve1 = noreg, Register preserve2 = noreg);