Mercurial > hg > truffle
comparison src/share/vm/code/location.cpp @ 331:cecd8eb4e0ca
6706829: Compressed Oops: add debug info for narrow oops
Summary: Add support for narrow oops in debug info to avoid decoding.
Reviewed-by: rasbold, never
author | kvn |
---|---|
date | Wed, 10 Sep 2008 18:23:32 -0700 |
parents | a61af66fc99e |
children | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
330:1c6e3bfb543a | 331:cecd8eb4e0ca |
---|---|
1 /* | 1 /* |
2 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 1997-2008 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. |
24 | 24 |
25 #include "incls/_precompiled.incl" | 25 #include "incls/_precompiled.incl" |
26 #include "incls/_location.cpp.incl" | 26 #include "incls/_location.cpp.incl" |
27 | 27 |
28 void Location::print_on(outputStream* st) const { | 28 void Location::print_on(outputStream* st) const { |
29 if(type() == invalid && !legal_offset_in_bytes(offset() * BytesPerInt)) { | 29 if(type() == invalid) { |
30 // product of Location::invalid_loc() or Location::Location(). | 30 // product of Location::invalid_loc() or Location::Location(). |
31 switch (where()) { | 31 switch (where()) { |
32 case on_stack: st->print("empty"); break; | 32 case on_stack: st->print("empty"); break; |
33 case in_register: st->print("invalid"); break; | 33 case in_register: st->print("invalid"); break; |
34 } | 34 } |
40 default: st->print("Wrong location where %d", where()); | 40 default: st->print("Wrong location where %d", where()); |
41 } | 41 } |
42 switch (type()) { | 42 switch (type()) { |
43 case normal: break; | 43 case normal: break; |
44 case oop: st->print(",oop"); break; | 44 case oop: st->print(",oop"); break; |
45 case narrowoop: st->print(",narrowoop"); break; | |
45 case int_in_long: st->print(",int"); break; | 46 case int_in_long: st->print(",int"); break; |
46 case lng: st->print(",long"); break; | 47 case lng: st->print(",long"); break; |
47 case float_in_dbl: st->print(",float"); break; | 48 case float_in_dbl: st->print(",float"); break; |
48 case dbl: st->print(",double"); break; | 49 case dbl: st->print(",double"); break; |
49 case addr: st->print(",address"); break; | 50 case addr: st->print(",address"); break; |
51 } | 52 } |
52 } | 53 } |
53 | 54 |
54 | 55 |
55 Location::Location(DebugInfoReadStream* stream) { | 56 Location::Location(DebugInfoReadStream* stream) { |
56 _value = (uint16_t) stream->read_int(); | 57 _value = (juint) stream->read_int(); |
57 } | 58 } |
58 | 59 |
59 | 60 |
60 void Location::write_on(DebugInfoWriteStream* stream) { | 61 void Location::write_on(DebugInfoWriteStream* stream) { |
61 stream->write_int(_value & 0x0000FFFF); | 62 stream->write_int(_value); |
62 } | 63 } |
63 | 64 |
64 | 65 |
65 // Valid argument to Location::new_stk_loc()? | 66 // Valid argument to Location::new_stk_loc()? |
66 bool Location::legal_offset_in_bytes(int offset_in_bytes) { | 67 bool Location::legal_offset_in_bytes(int offset_in_bytes) { |
67 if ((offset_in_bytes % BytesPerInt) != 0) return false; | 68 if ((offset_in_bytes % BytesPerInt) != 0) return false; |
68 return (offset_in_bytes / BytesPerInt) < (OFFSET_MASK >> OFFSET_SHIFT); | 69 return (juint)(offset_in_bytes / BytesPerInt) < (OFFSET_MASK >> OFFSET_SHIFT); |
69 } | 70 } |