Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
58fbdec
Add additional version of DynComp for Java 24
markro49 Mar 26, 2025
3f1d74d
start to modifiy DCInstrument24
markro49 Mar 29, 2025
9c8c170
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Mar 29, 2025
b323711
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Apr 21, 2025
b2f7495
add more debugging output
markro49 Apr 23, 2025
9971454
add support for BcelUtils24
markro49 Apr 23, 2025
688f5e0
add more debuggin output
markro49 Apr 23, 2025
6c5ff33
minor cleanup
markro49 Apr 23, 2025
ee75302
checkpoint current work
markro49 Apr 23, 2025
7af6dc6
checkpoint current work
markro49 Apr 23, 2025
f010651
fix errorprone warning
markro49 Apr 24, 2025
f3c747d
fix problem in getClassModel
markro49 Apr 24, 2025
c247599
fix Mullness Checker issue
markro49 Apr 24, 2025
eb25fa5
need IOUtils from Apache commons.io
markro49 Apr 24, 2025
6c3af63
improve debug output
markro49 Apr 26, 2025
25eb429
adjust for compiler bug; improve signature checker annotations
markro49 Apr 26, 2025
517b4cc
improve signature checker annotations
markro49 Apr 26, 2025
2359ad0
rearrange constantPoolBuilder
markro49 Apr 26, 2025
05b972e
fix errorprone issues; turn off some debug output
markro49 Apr 27, 2025
f83a061
fix local variables table
markro49 Apr 28, 2025
21535c6
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Apr 30, 2025
d892d4d
checkpoint current work
markro49 May 4, 2025
d82b918
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 May 5, 2025
b8df504
latest updates
markro49 May 6, 2025
eda6c92
code cleanup
markro49 May 14, 2025
be109c6
add setMaxLocals
markro49 May 14, 2025
74bf7bc
code cleanup
markro49 May 14, 2025
6ac1b32
checkpoint progress; many changes to instrumentation code
markro49 May 14, 2025
66a5d52
checkpoint current work; many changes to instrumentation code
markro49 May 21, 2025
933b710
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 May 21, 2025
b3fb96b
make error-prone happy
markro49 May 21, 2025
90eb4bf
Merge ../daikon-branch-master into java-24-dcomp-2
mernst Jun 3, 2025
8c9ebdc
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Jun 9, 2025
92868b2
checkpoint new operand stack code
markro49 Jun 9, 2025
191f38e
fix checker issues
markro49 Jun 10, 2025
04ea388
Fix JAVA24 tests
mernst Jun 12, 2025
352a75a
Fix Java 24 compilation
mernst Jun 12, 2025
040fe09
Improve Java 24 compilation
mernst Jun 12, 2025
a9b1c3f
Remove more special cases for *24.java files
mernst Jun 12, 2025
c7954aa
Diagnostic
mernst Jun 13, 2025
421986b
Fix cut-and-paste error
mernst Jun 13, 2025
39086a2
Fix wildcard that doesn't yet match
mernst Jun 13, 2025
f7745d9
Avoid forward compatibility
mernst Jun 13, 2025
df67f4e
Improve diagnostics
mernst Jun 13, 2025
4cc9c59
Generalize search for *24.java files
mernst Jun 14, 2025
a50c51f
Merge ../daikon-fork-mernst-branch-makefile-java24-cleanup into java-…
mernst Jun 14, 2025
dac4ae8
Merge ../daikon-branch-master into java-24-dcomp-2
mernst Jun 16, 2025
cafdb40
Pass `--add-exports` and `--add-opens` to require-javadoc
mernst Jun 16, 2025
0aee234
Merge ../daikon-fork-mernst-branch-requirejavadoc-24 into java-24-dco…
mernst Jun 16, 2025
1b5dd90
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Jun 17, 2025
738ea90
latest updates
markro49 Jun 17, 2025
cd4cd9b
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Jun 18, 2025
2f4db6d
add missing javadoc
markro49 Jun 18, 2025
ef52dd0
Convert non-Javadoc comments to Javadoc by adding "*"
mernst Jun 19, 2025
598b103
add missing javadoc
markro49 Jun 20, 2025
c9c665c
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Jun 23, 2025
4924917
fix operand stack calculations
markro49 Jun 23, 2025
4504169
add missing javadoc; fix checker annotation
markro49 Jun 24, 2025
6f6463e
latest updates
markro49 Jun 25, 2025
7bc20bd
cleanup junit debugging
markro49 Jun 26, 2025
3318430
turn on operand stack calculating
markro49 Jun 26, 2025
e3cf7eb
add some missing wide opcodes
markro49 Jun 26, 2025
cbf2cab
add ability to creat tage frame local
markro49 Jul 3, 2025
6332a23
update documentation
markro49 Jul 3, 2025
25bf9ec
calc operand stack complete; instrument instruction complete; fix tag…
markro49 Jul 3, 2025
44365c4
fix error prone warnings; reduce debug output
markro49 Jul 3, 2025
995de95
remove warning for JNI access to native code
markro49 Jul 9, 2025
5a77df2
add support for native methods
markro49 Jul 9, 2025
ce79722
code clean up; native methods; load/store fields
markro49 Jul 9, 2025
5d2be86
deal with methods that have no code
markro49 Jul 11, 2025
629e6a3
remove errorprone warning
markro49 Jul 11, 2025
c9f5b1f
improve equals method
markro49 Jul 17, 2025
bd657e3
JUnit test classes; sort operand stack work list by address
markro49 Jul 17, 2025
e843ab6
clean up internal exception handling
markro49 Jul 23, 2025
160f27a
forgot new file
markro49 Jul 24, 2025
cd03412
fix parameter names
markro49 Jul 30, 2025
1b81d28
improve debug info
markro49 Jul 30, 2025
079ef18
don't instrument Chicory
markro49 Jul 30, 2025
858a9a2
fix param names, clinit, several more issues
markro49 Jul 30, 2025
e6f222d
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Jul 30, 2025
8751f44
Merge ../daikon-branch-master into java-24-dcomp-2
mernst Aug 14, 2025
4b6d344
fix typo
markro49 Aug 22, 2025
e50c4d9
temp change - don't run juint5 test on jdk 24
markro49 Aug 22, 2025
0bc85fd
switch to new dyncomp jdk 24 instrumentation
markro49 Aug 22, 2025
2358d6b
corrections to local var and parmeter analysis
markro49 Aug 22, 2025
13a4d96
correct junit test discovery and isTargetInstrumented
markro49 Aug 22, 2025
5b77cd8
remove some debugging code
markro49 Aug 22, 2025
ec3f3e5
remove more debug code
markro49 Aug 23, 2025
c0bf7c4
turn off more debug output
markro49 Aug 23, 2025
606a21a
temp change - don't run junit5 on jdk 24 for diffs or txt-diff targets
markro49 Aug 23, 2025
825f310
source code cleanup
markro49 Aug 26, 2025
d0fd685
fix format errors
markro49 Aug 26, 2025
5483f4a
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Sep 2, 2025
ebf4f64
remove unused code
markro49 Sep 3, 2025
d14de53
complete toString for method name
markro49 Sep 3, 2025
3d8a96a
start work on BuildJDK24; remove duplicated code
markro49 Sep 3, 2025
d26c1a3
turn off some debugging
markro49 Sep 3, 2025
9f1f808
make method public for BuildJDK24 to use
markro49 Sep 5, 2025
5131aec
fix problem with ClassDesc for null
markro49 Sep 5, 2025
50d2fd9
get BuildJDK24 working
markro49 Sep 5, 2025
c5b06c0
Update java/daikon/dcomp/BcelUtils24.java
markro49 Sep 7, 2025
013d9de
add missing javadoc
markro49 Sep 7, 2025
d0fb80d
coderabbitai suggested changes
markro49 Sep 8, 2025
2832a64
fix javadoc @link
markro49 Sep 9, 2025
9e5be62
get daikon-tests passing with BuildJDK24
markro49 Sep 10, 2025
a712bdc
fix null checker issue
markro49 Sep 10, 2025
94cfe26
fix signature checker issue
markro49 Sep 10, 2025
4d0130d
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Sep 11, 2025
0c38849
fix issue and turn on BuildJDK24
markro49 Sep 11, 2025
5b7b2aa
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Sep 11, 2025
119de2e
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Sep 11, 2025
e75ee35
clean up some comments
markro49 Sep 11, 2025
c6162e9
correct new sed command
markro49 Sep 11, 2025
ce70ed8
more comment clean up
markro49 Sep 11, 2025
0f79aac
Merge ../daikon-branch-master into java-24-dcomp-2
mernst Sep 16, 2025
d24c1d3
Merge ../daikon-branch-master into java-24-dcomp-2-merge-master
mernst Sep 17, 2025
83fdf23
Merge pull request #15 from markro49/java-24-dcomp-2-merge-master
mernst Sep 18, 2025
67c9593
Don't use helper method to initialize fields
mernst Sep 18, 2025
8ee2da1
Merge ../daikon-branch-master into java-24-dcomp-2
mernst Sep 18, 2025
435d72f
Merge ../daikon-branch-master into java-24-dcomp-2
mernst Sep 18, 2025
24b2171
Clean more generated files
mernst Sep 18, 2025
a7961b6
Use `List` rather than `ArrayList`
mernst Sep 18, 2025
46e0232
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Sep 19, 2025
62e36e9
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Sep 23, 2025
0ac8e2c
Merge remote-tracking branch 'upstream/master' into java-24-dcomp-2
markro49 Sep 30, 2025
9542106
recommended changes from PMD
markro49 Sep 30, 2025
efc663c
Edits at beginning of Instrument
mernst Oct 5, 2025
1c2d2a7
Merge ../daikon-fork-markro49 into java-24-dcomp-2
mernst Oct 5, 2025
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
8 changes: 7 additions & 1 deletion java/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ JAVAC ?= javac
JAVADOC ?= javadoc
JAR ?= jar

