comparison agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java @ 1660:083fde3b838e

6964498: JSR 292 invokedynamic sites need local bootstrap methods Summary: Add JVM_CONSTANT_InvokeDynamic records to constant pool to determine per-instruction BSMs. Reviewed-by: twisti
author jrose
date Thu, 15 Jul 2010 18:40:45 -0700
parents 136b78722a08
children 3b2dea75431e
comparison
equal deleted inserted replaced
1649:a528509c992b 1660:083fde3b838e
295 case JVM_CONSTANT_Methodref: return "JVM_CONSTANT_Methodref"; 295 case JVM_CONSTANT_Methodref: return "JVM_CONSTANT_Methodref";
296 case JVM_CONSTANT_InterfaceMethodref: return "JVM_CONSTANT_InterfaceMethodref"; 296 case JVM_CONSTANT_InterfaceMethodref: return "JVM_CONSTANT_InterfaceMethodref";
297 case JVM_CONSTANT_NameAndType: return "JVM_CONSTANT_NameAndType"; 297 case JVM_CONSTANT_NameAndType: return "JVM_CONSTANT_NameAndType";
298 case JVM_CONSTANT_MethodHandle: return "JVM_CONSTANT_MethodHandle"; 298 case JVM_CONSTANT_MethodHandle: return "JVM_CONSTANT_MethodHandle";
299 case JVM_CONSTANT_MethodType: return "JVM_CONSTANT_MethodType"; 299 case JVM_CONSTANT_MethodType: return "JVM_CONSTANT_MethodType";
300 case JVM_CONSTANT_InvokeDynamic: return "JVM_CONSTANT_InvokeDynamic";
300 case JVM_CONSTANT_Invalid: return "JVM_CONSTANT_Invalid"; 301 case JVM_CONSTANT_Invalid: return "JVM_CONSTANT_Invalid";
301 case JVM_CONSTANT_UnresolvedClass: return "JVM_CONSTANT_UnresolvedClass"; 302 case JVM_CONSTANT_UnresolvedClass: return "JVM_CONSTANT_UnresolvedClass";
302 case JVM_CONSTANT_UnresolvedClassInError: return "JVM_CONSTANT_UnresolvedClassInError"; 303 case JVM_CONSTANT_UnresolvedClassInError: return "JVM_CONSTANT_UnresolvedClassInError";
303 case JVM_CONSTANT_ClassIndex: return "JVM_CONSTANT_ClassIndex"; 304 case JVM_CONSTANT_ClassIndex: return "JVM_CONSTANT_ClassIndex";
304 case JVM_CONSTANT_UnresolvedString: return "JVM_CONSTANT_UnresolvedString"; 305 case JVM_CONSTANT_UnresolvedString: return "JVM_CONSTANT_UnresolvedString";
353 case JVM_CONSTANT_Methodref: 354 case JVM_CONSTANT_Methodref:
354 case JVM_CONSTANT_InterfaceMethodref: 355 case JVM_CONSTANT_InterfaceMethodref:
355 case JVM_CONSTANT_NameAndType: 356 case JVM_CONSTANT_NameAndType:
356 case JVM_CONSTANT_MethodHandle: 357 case JVM_CONSTANT_MethodHandle:
357 case JVM_CONSTANT_MethodType: 358 case JVM_CONSTANT_MethodType:
359 case JVM_CONSTANT_InvokeDynamic:
358 visitor.doInt(new IntField(new NamedFieldIdentifier(nameForTag(ctag)), indexOffset(index), true), true); 360 visitor.doInt(new IntField(new NamedFieldIdentifier(nameForTag(ctag)), indexOffset(index), true), true);
359 break; 361 break;
360 } 362 }
361 } 363 }
362 } 364 }
515 dos.writeShort(signatureIndex); 517 dos.writeShort(signatureIndex);
516 if (DEBUG) debugMessage("CP[" + ci + "] = N&T name = " + nameIndex 518 if (DEBUG) debugMessage("CP[" + ci + "] = N&T name = " + nameIndex
517 + ", type = " + signatureIndex); 519 + ", type = " + signatureIndex);
518 break; 520 break;
519 } 521 }
522
523 case JVM_CONSTANT_InvokeDynamic: {
524 dos.writeByte(cpConstType);
525 int value = getIntAt(ci);
526 short bootstrapMethodIndex = (short) extractLowShortFromInt(value);
527 short nameAndTypeIndex = (short) extractHighShortFromInt(value);
528 dos.writeShort(bootstrapMethodIndex);
529 dos.writeShort(nameAndTypeIndex);
530 if (DEBUG) debugMessage("CP[" + ci + "] = indy BSM = " + bootstrapMethodIndex
531 + ", N&T = " + nameAndTypeIndex);
532 break;
533 }
520 default: 534 default:
521 throw new InternalError("unknown tag: " + cpConstType); 535 throw new InternalError("unknown tag: " + cpConstType);
522 } // switch 536 } // switch
523 } 537 }
524 dos.flush(); 538 dos.flush();