United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-8007037 : JSR 292: the VM_RedefineClasses::append_entry() should do cross-checks with indy operands

Details
Type:
Bug
Submit Date:
2013-01-28
Status:
Resolved
Updated Date:
2014-09-04
Project Name:
JDK
Resolved Date:
2013-04-25
Component:
hotspot
OS:
generic
Sub-Component:
jvmti
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs20,hs23,hs24,hs25,7u60
Fixed Versions:
hs25 (b31)

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:
Duplicate:
Duplicate:
Relates:
Relates:

Sub Tasks

Description
The bug  https://jbs.oracle.com/bugs/browse/JDK-8006542 requires to add a support for
new CP entry kinds into the VM_RedefineClasses::append_entry():
   - JVM_CONSTANT_MethodType
   - JVM_CONSTANT_MethodHandle
   - JVM_CONSTANT_InvokeDynamic

This bug tracks that the append_entry() should also do necessary recursive cross-checks with the bootstrap method operands (arguments) attribute and append missed CP entries and operands if necessary. 

                                    

Comments
Modified the filed "Affects Version's" according to the closed bug 7016264 as a dup of this one.
                                     
2013-03-27
This is a better description of the issue:

References from INDY bootstrap method specifier operands to CP entries
and back must be correctly merged at class redefinition.

Some background.

An invokedynamic bytecode spec:
   http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.invokedynamic

A invokedynamic instruction has an argument which is an index to the Constant Pool item.
That index must be a symbolic reference to a call-site specifier:
   http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.4.10

A CP item of the type CONSTANT_InvokeDynamic_inf has an index into
the bootstrap method attribute of the class file:
   http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.21

The BootstrapMethods attribute elements normally have references to other Constant Pool items.

In VM the bootstrap method attribute is represented by the operands array of the ConstantPool.

The problem is is that all the force and back cross links between ConstantPool elements
and operands array elements must be correctly merged at class redefinition.
                                     
2013-04-01
URL:   http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/15a99ca4ee34
User:  sspitsyn
Date:  2013-04-25 14:26:01 +0000

                                     
2013-04-25
URL:   http://hg.openjdk.java.net/hsx/hsx25/hotspot/rev/15a99ca4ee34
User:  amurillo
Date:  2013-05-03 18:40:10 +0000

                                     
2013-05-03
This fix is broken:

+ bool match = compare_entry_to(k1, cp2, k2, CHECK_false) &&
+ compare_operand_to(i1, cp2, i2, CHECK_false); 

You can not use CHECK_ macros on functions that are then subject to boolean comparison. The above will expand to:

bool match = compare_entry_to(k1, cp2, k2, THREAD); 
if (HAS_PENDING_EXCEPTION) return false; 
(0) && compare_operand_to(i1, cp2, i2, THREAD); 
if (HAS_PENDING_EXCEPTION) return false; 
(0);

So match has the wrong value.

See discussion from:

http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2013-May/007332.html


                                     
2013-05-21
7u60-critical-request justification:

This bug fix is better to be in the release because it is a part of the JSR-292 support
in the JVMTI HotSwap API (includes RedefineClasses, RetransformClasses and PopFrame).

This bug is one of 12 bug fixes that depend on each other and must be integrated
in the order:
  https://jbs.oracle.com/bugs/browse/JDK-7194607
  https://jbs.oracle.com/bugs/browse/JDK-8005128
  https://jbs.oracle.com/bugs/browse/JDK-8006542
  https://jbs.oracle.com/bugs/browse/JDK-8006546
  https://jbs.oracle.com/bugs/browse/JDK-8006731
  https://jbs.oracle.com/bugs/browse/JDK-8008511
  https://jbs.oracle.com/bugs/browse/JDK-8007037
  https://jbs.oracle.com/bugs/browse/JDK-8014288
  https://jbs.oracle.com/bugs/browse/JDK-8013945
  https://jbs.oracle.com/bugs/browse/JDK-8014052
  https://jbs.oracle.com/bugs/browse/JDK-7187554
  https://jbs.oracle.com/bugs/browse/JDK-8023004

All the fixes above have been already integrated into the JDK 8
and tested in the hotspot-rt nightly for several months.

Risk: low
  The fixes touch the JVMTI HotSwap API that includes RedefineClasses, RetransformClasses and PopFrame.
  The risk is only to introduce regressions in this part of the JVMTI implementation.
  This impacts only the debugging and profiling tools that use the JVMTI HotSwap feature.
  There are very small chances for regressions to sneak into the class file
  constant pool processing and method handles implementation.

Webrevs and reviewers:
  The 7u60 webrevs location is:
    http://javaweb.sfbay.sun.com/java/svc/ss45998/webrevs/2013/hotspot/7u_port/

  The fixes above were already passed the review process before integration
  into JDK 8. The reviewers were: twisti, jrose, coleenp, dholmes, etc.
  The 7u60 edition of fixes must be reviewed at least by jrose and twisti.

Level of effort:
  All fixes need a secondary review phase after rebase from jdk8 to 7u60 repository.

Testing coverage:
  The folllowing test suites must be run to ensure correctness of the fixes:
    JTREG tests: com/sun/jdi, java/lang/instrument
    NSK tests: vm.mlvm.testlist, nsk.jvmti.testlist, nsk.jdi.testlist, nsk.jdwp.testlist

Result of not integrating:
  The users will not be able to use HotSwap technology for debuging and profiling
  Java code that depends on the JSR-292 implementation.
  In that case the integration of these fixes will have to be requested/escalated
  in 7 updates by the tool vendors and/or customers.

                                     
2014-01-10



Hardware and Software, Engineered to Work Together