BuildJDKTool = BuildJDK

# The "JAVANN" variables mean "at least version NN", except JAVA8.
JAVA_VERSION_STRING_WITH_EA := $(shell javac -version 2>&1 | head -1 | cut "-d " -f2)
JAVA_VERSION_STRING := $(shell javac -version 2>&1 | head -1 | cut "-d " -f2 | sed 's/-ea//')
Expand All @@ -41,6 +43,7 @@ endif
# Temporary, since Java 24 is not a LTS release.
ifeq ($(shell test ${JAVA_RELEASE_NUMBER} -ge 24; echo $$?),0)
JAVA24 := 1
BuildJDKTool = BuildJDK24
endif
ifeq ($(shell test ${JAVA_RELEASE_NUMBER} -ge 25; echo $$?),0)
JAVA25 := 1
Expand Down Expand Up @@ -625,7 +628,7 @@ dyncomp-jdk dcomp-jdk : dcomp_rt.jar
${DCOMP_RT} dcomp_rt.jar : dcomp_premain.jar
/bin/rm -rf ${DCOMP_RT}
${INSTALL} -d ${DCOMP_RT}
${JAVA_COMMAND} -Xmx3600m daikon.dcomp.BuildJDK ${DCOMP_RT}
${JAVA_COMMAND} -Xmx3600m daikon.dcomp.${BuildJDKTool} ${DCOMP_RT}
# "then" clause is Java 8, "else" clause is Java 9+.
# For Java 9+, there appears to be a bug in the Java reflection invoke code that it
# does not check that the arg list matches. Hence, it tries to invoke
Expand Down Expand Up @@ -754,6 +757,9 @@ very-clean: clean clean-generated-files
-rm -rf api
-rm -rf daikon/dcomp/std_dcomp_out.diff daikon/dcomp/std_dcomp_out.txt
-rm -rf daikon/chicory/ChicoryTest.inv.out
-rm -rf daikon/dcomp/debug/
-rm -rf daikon/dcomp/DcompTest.log
-rm -rf daikon/chicory/debug

