Skip to content
Open
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
101 changes: 57 additions & 44 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This is a build.xml which executes the main openjdk.build build.xml
to allow tools which invoke a root level build.xml file to
This is a build.xml which executes the main openjdk.build build.xml
to allow tools which invoke a root level build.xml file to
execute a build.
-->

Expand All @@ -35,19 +35,21 @@ execute a build.
<property name="src-string" value="${basedir}/net/adoptopenjdk/bumblebench/string"/>
<property name="src-jni" value="${basedir}/net/adoptopenjdk/bumblebench/jni"/>
<property name="src-arraycopy" value="${basedir}/net/adoptopenjdk/bumblebench/arraycopy"/>
<property name="src-unsafe" value="${basedir}/net/adoptopenjdk/bumblebench/unsafe"/>
<property environment="env"/>

<target name="compile-all" description="compile" >

<!-- core -->
<javac srcdir="${src-core}"
<javac srcdir="${src-core}"
destdir=""
debug="on"
source="1.8"
target="1.8"
includeantruntime="false"
excludes="">
</javac>
<javac srcdir="${src-core}"
<javac srcdir="${src-core}"
destdir=""
debug="on"
source="1.8"
Expand All @@ -57,142 +59,153 @@ execute a build.
</javac>

<!-- collections -->
<javac srcdir="${src-collections}"
debug="on"
<javac srcdir="${src-collections}"
debug="on"
destdir=""
source="1.8"
target="1.8"
target="1.8"
includeantruntime="false"
classpath="${src-core}"
excludes="**/*ambda*.java">
</javac>

<javac srcdir="${src-collections}"
debug="on"
<javac srcdir="${src-collections}"
debug="on"
destdir=""
source="1.8"
target="1.8"
target="1.8"
includeantruntime="false"
classpath="${src-core}"
includes="**/*ambda*.java">
</javac>

<!-- crypto -->
<javac srcdir="${src-crypto}"
debug="on"
<javac srcdir="${src-crypto}"
debug="on"
destdir=""
source="1.8"
target="1.8"
target="1.8"
includeantruntime="false"
classpath="${src-core}">
</javac>

<!-- examples -->
<javac srcdir="${src-examples}"
debug="on"
<javac srcdir="${src-examples}"
debug="on"
destdir=""
source="1.8"
target="1.8"
target="1.8"
includeantruntime="false"
classpath="${src-examples}"
includes="**/SocketEchoBench.java">
</javac>
<javac srcdir="${src-examples}"
debug="on"
<javac srcdir="${src-examples}"
debug="on"
destdir=""
source="1.8"
target="1.8"
target="1.8"
includeantruntime="false"
classpath="${src-examples}"
includes="**/*ambda*.java">
</javac>
<javac srcdir="${src-examples}"
debug="on"
<javac srcdir="${src-examples}"
debug="on"
destdir=""
source="1.8"
target="1.8"
target="1.8"
includeantruntime="false"
classpath="${src-examples}"
excludes="**/*ambda*.java, **/SocketEchoBench.java">
</javac>

<!-- string -->
<javac srcdir="${src-string}"
debug="on"
<javac srcdir="${src-string}"
debug="on"
destdir=""
encoding="UTF-8"
source="1.8"
target="1.8"
target="1.8"
includeantruntime="false"
classpath="${src-string}">
</javac>

<!-- gpu -->
<javac srcdir="${src-gpu}"
debug="on"
<javac srcdir="${src-gpu}"
debug="on"
destdir=""
source="1.8"
target="1.8"
target="1.8"
includeantruntime="false"
classpath="${src-gpu}">
</javac>

<!-- indy -->
<!--
<javac srcdir="${src-indy}"
debug="on"
<javac srcdir="${src-indy}"
debug="on"
destdir=""
source="1.8"
target="1.8"
target="1.8"
classpath="${src-indy},${basedir}/asm-all-4.0.jar">
</javac>
-->

<!-- lambda -->
<javac srcdir="${src-lambda}"
debug="on"
<javac srcdir="${src-lambda}"
debug="on"
destdir=""
source="1.8"
target="1.8"
includeantruntime="false">
</javac>

<!-- JNI -->
<javac srcdir="${src-jni}"
debug="on"
<javac srcdir="${src-jni}"
debug="on"
destdir=""
source="1.8"
target="1.8"
includeantruntime="false">
</javac>

