Skip to content

8202100: Merge vm/share/InMemoryJavaCompiler w/ jdk/test/lib/compiler/InMemoryJavaCompiler #3606

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
Expand Up @@ -37,7 +37,8 @@
* jdk/test/lib/compiler/InMemoryJavaCompiler
* jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper$1
* jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper
* jdk/test/lib/compiler/InMemoryJavaCompiler$MemoryJavaFileObject
* jdk/test/lib/compiler/InMemoryJavaCompiler$SourceFile
* jdk/test/lib/compiler/InMemoryJavaCompiler$ClassFile
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. LambdaProxyCallerIsHidden
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -35,7 +35,8 @@
* jdk/test/lib/compiler/InMemoryJavaCompiler
* jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper$1
* jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper
* jdk/test/lib/compiler/InMemoryJavaCompiler$MemoryJavaFileObject
* jdk/test/lib/compiler/InMemoryJavaCompiler$SourceFile
* jdk/test/lib/compiler/InMemoryJavaCompiler$ClassFile
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. RegularHiddenClass
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -47,7 +47,8 @@ public class RedefineBasicTest {
"jdk/test/lib/compiler/InMemoryJavaCompiler",
"jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper",
"jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper$1",
"jdk/test/lib/compiler/InMemoryJavaCompiler$MemoryJavaFileObject"
"jdk/test/lib/compiler/InMemoryJavaCompiler$SourceFile",
"jdk/test/lib/compiler/InMemoryJavaCompiler$ClassFile"
};

public static void main(String[] args) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -50,7 +50,8 @@ public class RedefineRunningMethods_Shared {
"jdk/test/lib/compiler/InMemoryJavaCompiler",
"jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper",
"jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper$1",
"jdk/test/lib/compiler/InMemoryJavaCompiler$MemoryJavaFileObject"
"jdk/test/lib/compiler/InMemoryJavaCompiler$SourceFile",
"jdk/test/lib/compiler/InMemoryJavaCompiler$ClassFile"
};

public static void main(String[] args) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -26,7 +26,7 @@
import java.util.Map;
import java.util.Random;

import vm.share.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;

/**
* BytecodeFactory that employs in memory compilation.
Expand All @@ -44,12 +44,10 @@ public BytecodeGeneratorFactory(long seed) {

@Override
public Bytecode createBytecode(String className) {
Map<String, CharSequence> sources = new HashMap<String, CharSequence>();
sources.put(className, sourceGenerator.generateSource(className,
byte[] bytecode = InMemoryJavaCompiler.compile(className, sourceGenerator.generateSource(className,
"public static void main() { System.out.println(\"From main method in in-mem-compiled code " + random.nextGaussian() +
" + str_bytesToReplace0 str_bytesToReplace1\"); }\n " +
"public static int methodForCompilation(Object object) { int i = object.hashCode(); i = i * 2000 / 1994 + 153; return i; }\n"));
byte[] bytecode = InMemoryJavaCompiler.compile(sources).values().iterator().next();
return new Bytecode(className, bytecode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import java.util.Map;
import java.util.Random;

import vm.share.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import nsk.share.gc.GCTestBase;
import nsk.share.test.ExecutionController;
import nsk.share.test.Stresser;
Expand Down Expand Up @@ -210,9 +210,7 @@ private void checkStaticFields(Class clazz) {
}

private byte[] generateAndCompile(int[] fieldQuantities) {
Map<String, CharSequence> sources = new HashMap<String, CharSequence>();
sources.put("A", generateSource(fieldQuantities));
return InMemoryJavaCompiler.compile(sources).values().iterator().next();
return InMemoryJavaCompiler.compile("A", generateSource(fieldQuantities));
}

private StringBuffer generateSource(int[] fieldQuantities) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -43,7 +43,7 @@

import nsk.share.gc.GCTestBase;
import nsk.share.test.*;
import vm.share.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;

/**
* There is a data structure named "dictionary" in class BlockFreelist. It stores
Expand Down Expand Up @@ -178,10 +178,8 @@ public void run() {
}

private byte[] generateAndCompile() {
Map<String, CharSequence> sources = new HashMap<String, CharSequence>();
String className = "MyClass" + classesCounter.incrementAndGet();
sources.put(className, generateSource(className));
return InMemoryJavaCompiler.compile(sources).values().iterator().next();
return InMemoryJavaCompiler.compile(className, generateSource(className));
}

private CharSequence generateSource(String className) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,7 @@

import java.util.*;

import vm.share.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;
import jdk.test.lib.Utils;

public class GenerateHierarchyHelper {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -21,7 +21,6 @@
* questions.
*/

//package nsk.jvmti.RedefineClasses.StressRedefine;
package nsk.jvmti.RedefineClasses;


Expand All @@ -41,7 +40,7 @@
import nsk.share.test.Stresser;
import nsk.share.test.Tests;

import vm.share.InMemoryJavaCompiler;
import jdk.test.lib.compiler.InMemoryJavaCompiler;

/**
* There is a data structure named "dictionary" in class BlockFreelist. It stores
Expand Down Expand Up @@ -191,9 +190,7 @@ private void runIt() {
}

private static byte[] generateAndCompile() {
Map<String, CharSequence> sources = new HashMap<String, CharSequence>();
sources.put(GenerateSourceHelper.CLASS_NAME, GenerateSourceHelper.generateSource());
return InMemoryJavaCompiler.compile(sources).values().iterator().next();
return InMemoryJavaCompiler.compile(GenerateSourceHelper.CLASS_NAME, GenerateSourceHelper.generateSource());
}

// Auxiliary classloader. Used only once at the beginning.
Expand Down
125 changes: 0 additions & 125 deletions test/hotspot/jtreg/vmTestbase/vm/share/InMemoryJavaCompiler.java

This file was deleted.

Loading