hotspot/src/share/vm/runtime/fieldDescriptor.cpp
changeset 2332 5c7b6f4ce0a1
parent 1 489c9b5090e2
child 5547 f4b087cbb361
equal deleted inserted replaced
2259:d3c946e7f127 2332:5c7b6f4ce0a1
     1 /*
     1 /*
     2  * Copyright 1997-2005 Sun Microsystems, Inc.  All Rights Reserved.
     2  * Copyright 1997-2009 Sun Microsystems, Inc.  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.
   105 }
   105 }
   106 
   106 
   107 void fieldDescriptor::print_on_for(outputStream* st, oop obj) {
   107 void fieldDescriptor::print_on_for(outputStream* st, oop obj) {
   108   print_on(st);
   108   print_on(st);
   109   BasicType ft = field_type();
   109   BasicType ft = field_type();
   110   jint as_int;
   110   jint as_int = 0;
   111   switch (ft) {
   111   switch (ft) {
   112     case T_BYTE:
   112     case T_BYTE:
   113       as_int = (jint)obj->byte_field(offset());
   113       as_int = (jint)obj->byte_field(offset());
   114       st->print(" %d", obj->byte_field(offset()));
   114       st->print(" %d", obj->byte_field(offset()));
   115       break;
   115       break;
   116     case T_CHAR:
   116     case T_CHAR:
       
   117       as_int = (jint)obj->char_field(offset());
   117       {
   118       {
   118         jchar c = obj->char_field(offset());
   119         jchar c = obj->char_field(offset());
   119         as_int = c;
   120         as_int = c;
   120         st->print(" %c %d", isprint(c) ? c : ' ', c);
   121         st->print(" %c %d", isprint(c) ? c : ' ', c);
   121       }
   122       }
   126     case T_FLOAT:
   127     case T_FLOAT:
   127       as_int = obj->int_field(offset());
   128       as_int = obj->int_field(offset());
   128       st->print(" %f", obj->float_field(offset()));
   129       st->print(" %f", obj->float_field(offset()));
   129       break;
   130       break;
   130     case T_INT:
   131     case T_INT:
       
   132       as_int = obj->int_field(offset());
   131       st->print(" %d", obj->int_field(offset()));
   133       st->print(" %d", obj->int_field(offset()));
   132       break;
   134       break;
   133     case T_LONG:
   135     case T_LONG:
   134       st->print(" ");
   136       st->print(" ");
   135       st->print_jlong(obj->long_field(offset()));
   137       st->print_jlong(obj->long_field(offset()));
   142       as_int = obj->bool_field(offset());
   144       as_int = obj->bool_field(offset());
   143       st->print(" %s", obj->bool_field(offset()) ? "true" : "false");
   145       st->print(" %s", obj->bool_field(offset()) ? "true" : "false");
   144       break;
   146       break;
   145     case T_ARRAY:
   147     case T_ARRAY:
   146       st->print(" ");
   148       st->print(" ");
   147       as_int = obj->int_field(offset());
   149       NOT_LP64(as_int = obj->int_field(offset()));
   148       obj->obj_field(offset())->print_value_on(st);
   150       obj->obj_field(offset())->print_value_on(st);
   149       break;
   151       break;
   150     case T_OBJECT:
   152     case T_OBJECT:
   151       st->print(" ");
   153       st->print(" ");
   152       as_int = obj->int_field(offset());
   154       NOT_LP64(as_int = obj->int_field(offset()));
   153       obj->obj_field(offset())->print_value_on(st);
   155       obj->obj_field(offset())->print_value_on(st);
   154       break;
   156       break;
   155     default:
   157     default:
   156       ShouldNotReachHere();
   158       ShouldNotReachHere();
   157       break;
   159       break;
   158   }
   160   }
   159   // Print a hint as to the underlying integer representation. This can be wrong for
   161   // Print a hint as to the underlying integer representation. This can be wrong for
   160   // pointers on an LP64 machine
   162   // pointers on an LP64 machine
   161   if (ft == T_LONG || ft == T_DOUBLE) {
   163   if (ft == T_LONG || ft == T_DOUBLE LP64_ONLY(|| !is_java_primitive(ft)) ) {
   162     st->print(" (%x %x)", obj->int_field(offset()), obj->int_field(offset()+sizeof(jint)));
   164     st->print(" (%x %x)", obj->int_field(offset()), obj->int_field(offset()+sizeof(jint)));
   163   } else {
   165   } else if (as_int < 0 || as_int > 9) {
   164     st->print(" (%x)", as_int);
   166     st->print(" (%x)", as_int);
   165   }
   167   }
   166 }
   168 }
   167 
   169 
   168 #endif /* PRODUCT */
   170 #endif /* PRODUCT */