6706829: Compressed Oops: add debug info for narrow oops

Add support for narrow oops in debug info to avoid decoding.

Reviewed-by: rasbold, never
This commit is contained in:
Vladimir Kozlov 2008-09-10 18:23:32 -07:00
parent 63c98ed888
commit 659ca734bb
11 changed files with 169 additions and 48 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
#include "incls/_location.cpp.incl"
void Location::print_on(outputStream* st) const {
if(type() == invalid && !legal_offset_in_bytes(offset() * BytesPerInt)) {
if(type() == invalid) {
// product of Location::invalid_loc() or Location::Location().
switch (where()) {
case on_stack: st->print("empty"); break;
@ -42,6 +42,7 @@ void Location::print_on(outputStream* st) const {
switch (type()) {
case normal: break;
case oop: st->print(",oop"); break;
case narrowoop: st->print(",narrowoop"); break;
case int_in_long: st->print(",int"); break;
case lng: st->print(",long"); break;
case float_in_dbl: st->print(",float"); break;
@ -53,17 +54,17 @@ void Location::print_on(outputStream* st) const {
Location::Location(DebugInfoReadStream* stream) {
_value = (uint16_t) stream->read_int();
_value = (juint) stream->read_int();
}
void Location::write_on(DebugInfoWriteStream* stream) {
stream->write_int(_value & 0x0000FFFF);
stream->write_int(_value);
}
// Valid argument to Location::new_stk_loc()?
bool Location::legal_offset_in_bytes(int offset_in_bytes) {
if ((offset_in_bytes % BytesPerInt) != 0) return false;
return (offset_in_bytes / BytesPerInt) < (OFFSET_MASK >> OFFSET_SHIFT);
return (juint)(offset_in_bytes / BytesPerInt) < (OFFSET_MASK >> OFFSET_SHIFT);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,10 +28,10 @@
//
// Encoding:
//
// bits:
// Where: [15]
// Type: [14..12]
// Offset: [11..0]
// bits (use low bits for best compression):
// Type: [3..0]
// Where: [4]
// Offset: [31..5]
class Location VALUE_OBJ_CLASS_SPEC {
friend class VMStructs;
@ -42,6 +42,7 @@ class Location VALUE_OBJ_CLASS_SPEC {
};
enum Type {
invalid, // Invalid location
normal, // Ints, floats, double halves
oop, // Oop (please GC me!)
int_in_long, // Integer held in long register
@ -49,21 +50,21 @@ class Location VALUE_OBJ_CLASS_SPEC {
float_in_dbl, // Float held in double register
dbl, // Double held in one register
addr, // JSR return address
invalid // Invalid location
narrowoop // Narrow Oop (please GC me!)
};
private:
enum {
OFFSET_MASK = (jchar) 0x0FFF,
OFFSET_SHIFT = 0,
TYPE_MASK = (jchar) 0x7000,
TYPE_SHIFT = 12,
WHERE_MASK = (jchar) 0x8000,
WHERE_SHIFT = 15
TYPE_MASK = (juint) 0x0F,
TYPE_SHIFT = 0,
WHERE_MASK = (juint) 0x10,
WHERE_SHIFT = 4,
OFFSET_MASK = (juint) 0xFFFFFFE0,
OFFSET_SHIFT = 5
};
uint16_t _value;
juint _value;
// Create a bit-packed Location
Location(Where where_, Type type_, unsigned offset_) {
@ -74,9 +75,9 @@ class Location VALUE_OBJ_CLASS_SPEC {
}
inline void set(Where where_, Type type_, unsigned offset_) {
_value = (uint16_t) ((where_ << WHERE_SHIFT) |
(type_ << TYPE_SHIFT) |
((offset_ << OFFSET_SHIFT) & OFFSET_MASK));
_value = (juint) ((where_ << WHERE_SHIFT) |
(type_ << TYPE_SHIFT) |
((offset_ << OFFSET_SHIFT) & OFFSET_MASK));
}
public:
@ -86,7 +87,7 @@ class Location VALUE_OBJ_CLASS_SPEC {
// Register location Factory
static Location new_reg_loc( Type t, VMReg reg ) { return Location(in_register, t, reg->value()); }
// Default constructor
Location() { set(on_stack,invalid,(unsigned) -1); }
Location() { set(on_stack,invalid,0); }
// Bit field accessors
Where where() const { return (Where) ((_value & WHERE_MASK) >> WHERE_SHIFT);}