Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java @ 23393:1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 12 May 2016 20:57:31 +0200 |
parents | b3a816d3b844 |
children | b5557b757040 |
comparison
equal
deleted
inserted
replaced
23392:b3a816d3b844 | 23393:1d4ce2d19e52 |
---|---|
44 import jdk.vm.ci.meta.ExceptionHandler; | 44 import jdk.vm.ci.meta.ExceptionHandler; |
45 import jdk.vm.ci.meta.JavaConstant; | 45 import jdk.vm.ci.meta.JavaConstant; |
46 import jdk.vm.ci.meta.JavaMethod; | 46 import jdk.vm.ci.meta.JavaMethod; |
47 import jdk.vm.ci.meta.JavaType; | 47 import jdk.vm.ci.meta.JavaType; |
48 import jdk.vm.ci.meta.LineNumberTable; | 48 import jdk.vm.ci.meta.LineNumberTable; |
49 import jdk.vm.ci.meta.LineNumberTableImpl; | |
50 import jdk.vm.ci.meta.Local; | 49 import jdk.vm.ci.meta.Local; |
51 import jdk.vm.ci.meta.LocalImpl; | |
52 import jdk.vm.ci.meta.LocalVariableTable; | 50 import jdk.vm.ci.meta.LocalVariableTable; |
53 import jdk.vm.ci.meta.LocalVariableTableImpl; | |
54 import jdk.vm.ci.meta.ModifiersProvider; | 51 import jdk.vm.ci.meta.ModifiersProvider; |
55 import jdk.vm.ci.meta.ProfilingInfo; | 52 import jdk.vm.ci.meta.ProfilingInfo; |
56 import jdk.vm.ci.meta.ResolvedJavaMethod; | 53 import jdk.vm.ci.meta.ResolvedJavaMethod; |
57 import jdk.vm.ci.meta.ResolvedJavaType; | 54 import jdk.vm.ci.meta.ResolvedJavaType; |
58 import jdk.vm.ci.meta.Signature; | 55 import jdk.vm.ci.meta.Signature; |
60 import jdk.vm.ci.meta.TriState; | 57 import jdk.vm.ci.meta.TriState; |
61 | 58 |
62 /** | 59 /** |
63 * Implementation of {@link JavaMethod} for resolved HotSpot methods. | 60 * Implementation of {@link JavaMethod} for resolved HotSpot methods. |
64 */ | 61 */ |
65 final class HotSpotResolvedJavaMethodImpl extends HotSpotMethod implements HotSpotResolvedJavaMethod, HotSpotProxified, MetaspaceWrapperObject { | 62 final class HotSpotResolvedJavaMethodImpl extends HotSpotMethod implements HotSpotResolvedJavaMethod, MetaspaceWrapperObject { |
66 | 63 |
67 /** | 64 /** |
68 * Reference to metaspace Method object. | 65 * Reference to metaspace Method object. |
69 */ | 66 */ |
70 private final long metaspaceMethod; | 67 private final long metaspaceMethod; |
168 * Returns this method's flags ({@code Method::_flags}). | 165 * Returns this method's flags ({@code Method::_flags}). |
169 * | 166 * |
170 * @return flags of this method | 167 * @return flags of this method |
171 */ | 168 */ |
172 private int getFlags() { | 169 private int getFlags() { |
170 // Important: Size of field changed, JDK8 has u1 and JDK9 u2 | |
173 return UNSAFE.getByte(metaspaceMethod + config().methodFlagsOffset); | 171 return UNSAFE.getByte(metaspaceMethod + config().methodFlagsOffset); |
174 } | 172 } |
175 | 173 |
176 /** | 174 /** |
177 * Returns this method's constant method flags ({@code ConstMethod::_flags}). | 175 * Returns this method's constant method flags ({@code ConstMethod::_flags}). |
570 for (int i = 0; i < values.length / 2; i++) { | 568 for (int i = 0; i < values.length / 2; i++) { |
571 bci[i] = (int) values[i * 2]; | 569 bci[i] = (int) values[i * 2]; |
572 line[i] = (int) values[i * 2 + 1]; | 570 line[i] = (int) values[i * 2 + 1]; |
573 } | 571 } |
574 | 572 |
575 return new LineNumberTableImpl(line, bci); | 573 return new LineNumberTable(line, bci); |
576 } | 574 } |
577 | 575 |
578 @Override | 576 @Override |
579 public LocalVariableTable getLocalVariableTable() { | 577 public LocalVariableTable getLocalVariableTable() { |
580 final boolean hasLocalVariableTable = (getConstMethodFlags() & config().constMethodHasLocalVariableTable) != 0; | 578 final boolean hasLocalVariableTable = (getConstMethodFlags() & config().constMethodHasLocalVariableTable) != 0; |
595 final int slot = UNSAFE.getChar(localVariableTableElement + config.localVariableTableElementSlotOffset); | 593 final int slot = UNSAFE.getChar(localVariableTableElement + config.localVariableTableElementSlotOffset); |
596 | 594 |
597 String localName = getConstantPool().lookupUtf8(nameCpIndex); | 595 String localName = getConstantPool().lookupUtf8(nameCpIndex); |
598 String localType = getConstantPool().lookupUtf8(typeCpIndex); | 596 String localType = getConstantPool().lookupUtf8(typeCpIndex); |
599 | 597 |
600 locals[i] = new LocalImpl(localName, runtime().lookupType(localType, holder, false), startBci, endBci, slot); | 598 locals[i] = new Local(localName, runtime().lookupType(localType, holder, false), startBci, endBci, slot); |
601 | 599 |
602 // Go to the next LocalVariableTableElement | 600 // Go to the next LocalVariableTableElement |
603 localVariableTableElement += config.localVariableTableElementSize; | 601 localVariableTableElement += config.localVariableTableElementSize; |
604 } | 602 } |
605 | 603 |
606 return new LocalVariableTableImpl(locals); | 604 return new LocalVariableTable(locals); |
607 } | 605 } |
608 | 606 |
609 /** | 607 /** |
610 * Returns the offset of this method into the v-table. The method must have a v-table entry as | 608 * Returns the offset of this method into the v-table. The method must have a v-table entry as |
611 * indicated by {@link #isInVirtualMethodTable(ResolvedJavaType)}, otherwise an exception is | 609 * indicated by {@link #isInVirtualMethodTable(ResolvedJavaType)}, otherwise an exception is |