Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: openjdk/jdk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b1d89f30
Choose a base ref
...
head repository: openjdk/jdk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 070be0a8
Choose a head ref

Commits on Jun 10, 2022

  1. Copy the full SHA
    34c6057 View commit details

Commits on Jun 13, 2022

  1. fix of javadoc link

    asotona committed Jun 13, 2022
    Copy the full SHA
    6663f05 View commit details
  2. Copy the full SHA
    63d0e3b View commit details

Commits on Jun 14, 2022

  1. Update README.md

    asotona authored Jun 14, 2022
    Copy the full SHA
    02bf8b4 View commit details

Commits on Jun 21, 2022

  1. Copy the full SHA
    e1386df View commit details

Commits on Jun 24, 2022

  1. Tweak JEP link

    mcimadamore authored Jun 24, 2022
    Copy the full SHA
    0daac4a View commit details

Commits on Jun 27, 2022

  1. Copy the full SHA
    a5a2580 View commit details
  2. removal of jdk.classfile.jdktypes.AccessFlag and redirection to java.…

    …lang.reflect.AccesFlag in Classfile API and tests
    asotona committed Jun 27, 2022
    Copy the full SHA
    b5267ad View commit details
  3. Copy the full SHA
    941dfb0 View commit details

Commits on Jun 29, 2022

  1. fixed InvokeDynamicEntry::asSymbol and BytecodeHelpers::handleDescToH…

    …andleInfo
    
    implemented RebuildingTransformation and added to Transforms and CorpusTest
    reduced CorpusTestHelper output and adjusted TEST.properties
    asotona committed Jun 29, 2022
    Copy the full SHA
    0fe61c5 View commit details

Commits on Jun 30, 2022

  1. added ConstantValueAttribute::of(ConstantDesc)

    MethodParameterInfo name parameter changed to Optional
    added MethodParameterInfo::ofParameter(Optional<String>,int)
    implemented TemporaryConstantPool::stringEntry
    adjusted BoundAttribute and RebuildingTransformation test helper
    asotona committed Jun 30, 2022
    Copy the full SHA
    a89d822 View commit details
  2. added CompilationIDAttribute::of(String)

    EnclosingMethodAttribute factory method changed to accept Optionals
    added EnclosingMethodAttribute::of(ClassDesc,Optional<String>,Optional<MethodTypeDesc>)
    added EnclosingMethodAttribute accessor methods
    InnerClassInfo all factory methods changed to accept Optionals
    added NestHostAttribute::of(ClassDesc)
    added SourceIDAttribute::of(String)
    changes reflected in BoundAttribute and RebuildTransformation test helper
    asotona committed Jun 30, 2022
    Copy the full SHA
    7bf66b1 View commit details