<!-- math -->
<javac srcdir="${src-math}"
debug="on"
<javac srcdir="${src-math}"
debug="on"
destdir=""
source="1.8"
target="1.8"
target="1.8"
includeantruntime="false"
classpath="${src-math}">
</javac>

<!-- humble -->
<javac srcdir="${src-humble}"
<javac srcdir="${src-humble}"
debug="on"
destdir=""
source="1.8"
target="1.8"
target="1.8"
includeantruntime="false">
</javac>

<!-- arraycopy -->
<javac srcdir="${src-arraycopy}"
<javac srcdir="${src-arraycopy}"
debug="on"
destdir=""
source="1.8"
target="1.8"
target="1.8"
includeantruntime="false">
</javac>

<!-- unsafe -->
<javac srcdir="${src-unsafe}"
debug="on"
destdir=""
source="21"
target="21"
includeantruntime="false"
excludes="generator/**">
<compilerarg line="--add-exports java.base/jdk.internal.misc=ALL-UNNAMED"/>
</javac>
</target>

<!-- Create BumbleBench.jar and clean up -->
Expand All @@ -201,7 +214,7 @@ execute a build.
<arg value="-c" />
<arg value="rm -f BumbleBench.jar" />
</exec>

<jar jarfile="${dist}/BumbleBench.jar" filesonly="true">
<fileset dir="${basedir}"
excludes="**/asm-all-4.0.jar,**/Makefile,**/*.mk, **/build.xml. **/.project">
Expand Down
1 change: 1 addition & 0 deletions net/adoptopenjdk/bumblebench/core/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ static void runBumbleMainOn(BumbleBench instance) throws NoSuchMethodException,
+ ":net.adoptopenjdk.bumblebench.string"
+ ":net.adoptopenjdk.bumblebench.humble"
+ ":net.adoptopenjdk.bumblebench.arraycopy"
+ ":net.adoptopenjdk.bumblebench.unsafe"
;

public static Class loadTestClass(String[] packageNames, String name) throws ClassNotFoundException, IOException {
Expand Down
92 changes: 92 additions & 0 deletions net/adoptopenjdk/bumblebench/unsafe/Base.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*******************************************************************************
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

package net.adoptopenjdk.bumblebench.unsafe;

import jdk.internal.misc.Unsafe;
import java.lang.Runtime;
import java.lang.Thread;

public class Base {
public static final Unsafe UNSAFE;
public static volatile int dump;
public static volatile int incrementBy = 0;

static {
try {
UNSAFE = Unsafe.getUnsafe();
} catch (IllegalAccessError e) {
System.err.println("add \"--add-exports java.base/jdk.internal.misc=ALL-UNNAMED\" to your java command");
throw new RuntimeException("Unable to get Unsafe instance.", e);
} catch (Exception e) {
throw new RuntimeException("Unable to get Unsafe instance.", e);
}
}

public static abstract class Offsets {}

public static class AbsoluteOffsets extends Offsets {
public Object base;
public long field1Offset, field2Offset, field3Offset, field4Offset, field5Offset;

public AbsoluteOffsets(Object b, long f1, long f2, long f3, long f4, long f5) {
base = b;
field1Offset = f1;
field2Offset = f2;
field3Offset = f3;
field4Offset = f4;
field5Offset = f5;
}
}

public static class RelativeOffsets extends AbsoluteOffsets {
public long baseOffset;

public RelativeOffsets(Object b, long bo, long f1, long f2, long f3, long f4, long f5) {
super(b, f1, f2, f3, f4, f5);
baseOffset = bo;
}
}

public static class Objects extends Offsets {
public Object base1, base2, base3, base4, base5;
public long offset;

public Objects(Object b1, Object b2, Object b3, Object b4, Object b5, long o) {
base1 = b1;
base2 = b2;
base3 = b3;
base4 = b4;
base5 = b5;
offset = o;
}
}

public static interface BenchmarkProvider<T extends Offsets> {
public T getNativeOffsets();
public T getStaticOffsets();
public T getObjectOffsets();
public T getArrayOffsets();

public long stressGet(long numIterations, T offsets);
public long stressGetOpaque(long numIterations, T offsets);
public long stressGetAcquire(long numIterations, T offsets);
public long stressGetVolatile(long numIterations, T offsets);

public long stressPut(long numIterations, T offsets);
public long stressPutOpaque(long numIterations, T offsets);
public long stressPutRelease(long numIterations, T offsets);
public long stressPutVolatile(long numIterations, T offsets);
}
}
Loading