annotate src/os/solaris/dtrace/generateJvmOffsets.cpp @ 196:d1605aabd0a1

6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
author xdono
date Wed, 02 Jul 2008 12:55:16 -0700
parents ba764ed4b6f2
children 660978a2a31a
rev   line source
duke@0 1 /*
xdono@196 2 * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
duke@0 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 21 * have any questions.
duke@0 22 *
duke@0 23 */
duke@0 24
duke@0 25 /*
duke@0 26 * This is to provide sanity check in jhelper.d which compares SCCS
duke@0 27 * versions of generateJvmOffsets.cpp used to create and extract
duke@0 28 * contents of __JvmOffsets[] table.
duke@0 29 * The __JvmOffsets[] table is located in generated JvmOffsets.cpp.
duke@0 30 *
duke@0 31 * GENOFFS_SCCS_VER 34
duke@0 32 */
duke@0 33
duke@0 34 #include "generateJvmOffsets.h"
duke@0 35
duke@0 36 /* A workaround for private and protected fields */
duke@0 37 #define private public
duke@0 38 #define protected public
duke@0 39
duke@0 40 #include <proc_service.h>
duke@0 41 #include "incls/_precompiled.incl"
duke@0 42 #include "incls/_vmStructs.cpp.incl"
duke@0 43
duke@0 44 #ifdef COMPILER1
duke@0 45 #if defined(DEBUG) || defined(FASTDEBUG)
duke@0 46
duke@0 47 /*
duke@0 48 * To avoid the most part of potential link errors
duke@0 49 * we link this program with -z nodefs .
duke@0 50 *
duke@0 51 * But for 'debug1' and 'fastdebug1' we still have to provide
duke@0 52 * a particular workaround for the following symbols bellow.
duke@0 53 * It will be good to find out a generic way in the future.
duke@0 54 */
duke@0 55
duke@0 56 #pragma weak tty
duke@0 57 #pragma weak CMSExpAvgFactor
duke@0 58
duke@0 59 #if defined(i386) || defined(__i386) || defined(__amd64)
duke@0 60 #pragma weak noreg
duke@0 61 #endif /* i386 */
duke@0 62
duke@0 63 LIR_Opr LIR_OprFact::illegalOpr = (LIR_Opr) 0;
duke@0 64
duke@0 65 address StubRoutines::_call_stub_return_address = NULL;
duke@0 66
duke@0 67 StubQueue* AbstractInterpreter::_code = NULL;
duke@0 68
duke@0 69 #endif /* defined(DEBUG) || defined(FASTDEBUG) */
duke@0 70 #endif /* COMPILER1 */
duke@0 71
duke@0 72 #define GEN_OFFS(Type,Name) \
duke@0 73 switch(gen_variant) { \
duke@0 74 case GEN_OFFSET: \
duke@0 75 printf("#define OFFSET_%-33s %d\n", \
duke@0 76 #Type #Name, offset_of(Type, Name)); \
duke@0 77 break; \
duke@0 78 case GEN_INDEX: \
duke@0 79 printf("#define IDX_OFFSET_%-33s %d\n", \
duke@0 80 #Type #Name, index++); \
duke@0 81 break; \
duke@0 82 case GEN_TABLE: \
duke@0 83 printf("\tOFFSET_%s,\n", #Type #Name); \
duke@0 84 break; \
duke@0 85 }
duke@0 86
duke@0 87 #define GEN_SIZE(Type) \
duke@0 88 switch(gen_variant) { \
duke@0 89 case GEN_OFFSET: \
duke@0 90 printf("#define SIZE_%-35s %d\n", \
duke@0 91 #Type, sizeof(Type)); \
duke@0 92 break; \
duke@0 93 case GEN_INDEX: \
duke@0 94 printf("#define IDX_SIZE_%-35s %d\n", \
duke@0 95 #Type, index++); \
duke@0 96 break; \
duke@0 97 case GEN_TABLE: \
duke@0 98 printf("\tSIZE_%s,\n", #Type); \
duke@0 99 break; \
duke@0 100 }
duke@0 101
duke@0 102 #define GEN_VALUE(String,Value) \
duke@0 103 switch(gen_variant) { \
duke@0 104 case GEN_OFFSET: \
duke@0 105 printf("#define %-40s %d\n", #String, Value); \
duke@0 106 break; \
duke@0 107 case GEN_INDEX: \
duke@0 108 printf("#define IDX_%-40s %d\n", #String, index++); \
duke@0 109 break; \
duke@0 110 case GEN_TABLE: \
duke@0 111 printf("\t" #String ",\n"); \
duke@0 112 break; \
duke@0 113 }
duke@0 114
duke@0 115 void gen_prologue(GEN_variant gen_variant) {
duke@0 116 const char *suffix;
duke@0 117
duke@0 118 switch(gen_variant) {
duke@0 119 case GEN_OFFSET: suffix = ".h"; break;
duke@0 120 case GEN_INDEX: suffix = "Index.h"; break;
duke@0 121 case GEN_TABLE: suffix = ".cpp"; break;
duke@0 122 }
duke@0 123
duke@0 124 printf("/*\n");
duke@0 125 printf(" * JvmOffsets%s !!!DO NOT EDIT!!! \n", suffix);
duke@0 126 printf(" * The generateJvmOffsets program generates this file!\n");
duke@0 127 printf(" */\n\n");
duke@0 128 switch(gen_variant) {
duke@0 129
duke@0 130 case GEN_OFFSET:
duke@0 131 case GEN_INDEX:
duke@0 132 break;
duke@0 133
duke@0 134 case GEN_TABLE:
duke@0 135 printf("#include \"JvmOffsets.h\"\n");
duke@0 136 printf("\n");
duke@0 137 printf("int __JvmOffsets[] = {\n");
duke@0 138 break;
duke@0 139 }
duke@0 140 }
duke@0 141
duke@0 142 void gen_epilogue(GEN_variant gen_variant) {
duke@0 143 if (gen_variant != GEN_TABLE) {
duke@0 144 return;
duke@0 145 }
duke@0 146 printf("};\n\n");
duke@0 147 return;
duke@0 148 }
duke@0 149
duke@0 150 int generateJvmOffsets(GEN_variant gen_variant) {
duke@0 151 int index = 0; /* It is used to generate JvmOffsetsIndex.h */
duke@0 152 int pointer_size = sizeof(void *);
duke@0 153 int data_model = (pointer_size == 4) ? PR_MODEL_ILP32 : PR_MODEL_LP64;
duke@0 154
duke@0 155 gen_prologue(gen_variant);
duke@0 156
duke@0 157 GEN_VALUE(DATA_MODEL, data_model);
duke@0 158 GEN_VALUE(POINTER_SIZE, pointer_size);
duke@0 159 #if defined(TIERED)
duke@0 160 GEN_VALUE(COMPILER, 3);
duke@0 161 #elif COMPILER1
duke@0 162 GEN_VALUE(COMPILER, 1);
duke@0 163 #elif COMPILER2
duke@0 164 GEN_VALUE(COMPILER, 2);
duke@0 165 #else
duke@0 166 GEN_VALUE(COMPILER, 0);
duke@0 167 #endif // COMPILER1 && COMPILER2
duke@0 168 printf("\n");
duke@0 169
duke@0 170 GEN_OFFS(CollectedHeap, _reserved);
duke@0 171 GEN_OFFS(MemRegion, _start);
duke@0 172 GEN_OFFS(MemRegion, _word_size);
duke@0 173 GEN_SIZE(HeapWord);
duke@0 174 printf("\n");
duke@0 175
duke@0 176 GEN_OFFS(VMStructEntry, typeName);
duke@0 177 GEN_OFFS(VMStructEntry, fieldName);
duke@0 178 GEN_OFFS(VMStructEntry, address);
duke@0 179 GEN_SIZE(VMStructEntry);
duke@0 180 printf("\n");
duke@0 181
duke@0 182 GEN_VALUE(MAX_METHOD_CODE_SIZE, max_method_code_size);
duke@0 183 #if defined(sparc) || defined(__sparc)
duke@0 184 GEN_VALUE(OFFSET_interpreter_frame_method, 2 * pointer_size); /* L2 in saved window */
duke@0 185 GEN_VALUE(OFFSET_interpreter_frame_sender_sp, 13 * pointer_size); /* I5 in saved window */
duke@0 186 // Fake value for consistency. It is not going to be used.
duke@0 187 GEN_VALUE(OFFSET_interpreter_frame_bcx_offset, 0xFFFF);
duke@0 188 #elif defined(i386) || defined(__i386) || defined(__amd64)
duke@0 189 GEN_VALUE(OFFSET_interpreter_frame_sender_sp, -1 * pointer_size);
duke@0 190 GEN_VALUE(OFFSET_interpreter_frame_method, -3 * pointer_size);
duke@0 191 GEN_VALUE(OFFSET_interpreter_frame_bcx_offset, -7 * pointer_size);
duke@0 192 #endif
duke@0 193
duke@0 194 GEN_OFFS(Klass, _name);
duke@0 195 GEN_OFFS(constantPoolOopDesc, _pool_holder);
duke@0 196 printf("\n");
duke@0 197
duke@0 198 GEN_VALUE(OFFSET_HeapBlockHeader_used, offset_of(HeapBlock::Header, _used));
coleenp@113 199 GEN_OFFS(oopDesc, _metadata);
duke@0 200 printf("\n");
duke@0 201
duke@0 202 GEN_VALUE(AccessFlags_NATIVE, JVM_ACC_NATIVE);
duke@0 203 GEN_VALUE(constMethodOopDesc_has_linenumber_table, constMethodOopDesc::_has_linenumber_table);
duke@0 204 GEN_OFFS(AccessFlags, _flags);
duke@0 205 GEN_OFFS(symbolOopDesc, _length);
duke@0 206 GEN_OFFS(symbolOopDesc, _body);
duke@0 207 printf("\n");
duke@0 208
duke@0 209 GEN_OFFS(methodOopDesc, _constMethod);
duke@0 210 GEN_OFFS(methodOopDesc, _constants);
duke@0 211 GEN_OFFS(methodOopDesc, _access_flags);
duke@0 212 printf("\n");
duke@0 213
duke@0 214 GEN_OFFS(constMethodOopDesc, _flags);
duke@0 215 GEN_OFFS(constMethodOopDesc, _code_size);
duke@0 216 GEN_OFFS(constMethodOopDesc, _name_index);
duke@0 217 GEN_OFFS(constMethodOopDesc, _signature_index);
duke@0 218 printf("\n");
duke@0 219
duke@0 220 GEN_OFFS(CodeHeap, _memory);
duke@0 221 GEN_OFFS(CodeHeap, _segmap);
duke@0 222 GEN_OFFS(CodeHeap, _log2_segment_size);
duke@0 223 printf("\n");
duke@0 224
duke@0 225 GEN_OFFS(VirtualSpace, _low_boundary);
duke@0 226 GEN_OFFS(VirtualSpace, _high_boundary);
duke@0 227 GEN_OFFS(VirtualSpace, _low);
duke@0 228 GEN_OFFS(VirtualSpace, _high);
duke@0 229 printf("\n");
duke@0 230
duke@0 231 GEN_OFFS(CodeBlob, _name);
duke@0 232 GEN_OFFS(CodeBlob, _header_size);
duke@0 233 GEN_OFFS(CodeBlob, _instructions_offset);
duke@0 234 GEN_OFFS(CodeBlob, _data_offset);
duke@0 235 GEN_OFFS(CodeBlob, _oops_offset);
duke@0 236 GEN_OFFS(CodeBlob, _oops_length);
duke@0 237 GEN_OFFS(CodeBlob, _frame_size);
duke@0 238 printf("\n");
duke@0 239
duke@0 240 GEN_OFFS(nmethod, _method);
duke@0 241 GEN_OFFS(nmethod, _scopes_data_offset);
duke@0 242 GEN_OFFS(nmethod, _scopes_pcs_offset);
duke@0 243 GEN_OFFS(nmethod, _handler_table_offset);
duke@0 244 GEN_OFFS(nmethod, _deoptimize_offset);
duke@0 245 GEN_OFFS(nmethod, _orig_pc_offset);
duke@0 246
duke@0 247 GEN_OFFS(PcDesc, _pc_offset);
duke@0 248 GEN_OFFS(PcDesc, _scope_decode_offset);
duke@0 249
duke@0 250 printf("\n");
duke@0 251
duke@0 252 GEN_VALUE(SIZE_HeapBlockHeader, sizeof(HeapBlock::Header));
duke@0 253 GEN_SIZE(oopDesc);
duke@0 254 GEN_SIZE(constantPoolOopDesc);
duke@0 255 printf("\n");
duke@0 256
duke@0 257 GEN_SIZE(PcDesc);
duke@0 258 GEN_SIZE(methodOopDesc);
duke@0 259 GEN_SIZE(constMethodOopDesc);
duke@0 260 GEN_SIZE(nmethod);
duke@0 261 GEN_SIZE(CodeBlob);
duke@0 262 GEN_SIZE(BufferBlob);
duke@0 263 GEN_SIZE(SingletonBlob);
duke@0 264 GEN_SIZE(RuntimeStub);
duke@0 265 GEN_SIZE(SafepointBlob);
duke@0 266
duke@0 267 gen_epilogue(gen_variant);
duke@0 268 printf("\n");
duke@0 269
duke@0 270 fflush(stdout);
duke@0 271 return 0;
duke@0 272 }