Commits on Jul 1, 2022

  1. TypeAnnotation and AnnotationValue API improvements

    * added TypeAnnotation factory methods accepting ClassDesc and AnnotationElement...
    AnnotationValue.OfConstant sub-classed to allow switch pattern matching
    RebuildingTransformation test helper adjusted
    
    * added TypeAnnotation.TargetInfo factory methods with validity checking for multi-target types
    adjusted RebuildTransformation test helper
    asotona authored Jul 1, 2022
    Copy the full SHA
    bb7e294 View commit details
  2. refactored to FieldModel::fieldTypeSymbol and MethodModel::methodType…

    …Symbol (#13)
    
    refactored to FieldModel::fieldTypeSymbol and MethodModel::methodTypeSymbol (#13)
    added round testing of signatures in RebuildTransformation test helper
    asotona authored Jul 1, 2022
    Copy the full SHA
    d8f30a7 View commit details

Commits on Jul 4, 2022

  1. Model stack map frames in a type hierarchy where each type represents…

    … a frame type.
    
     Doing so, make the chop size available to consumers of frames.
    raphw authored and asotona committed Jul 4, 2022
    Copy the full SHA
    59479ff View commit details
  2. Copy the full SHA
    28f560e View commit details
  3. Copy the full SHA
    99a17b3 View commit details
  4. Copy the full SHA
    f2ac770 View commit details
  5. Copy the full SHA
    8480163 View commit details

Commits on Jul 7, 2022

  1. Copy the full SHA
    ace0f43 View commit details
  2. Update README.md

    asotona authored Jul 7, 2022
    Copy the full SHA
    a98f860 View commit details

Commits on Jul 8, 2022

  1. Copy the full SHA
    4b69c9c View commit details

Commits on Jul 11, 2022

  1. Copy the full SHA
    0631349 View commit details
  2. Copy the full SHA
    1950b1f View commit details

Commits on Jul 12, 2022

  1. Copy the full SHA
    e14f3a5 View commit details

Commits on Jul 13, 2022

  1. Copy the full SHA
    5cbe442 View commit details

Commits on Jul 15, 2022

  1. Copy the full SHA
    a1502e3 View commit details
  2. Copy the full SHA
    4b5620e View commit details

Commits on Jul 19, 2022

  1. Copy the full SHA
    0c80bff View commit details
  2. Classfile try catch

    PaulSandoz authored Jul 19, 2022
    Copy the full SHA
    4c730ed View commit details
  3. Copy the full SHA
    28cb754 View commit details
  4. Copy the full SHA
    3369fbb View commit details

Commits on Jul 20, 2022

  1. Copy the full SHA
    e76ed5f View commit details
  2. Copy the full SHA
    b5e9ac3 View commit details

Commits on Jul 21, 2022

  1. Ifthenelse (#28)

    * Enhance ifThenElse.
    
    * Expose block builder with break label.
    
    * Docs and tests.
    
    * Doc.
    
    * Review feedback.
    
    * Unused import.
    PaulSandoz authored Jul 21, 2022
    Copy the full SHA
    482add7 View commit details

Commits on Jul 22, 2022

  1. ClassRemapper implemenation handling RecordAttribute, InnerClassesAtt…

    …ribute, EnclosingMethodAttribute, Annotations, TypeAnnotations, ParameterAnnotations and LoadableConstants
    asotona committed Jul 22, 2022
    Copy the full SHA
    34e72c5 View commit details
  2. Copy the full SHA
    946a382 View commit details

Commits on Aug 3, 2022

  1. Copy the full SHA
    269e529 View commit details
  2. Copy the full SHA
    2b471fc View commit details
  3. StackMapGenerator appends detailed debug info about corrupted bytecod…

    …e in case of an error
    
    - previous debug logging and TRACE and DEBUG switches have been removed
    asotona committed Aug 3, 2022
    Copy the full SHA
    2c988df View commit details
  4. Opcode.ISHR and LSHR fix

    asotona committed Aug 3, 2022
    Copy the full SHA
    3902fd2 View commit details

Commits on Aug 4, 2022

  1. Copy the full SHA
    b83633c View commit details
  2. Copy the full SHA
    6c8f57a View commit details

Commits on Aug 18, 2022

  1. Classfile API stack map manual processing (#32)

    * removed FrameKind from StackMapTableAttribute and offsets replaced with labels in StackMapFrames
    
    * simplification of StackMapFrame, removal of compressed sub-types
    
    * Implemented UnboundStackMapTableAttribute and added related factory methods
    dropped VerificationType
    SimpleVerificationTypeInfo refactored to enum
    
    * implemented StackMapTableAttribute compression and writing
    
    * StackMapTableAttribute extends CodeElement
    
    * added Classfile.Option.processStackMaps
    enable stack maps processing in RebuildingTransformation test helper
    fixed UninitializedVerificationTypeInfo labels resolution
    
    * fixed Opcode
    
    * enable unordered StackMapTableAttribute entries
    
    * removal of PROCESS_STACK_MAPS option
    generated stack maps override user content
    adjusted labels inflation from stack maps
    
    * minor patch in RebuildingTransformation test helper
    asotona authored Aug 18, 2022
    Copy the full SHA
    76b09c5 View commit details
  2. removed obsolete toString

    asotona committed Aug 18, 2022
    Copy the full SHA
    ced8ffa View commit details
  3. Copy the full SHA
    b547682 View commit details
  4. Copy the full SHA
    de17a3b View commit details

Commits on Aug 19, 2022

  1. Classfile api label resolver branch (#33)

    * removed impl.LabelResolver
    * labelToBci moved to CodeAttribute and impl.LabelContext
    * removed labelToBci from CodeBuilder
    asotona authored Aug 19, 2022
    Copy the full SHA
    cb17b0f View commit details

Commits on Aug 30, 2022

  1. fixed LabelsRemapper

    asotona committed Aug 30, 2022
    Copy the full SHA
    15ba3cd View commit details
  2. Copy the full SHA
    674791a View commit details
Showing with 33 additions and 44 deletions.
  1. +5 −4 src/java.base/share/classes/module-info.java
  2. +28 −40 src/jdk.jshell/share/classes/jdk/jshell/execution/LocalExecutionControl.java
9 changes: 5 additions & 4 deletions src/java.base/share/classes/module-info.java
Original file line number Diff line number Diff line change
@@ -191,12 +191,14 @@
exports jdk.internal.logger to
java.logging;
exports jdk.internal.classfile to
jdk.jlink;
jdk.jlink,
jdk.jshell;
exports jdk.internal.classfile.instruction to
jdk.jshell;
exports jdk.internal.org.objectweb.asm to
jdk.jartool,
jdk.jfr,
jdk.jlink,
jdk.jshell;
jdk.jlink;
exports jdk.internal.org.objectweb.asm.tree to
jdk.jfr,
jdk.jlink;
@@ -381,7 +383,6 @@
java.prefs;
exports sun.util.resources to
jdk.localedata;

// the service types defined by the APIs in this module

uses java.lang.System.LoggerFinder;
Original file line number Diff line number Diff line change
@@ -24,17 +24,17 @@
*/
package jdk.jshell.execution;

import java.lang.constant.ClassDesc;
import java.lang.constant.ConstantDescs;
import java.lang.constant.MethodTypeDesc;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Stream;
import jdk.internal.org.objectweb.asm.ClassReader;
import jdk.internal.org.objectweb.asm.ClassVisitor;
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.Label;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.classfile.Classfile;
import jdk.internal.classfile.ClassTransform;
import jdk.internal.classfile.instruction.BranchInstruction;

/**
* An implementation of {@link jdk.jshell.spi.ExecutionControl} which executes
@@ -74,51 +74,39 @@ public void load(ClassBytecodes[] cbcs)
.toArray(ClassBytecodes[]::new));
}

private static final String CANCEL_CLASS = "REPL.$Cancel$";
private static final ClassDesc CD_Cancel = ClassDesc.of(CANCEL_CLASS);
private static final ClassDesc CD_ThreadDeath = ClassDesc.of("java.lang.ThreadDeath");
private static final MethodTypeDesc MTD_void = MethodTypeDesc.of(ConstantDescs.CD_void);

private static byte[] instrument(byte[] classFile) {
var reader = new ClassReader(classFile);
var writer = new ClassWriter(reader, 0);
reader.accept(new ClassVisitor(Opcodes.ASM9, writer) {
@Override
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
return new MethodVisitor(Opcodes.ASM9, super.visitMethod(access, name, descriptor, signature, exceptions)) {
@Override
public void visitJumpInsn(int opcode, Label label) {
visitMethodInsn(Opcodes.INVOKESTATIC, "REPL/$Cancel$", "stopCheck", "()V", false);
super.visitJumpInsn(opcode, label);
}
};
}
}, 0);
return writer.toByteArray();
return Classfile.parse(classFile)
.transform(ClassTransform.transformingMethodBodies((cob, coe) -> {
if (coe instanceof BranchInstruction)
cob.invokestatic(CD_Cancel, "stopCheck", MTD_void);
cob.with(coe);
}));
}

private static ClassBytecodes genCancelClass() {
var cancelWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
cancelWriter.visit(Opcodes.V19, Opcodes.ACC_PUBLIC, "REPL/$Cancel$", null, "java/lang/Object", null);
cancelWriter.visitField(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_VOLATILE, "allStop", "Z", null, null);
var checkVisitor = cancelWriter.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "stopCheck", "()V", null, null);
checkVisitor.visitCode();
checkVisitor.visitFieldInsn(Opcodes.GETSTATIC, "REPL/$Cancel$", "allStop", "Z");
var skip = new Label();
checkVisitor.visitJumpInsn(Opcodes.IFEQ, skip);
checkVisitor.visitTypeInsn(Opcodes.NEW, "java/lang/ThreadDeath");
checkVisitor.visitInsn(Opcodes.DUP);
checkVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/ThreadDeath", "<init>", "()V", false);
checkVisitor.visitInsn(Opcodes.ATHROW);
checkVisitor.visitLabel(skip);
checkVisitor.visitInsn(Opcodes.RETURN);
checkVisitor.visitMaxs(0, 0);
checkVisitor.visitEnd();
cancelWriter.visitEnd();
return new ClassBytecodes("REPL.$Cancel$", cancelWriter.toByteArray());
return new ClassBytecodes(CANCEL_CLASS, Classfile.build(CD_Cancel, clb ->
clb.withFlags(Classfile.ACC_PUBLIC)
.withField("allStop", ConstantDescs.CD_boolean, Classfile.ACC_PUBLIC | Classfile.ACC_STATIC | Classfile.ACC_VOLATILE)
.withMethodBody("stopCheck", MTD_void, Classfile.ACC_PUBLIC | Classfile.ACC_STATIC, cob ->
cob.getstatic(CD_Cancel, "allStop", ConstantDescs.CD_boolean)
.ifThenElse(tb -> tb.new_(CD_ThreadDeath)
.dup()
.invokespecial(CD_ThreadDeath, "<init>", MTD_void)
.athrow(),
eb -> eb.return_()))));
}

@Override
@SuppressWarnings("removal")
protected String invoke(Method doitMethod) throws Exception {
if (allStop == null) {
super.load(new ClassBytecodes[]{ genCancelClass() });
allStop = findClass("REPL.$Cancel$").getDeclaredField("allStop");
allStop = findClass(CANCEL_CLASS).getDeclaredField("allStop");
}
allStop.set(null, false);