00001 /* 00002 * Sun Public License Notice 00003 * 00004 * The contents of this file are subject to the Sun Public License 00005 * Version 1.0 (the "License"); you may not use this file except 00006 * in compliance with the License. A copy of the License is available 00007 * at http://www.sun.com/ 00008 * 00009 * The Original Code is the Java Profiler module. The Initial Developers 00010 * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, 00011 * Lukas Petru and Marek Przeczek. 00012 * 00013 * Portions created by Jan Stola are Copyright (C) 2000-2001. 00014 * All Rights Reserved. 00015 * 00016 * Portions created by Pavel Vacha are Copyright (C) 2000-2001. 00017 * All Rights Reserved. 00018 * 00019 * Portions created by Michal Pise are Copyright (C) 2000-2001. 00020 * All Rights Reserved. 00021 * 00022 * Portions created by Petr Luner are Copyright (C) 2000-2001. 00023 * All Rights Reserved. 00024 * 00025 * Portions created by Lukas Petru are Copyright (C) 2000-2001. 00026 * All Rights Reserved. 00027 * 00028 * Portions created by Marek Przeczek are Copyright (C) 2000-2001. 00029 * All Rights Reserved. 00030 * 00031 * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, 00032 * Lukas Petru and Marek Przeczek. 00033 */ 00034 00035 #include "../alloc/allocObject.h" 00036 #include "../prof/prof.h" 00037 #include "../alloc/allocObjectMethod.h" 00038 00039 #ifdef USE_ALLOCATOR 00040 Allocator AllocObject::_allocator; 00041 #endif 00042 00043 Buffer& AllocObject::infoToBin( Buffer& b) { 00044 00045 if( clss) b += clss->getProfID(); 00046 else b += (jint)0; 00047 00048 jint a[10] = { 00049 00050 JVMPI_NORMAL_OBJECT, // 0 00051 JVMPI_CLASS, // 1 00052 JVMPI_BOOLEAN, // 2 00053 JVMPI_BYTE, // 3 00054 JVMPI_CHAR, // 4 00055 JVMPI_SHORT, // 5 00056 JVMPI_INT, // 6 00057 JVMPI_LONG, // 7 00058 JVMPI_FLOAT, // 8 00059 JVMPI_DOUBLE // 9 00060 }; 00061 00062 jint i = 0; 00063 while( isArray != a[i]) i++; 00064 00065 b += i; 00066 00067 return b; 00068 } 00069 00070 void AllocObject::deactivate() { 00071 00072 Prof::prof().activeAllocObjects.removeNoRehash(this); 00073 00074 AllocObjectMethod* om = objectMethods.first(); 00075 while (om) { 00076 om->deactivate(); 00077 om = objectMethods.next(om); 00078 } 00079 } 00080 00081 const AllocObjectKey& AllocObject::getKey(AllocObjectKey& key) { 00082 00083 key.classId = classId; 00084 key.isArray = isArray; 00085 return key; 00086 } 00087 00088 int AllocObject::operator==(const AllocObjectKey& key) { 00089 00090 if (isArray != key.isArray) return 0; 00091 if (clss) return *clss == key.classId; 00092 else return classId == key.classId; 00093 } 00094 00095 int AllocObject::hashKey(const AllocObjectKey& key) { 00096 00097 return Class::hashKey(key.classId); 00098 } 00099 00100 int AllocObject::isActive() { 00101 00102 return (clss) ? clss->active : 1; 00103 } 00104 00105 void AllocObject::setUnchanged() { 00106 00107 IdObject::setUnchanged(); 00108 clearDataChanged(); 00109 }