CIntField.java revision 9883:903a2e023ffb
135124Sjb/*
235124Sjb * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
335124Sjb * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
435124Sjb *
535124Sjb * This code is free software; you can redistribute it and/or modify it
635124Sjb * under the terms of the GNU General Public License version 2 only, as
735124Sjb * published by the Free Software Foundation.
835124Sjb *
935124Sjb * This code is distributed in the hope that it will be useful, but WITHOUT
1035124Sjb * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1135124Sjb * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1235124Sjb * version 2 for more details (a copy is included in the LICENSE file that
13165968Simp * accompanied this code).
1435124Sjb *
1535124Sjb * You should have received a copy of the GNU General Public License version
1635124Sjb * 2 along with this work; if not, write to the Free Software Foundation,
1735124Sjb * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1835124Sjb *
1935124Sjb * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2035124Sjb * or visit www.oracle.com if you need additional information or have any
2135124Sjb * questions.
2235124Sjb *
2335124Sjb */
2435124Sjb
2535124Sjbpackage sun.jvm.hotspot.oops;
2635124Sjb
2735124Sjbimport sun.jvm.hotspot.runtime.VMObject;
2835124Sjbimport sun.jvm.hotspot.debugger.*;
2950476Speter
3035124Sjb// The class for an C int field simply provides access to the value.
3135124Sjbpublic class CIntField extends Field {
3235124Sjb
3335124Sjb  public CIntField(sun.jvm.hotspot.types.CIntegerField vmField, long startOffset) {
3435124Sjb    super(new NamedFieldIdentifier(vmField.getName()), vmField.getOffset() + startOffset, true);
3535124Sjb    size       = vmField.getSize();
3635124Sjb    isUnsigned = ((sun.jvm.hotspot.types.CIntegerType) vmField.getType()).isUnsigned();
37237434Skib  }
38199606Sjhb
3935124Sjb  private long size;
4035124Sjb  private boolean isUnsigned;
4135124Sjb
4235124Sjb  public long getValue(Oop obj) {
4335124Sjb    return getValue(obj.getHandle());
4435124Sjb  }
4535124Sjb  public long getValue(VMObject obj) {
4635124Sjb    return getValue(obj.getAddress());
4735124Sjb  }
48231868Skib  public long getValue(Address addr) {
49231868Skib    return addr.getCIntegerAt(getOffset(), size, isUnsigned);
50231868Skib  }
51231868Skib  public void setValue(Oop obj, long value) throws MutationException {
52231868Skib    // Fix this: set* missing in Address
53231868Skib  }
54231868Skib}
55231868Skib