run: all
${JAVA_COMMAND} daikon.Daikon
Expand Down
4 changes: 4 additions & 0 deletions java/daikon/DynComp.java
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ void start_target(String premain_args, String[] targetArgs) {
// allow DCRuntime to make reflective access to java.land.Object.clone() without a warning
cmdlist.add("--add-opens");
cmdlist.add("java.base/java.lang=ALL-UNNAMED");
if (BcelUtil.javaVersion >= 24) {
// needed to eliminate warning for JNI access to native code
cmdlist.add("--enable-native-access=ALL-UNNAMED");
}
if (!no_jdk) {
// If we are processing JDK classes, then we need our code on the boot classpath as well.
// Otherwise, references to DCRuntime from the JDK would fail.
Expand Down
3 changes: 3 additions & 0 deletions java/daikon/chicory/ClassInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public class ClassInfo {
/** True if the class has a class initializer. */
public boolean hasClinit;

/** True if the class is a JUnit test class. */
public boolean isJunitTestClass;

// set by initViaReflection()
/** reflection object for this class. */
public @MonotonicNonNull Class<?> clazz;
Expand Down
21 changes: 10 additions & 11 deletions java/daikon/chicory/Instrument.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,23 @@
import org.checkerframework.dataflow.qual.Pure;

/**
* This class is responsible for modifying another class's bytecodes. Specifically, its main task is
* to add calls into the Chicory runtime at method entries and exits for instrumentation purposes.
* These added calls are sometimes referred to as "hooks".
* This class modifies another class's bytecodes. It adds calls into the Chicory runtime at method
* entries and exits for instrumentation purposes. These added calls are sometimes referred to as
* "hooks".
*
* <p>This class is loaded by ChicoryPremain at startup. It is a ClassFileTransformer which means
* that its {@code transform} method gets called each time the JVM loads a class.
* that its {@link #transform} method gets called each time the JVM loads a class.
*/
public class Instrument extends InstructionListUtils implements ClassFileTransformer {

/** The location of the runtime support class. */
/** The name of the Chicory runtime support class. */
private static final String runtime_classname = "daikon.chicory.Runtime";

/** Debug information about which classes and/or methods are transformed and why. */
/** A log for debug information about which classes and/or methods are transformed and why. */
protected static final SimpleLog debug_transform = new SimpleLog(false);

// Public so can be enabled from daikon.dcomp.Instrument.
/** Debug information about ppt-omit and ppt-select. */
// Public so daikon.dcomp.Instrument can enable it.
/** A log for debug information about ppt-omit and ppt-select. */
public static final SimpleLog debug_ppt_omit = new SimpleLog(false);

/** Directory for debug output. */
Expand All @@ -87,7 +87,6 @@ public class Instrument extends InstructionListUtils implements ClassFileTransfo
/** Create an instrumenter. Setup debug directories, if needed. */
@SuppressWarnings("nullness:initialization")
public Instrument() {
super();
debug_transform.enabled = Chicory.debug_transform || Chicory.debug || Chicory.verbose;
debug_ppt_omit.enabled = debugInstrument.enabled = Chicory.debug;

Expand All @@ -104,7 +103,7 @@ public Instrument() {
/**
* Returns true if the given ppt should be ignored. Uses the patterns in {@link
* daikon.chicory.Runtime#ppt_omit_pattern} and {@link daikon.chicory.Runtime#ppt_select_pattern}.
* This method is used by both Chicory and Dyncomp.
* This method is used by both Chicory and DynComp.
*
* @param className class name to be checked
* @param methodName method name to be checked
Expand Down Expand Up @@ -159,7 +158,7 @@ public static boolean shouldIgnore(
* boot classes have the null loader, but some generated classes (such as those in sun.reflect)
* will have a non-null loader. Some of these have a null parent loader, but some do not. The
* check for the sun.reflect package is a hack to catch all of these. A more consistent mechanism
* to determine boot classes would be preferrable.
* to determine boot classes would be preferable.
*
* @param className class name to be checked
* @param loader the class loader for the class
Expand Down
22 changes: 12 additions & 10 deletions java/daikon/chicory/Instrument24.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@
import org.checkerframework.dataflow.qual.Pure;

/**
* This class is responsible for modifying another class's bytecodes. Specifically, its main task is
* to add calls into the Chicory runtime at method entries and exits for instrumentation purposes.
* These added calls are sometimes referred to as "hooks".
* This class modifies another class's bytecodes. It adds calls into the Chicory runtime at method
* entries and exits for instrumentation purposes. These added calls are sometimes referred to as
* "hooks".
*
* <p>This class is loaded by ChicoryPremain at startup. It is a ClassFileTransformer which means
* that its {@code transform} method gets called each time the JVM loads a class.
* that its {@link #transform} method gets called each time the JVM loads a class.
*
* <p>Instrument24 uses Java's ({@code java.lang.classfile}) APIs for reading and modifying .class
* files. Those APIs were added in JDK 24. Compared to BCEL, these APIs are more complete and robust
Expand All @@ -98,17 +98,17 @@
*/
public class Instrument24 implements ClassFileTransformer {

/** The location of the runtime support class. */
/** The name of the Chicory runtime support class. */
private static final String runtime_classname = "daikon.chicory.Runtime";

/** The ClassDesc for the Chicory runtime support class. */
private static final ClassDesc runtimeCD = ClassDesc.of(runtime_classname);

/** Debug information about which classes and/or methods are transformed and why. */
/** A log for debug information about which classes and/or methods are transformed and why. */
protected static final SimpleLog debug_transform = new SimpleLog(false);

// Public so can be enabled from daikon.dcomp.Instrument24.
/** Debug information about ppt-omit and ppt-select. */
// Public so daikon.dcomp.Instrument24 can enable it.
/** A log for debug information about ppt-omit and ppt-select. */
public static final SimpleLog debug_ppt_omit = new SimpleLog(false);

/** A log to which to print debugging information about program instrumentation. */
Expand Down Expand Up @@ -326,10 +326,11 @@ private void outputDebugFiles(byte[] classBytes, File directory, @BinaryName Str
binaryClassName);
}

debug_transform.log("%nTransforming: %s%n", binaryClassName);

// Instrument the classfile, die on any errors
ClassInfo classInfo = new ClassInfo(binaryClassName, cfLoader);
byte[] newBytes = {};
debug_transform.log("%nTransforming: %s%n", binaryClassName);
byte[] newBytes;
try {
newBytes =
classFile.build(
Expand Down Expand Up @@ -1719,6 +1720,7 @@ protected LocalVariable createLocalWithMethodScope(
minfo.nextLocalIndex, localName, localType, minfo.startLabel, minfo.endLabel);
mgen.localsTable.add(newVar);
minfo.nextLocalIndex += TypeKind.from(localType).slotSize();
mgen.setMaxLocals(minfo.nextLocalIndex);
return newVar;
}

Expand Down
Loading