Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithCPIndex.java @ 1602:136b78722a08
6939203: JSR 292 needs method handle constants
Summary: Add new CP types CONSTANT_MethodHandle, CONSTANT_MethodType; extend 'ldc' bytecode.
Reviewed-by: twisti, never
author | jrose |
---|---|
date | Wed, 09 Jun 2010 18:50:45 -0700 |
parents | c18cbe5936b8 |
children | 0a8e0d4345b3 |
comparison
equal
deleted
inserted
replaced
1585:49fac4acd688 | 1602:136b78722a08 |
---|---|
35 } | 35 } |
36 | 36 |
37 // the constant pool index for this bytecode | 37 // the constant pool index for this bytecode |
38 public int index() { return 0xFFFF & javaShortAt(1); } | 38 public int index() { return 0xFFFF & javaShortAt(1); } |
39 | 39 |
40 public int getSecondaryIndex() { | |
41 throw new IllegalArgumentException("must be invokedynamic"); | |
42 } | |
43 | |
40 protected int indexForFieldOrMethod() { | 44 protected int indexForFieldOrMethod() { |
41 ConstantPoolCache cpCache = method().getConstants().getCache(); | 45 ConstantPoolCache cpCache = method().getConstants().getCache(); |
42 // get ConstantPool index from ConstantPoolCacheIndex at given bci | 46 // get ConstantPool index from ConstantPoolCacheIndex at given bci |
43 int cpCacheIndex = index(); | 47 int cpCacheIndex = index(); |
44 if (cpCache == null) { | 48 if (cpCache == null) { |
45 return cpCacheIndex; | 49 return cpCacheIndex; |
50 } else if (code() == Bytecodes._invokedynamic) { | |
51 int secondaryIndex = getSecondaryIndex(); | |
52 return cpCache.getMainEntryAt(secondaryIndex).getConstantPoolIndex(); | |
46 } else { | 53 } else { |
47 // change byte-ordering and go via cache | 54 // change byte-ordering and go via cache |
48 return cpCache.getEntryAt((int) (0xFFFF & VM.getVM().getBytes().swapShort((short) cpCacheIndex))).getConstantPoolIndex(); | 55 return cpCache.getEntryAt((int) (0xFFFF & VM.getVM().getBytes().swapShort((short) cpCacheIndex))).getConstantPoolIndex(); |
49 } | 56 } |
50 } | 57 } |