equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. 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. |
132 |
132 |
133 public G1HeapRegionTable(Address addr) { |
133 public G1HeapRegionTable(Address addr) { |
134 super(addr); |
134 super(addr); |
135 } |
135 } |
136 |
136 |
137 public HeapRegion getByAddress(Address addr) { |
137 public HeapRegion getByAddress(Address target) { |
138 long biasedIndex = addr.asLongValue() >>> shiftBy(); |
138 Address arrayAddr = biasedBaseField.getValue(addr); |
|
139 long biasedIndex = target.asLongValue() >>> shiftBy(); |
139 long offset = biasedIndex * HeapRegion.getPointerSize(); |
140 long offset = biasedIndex * HeapRegion.getPointerSize(); |
140 Address result = (addr instanceof OopHandle) ? addr.addOffsetToAsOopHandle(offset) |
141 Address regionAddr = arrayAddr.getAddressAt(offset); |
141 : addr.addOffsetTo(offset); |
142 return (HeapRegion)VMObjectFactory.newObject(HeapRegion.class, regionAddr); |
142 return new HeapRegion(result); |
|
143 } |
143 } |
144 } |
144 } |