src/share/vm/code/location.hpp

changeset 766
cecd8eb4e0ca
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
     1.1 --- a/src/share/vm/code/location.hpp	Wed Sep 10 14:29:32 2008 -0700
     1.2 +++ b/src/share/vm/code/location.hpp	Wed Sep 10 18:23:32 2008 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * Copyright 1997-2008 Sun Microsystems, Inc.  All Rights Reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -28,10 +28,10 @@
    1.11  //
    1.12  // Encoding:
    1.13  //
    1.14 -// bits:
    1.15 -//  Where:  [15]
    1.16 -//  Type:   [14..12]
    1.17 -//  Offset: [11..0]
    1.18 +// bits (use low bits for best compression):
    1.19 +//  Type:   [3..0]
    1.20 +//  Where:  [4]
    1.21 +//  Offset: [31..5]
    1.22  
    1.23  class Location VALUE_OBJ_CLASS_SPEC {
    1.24    friend class VMStructs;
    1.25 @@ -42,6 +42,7 @@
    1.26    };
    1.27  
    1.28    enum Type {
    1.29 +    invalid,                    // Invalid location
    1.30      normal,                     // Ints, floats, double halves
    1.31      oop,                        // Oop (please GC me!)
    1.32      int_in_long,                // Integer held in long register
    1.33 @@ -49,21 +50,21 @@
    1.34      float_in_dbl,               // Float held in double register
    1.35      dbl,                        // Double held in one register
    1.36      addr,                       // JSR return address
    1.37 -    invalid                     // Invalid location
    1.38 +    narrowoop                   // Narrow Oop (please GC me!)
    1.39    };
    1.40  
    1.41  
    1.42   private:
    1.43    enum {
    1.44 -    OFFSET_MASK  = (jchar) 0x0FFF,
    1.45 -    OFFSET_SHIFT = 0,
    1.46 -    TYPE_MASK    = (jchar) 0x7000,
    1.47 -    TYPE_SHIFT   = 12,
    1.48 -    WHERE_MASK   = (jchar) 0x8000,
    1.49 -    WHERE_SHIFT  = 15
    1.50 +    TYPE_MASK    = (juint) 0x0F,
    1.51 +    TYPE_SHIFT   = 0,
    1.52 +    WHERE_MASK   = (juint) 0x10,
    1.53 +    WHERE_SHIFT  = 4,
    1.54 +    OFFSET_MASK  = (juint) 0xFFFFFFE0,
    1.55 +    OFFSET_SHIFT = 5
    1.56    };
    1.57  
    1.58 -  uint16_t _value;
    1.59 +  juint _value;
    1.60  
    1.61    // Create a bit-packed Location
    1.62    Location(Where where_, Type type_, unsigned offset_) {
    1.63 @@ -74,9 +75,9 @@
    1.64    }
    1.65  
    1.66    inline void set(Where where_, Type type_, unsigned offset_) {
    1.67 -    _value = (uint16_t) ((where_  << WHERE_SHIFT) |
    1.68 -                         (type_   << TYPE_SHIFT)  |
    1.69 -                         ((offset_ << OFFSET_SHIFT) & OFFSET_MASK));
    1.70 +    _value = (juint) ((where_  << WHERE_SHIFT) |
    1.71 +                      (type_   << TYPE_SHIFT)  |
    1.72 +                      ((offset_ << OFFSET_SHIFT) & OFFSET_MASK));
    1.73    }
    1.74  
    1.75   public:
    1.76 @@ -86,7 +87,7 @@
    1.77    // Register location Factory
    1.78    static Location new_reg_loc( Type t, VMReg reg ) { return Location(in_register, t, reg->value()); }
    1.79    // Default constructor
    1.80 -  Location() { set(on_stack,invalid,(unsigned) -1); }
    1.81 +  Location() { set(on_stack,invalid,0); }
    1.82  
    1.83    // Bit field accessors
    1.84    Where where()  const { return (Where)       ((_value & WHERE_MASK)  >> WHERE_SHIFT);}

mercurial