Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8289613: Drop use of Thread.stop in jshell #10166

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -93,10 +93,10 @@ public void visitJumpInsn(int opcode, Label label) {
}

private static ClassBytecodes genCancelClass() {
var cancelWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES|ClassWriter.COMPUTE_MAXS);
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);
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();
@@ -116,7 +116,7 @@ private static ClassBytecodes genCancelClass() {
@Override
protected String invoke(Method doitMethod) throws Exception {
if (allStop == null) {
super.load(new ClassBytecodes[]{genCancelClass()});
super.load(new ClassBytecodes[]{ genCancelClass() });
allStop = findClass("REPL.$Cancel$").getDeclaredField("allStop");
}
allStop.set(null, false);
@@ -196,8 +196,8 @@ public void stop() throws EngineTerminationException, InternalException {
}
try {
allStop.set(null, true);
} catch (IllegalArgumentException| IllegalAccessException ex) {
throw new InternalException(ex.getMessage());
} catch (IllegalArgumentException | IllegalAccessException ex) {
throw new InternalException("Exception on local stop: " + ex);
}
Thread[] threads;
int len, threadCount;