<commit_before>/*
 * Copyright (c) 2002, 2008, Oracle and/or its affiliates. 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
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 *
 */

package sun.jvm.hotspot.debugger.bsd;

import sun.jvm.hotspot.debugger.*;

class BsdAddress implements Address {
    protected BsdDebugger debugger;
    protected long addr;

    BsdAddress(BsdDebugger debugger, long addr) {
        this.debugger = debugger;
        this.addr = addr;
    }

    //
    // Basic Java routines
    //

    public boolean equals(Object arg) {
        if (arg == null) {
            return false;
        }

        if (!(arg instanceof BsdAddress)) {
            return false;
        }

        return (addr == ((BsdAddress) arg).addr);
    }

    public int hashCode() {
        // FIXME: suggestions on a better hash code?
        return (int) addr;
    }

    public String toString() {
        return debugger.addressValueToString(addr);
    }

    //
    // C/C++-related routines
    //

    public long getCIntegerAt(long offset, long numBytes, boolean isUnsigned)
            throws UnalignedAddressException, UnmappedAddressException {
        return debugger.readCInteger(addr + offset, numBytes, isUnsigned);
    }

    public Address getAddressAt(long offset)
            throws UnalignedAddressException, UnmappedAddressException {
        return debugger.readAddress(addr + offset);
    }

    public Address getCompOopAddressAt(long offset)
            throws UnalignedAddressException, UnmappedAddressException {
        return debugger.readCompOopAddress(addr + offset);
    }

    public Address getCompKlassAddressAt(long offset)
            throws UnalignedAddressException, UnmappedAddressException {
        return debugger.readCompOopAddress(addr + offset);
    }

    //
    // Java-related routines
    //

  public boolean getJBooleanAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
    return debugger.readJBoolean(addr + offset);
  }

  public byte getJByteAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
    return debugger.readJByte(addr + offset);
  }

  public char getJCharAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
    return debugger.readJChar(addr + offset);
  }

  public double getJDoubleAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
    return debugger.readJDouble(addr + offset);
  }

  public float getJFloatAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
    return debugger.readJFloat(addr + offset);
  }

  public int getJIntAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
    return debugger.readJInt(addr + offset);
  }<commit_msg>8024176: [macosx] gc/metaspace/ClassMetaspaceSizeInJmapHeap.java failed since jdk8b105, hs25b47 Summary: The code for reading compressed klass pointers in the sa-agent on Mac used readCompOopAddress instead of readCompKlassAddress, this is wrong but has been hidden because compressed oops and compressed klasses has used the same base address in the past. Reviewed-by: sla, jmasa Contributed-by: <EMAIL><commit_after>/*
 * Copyright (c) 2002, 2008, Oracle and/or its affiliates. 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
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 *
 */

package sun.jvm.hotspot.debugger.bsd;

import sun.jvm.hotspot.debugger.*;

class BsdAddress implements Address {
    protected BsdDebugger debugger;
    protected long addr;

    BsdAddress(BsdDebugger debugger, long addr) {
        this.debugger = debugger;
        this.addr = addr;
    }

    //
    // Basic Java routines
    //

    public boolean equals(Object arg) {
        if (arg == null) {
            return false;
        }

        if (!(arg instanceof BsdAddress)) {
            return false;
        }

        return (addr == ((BsdAddress) arg).addr);
    }

    public int hashCode() {
        // FIXME: suggestions on a better hash code?
        return (int) addr;
    }

    public String toString() {
        return debugger.addressValueToString(addr);
    }

    //
    // C/C++-related routines
    //

    public long getCIntegerAt(long offset, long numBytes, boolean isUnsigned)
            throws UnalignedAddressException, UnmappedAddressException {
        return debugger.readCInteger(addr + offset, numBytes, isUnsigned);
    }

    public Address getAddressAt(long offset)
            throws UnalignedAddressException, UnmappedAddressException {
        return debugger.readAddress(addr + offset);
    }

    public Address getCompOopAddressAt(long offset)
            throws UnalignedAddressException, UnmappedAddressException {
        return debugger.readCompOopAddress(addr + offset);
    }

    public Address getCompKlassAddressAt(long offset)
            throws UnalignedAddressException, UnmappedAddressException {
        return debugger.readCompKlassAddress(addr + offset);
    }

    //
    // Java-related routines
    //

  public boolean getJBooleanAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
    return debugger.readJBoolean(addr + offset);
  }

  public byte getJByteAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
    return debugger.readJByte(addr + offset);
  }

  public char getJCharAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
    return debugger.readJChar(addr + offset);
  }

  public double getJDoubleAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
    return debugger.readJDouble(addr + offset);
  }

  public float getJFloatAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
    return debugger.readJFloat(addr + offset);
  }

  public int getJIntAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
    return debugger.readJInt(addr + offset);
  }
{'fraction_non_alphanumeric': 0.0701799818723294, 'fraction_numerical': 0.009711252104104623, 'mean_word_length': 3.3368893879842787, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5564050', 'n_tokens_mistral': 2133, 'n_tokens_neox': 2029, 'n_words': 725}