Skip to content
Commits on Source (8)
wildfly-common (1.5.2-1) unstable; urgency=medium
* New upstream version 1.5.2.
* Switch to debhelper-compat 12.
* Declare compliance with Debian Policy 4.4.0.
* Add remove-Substitutions.java.patch and work around a FTBFS.
-- Markus Koschany <apo@debian.org> Thu, 18 Jul 2019 16:41:26 +0200
wildfly-common (1.4.0-2) unstable; urgency=medium
* Team upload.
......
......@@ -5,7 +5,7 @@ Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.or
Uploaders:
Markus Koschany <apo@debian.org>
Build-Depends:
debhelper (>= 11),
debhelper-compat (= 12),
default-jdk,
junit4,
libgeronimo-annotation-1.3-spec-java,
......@@ -14,7 +14,7 @@ Build-Depends:
libmaven-bundle-plugin-java,
libmaven-enforcer-plugin-java,
maven-debian-helper (>= 2.1)
Standards-Version: 4.2.1
Standards-Version: 4.4.0
Vcs-Git: https://salsa.debian.org/java-team/wildfly-common.git
Vcs-Browser: https://salsa.debian.org/java-team/wildfly-common
Homepage: http://wildfly.org/
......
......@@ -3,11 +3,11 @@ Upstream-Name: wildfly-common
Source: https://github.com/wildfly/wildfly-common
Files: *
Copyright: 2014-2017, Red Hat, Inc.
Copyright: 2014-2019, Red Hat, Inc.
License: Apache-2.0
Files: debian/*
Copyright: 2017-2018, Markus Koschany <apo@debian.org>
Copyright: 2017-2019, Markus Koschany <apo@debian.org>
License: Apache-2.0
License: Apache-2.0
......
......@@ -2,3 +2,5 @@
org.apache.maven.plugins maven-javadoc-plugin * * * *
org.apache.maven.plugins maven-dependency-plugin * * * *
org.wildfly.common wildfly-common-jdk9-supplement * * * *
org.graalvm.sdk graal-sdk * * * *
com.oracle.substratevm svm * * * *
From: Markus Koschany <apo@debian.org>
Date: Thu, 18 Jul 2019 17:06:07 +0200
Subject: remove Substitutions.java
Workaround for a FTBFS because of missing build-dependencies.
Forwarded: not-needed
---
.../java/org/wildfly/common/Substitutions.java | 80 --------------
.../org/wildfly/common/lock/Substitutions.java | 39 -------
.../java/org/wildfly/common/net/Substitutions.java | 120 ---------------------
.../java/org/wildfly/common/os/Substitutions.java | 53 ---------
.../org/wildfly/common/lock/Substitutions.java | 30 ------
5 files changed, 322 deletions(-)
delete mode 100644 src/main/java/org/wildfly/common/Substitutions.java
delete mode 100644 src/main/java/org/wildfly/common/lock/Substitutions.java
delete mode 100644 src/main/java/org/wildfly/common/net/Substitutions.java
delete mode 100644 src/main/java/org/wildfly/common/os/Substitutions.java
delete mode 100644 src/main/java9/org/wildfly/common/lock/Substitutions.java
diff --git a/src/main/java/org/wildfly/common/Substitutions.java b/src/main/java/org/wildfly/common/Substitutions.java
deleted file mode 100644
index 2ffc322..0000000
--- a/src/main/java/org/wildfly/common/Substitutions.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2018 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
- *
- * 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 org.wildfly.common;
-
-import com.oracle.svm.core.annotate.Alias;
-import com.oracle.svm.core.annotate.AlwaysInline;
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-
-/**
- */
-final class Substitutions {
- @TargetClass(Branch.class)
- static final class Target_Branch {
- @AlwaysInline("Straight call to GraalVM")
- @Substitute
- public static boolean veryLikely(boolean expr) {
- return Target_GraalDirectives.injectBranchProbability(Target_GraalDirectives.FASTPATH_PROBABILITY, expr);
- }
-
- @AlwaysInline("Straight call to GraalVM")
- @Substitute
- public static boolean veryUnlikely(boolean expr) {
- return Target_GraalDirectives.injectBranchProbability(Target_GraalDirectives.SLOWPATH_PROBABILITY, expr);
- }
-
- @AlwaysInline("Straight call to GraalVM")
- @Substitute
- public static boolean likely(boolean expr) {
- return Target_GraalDirectives.injectBranchProbability(Target_GraalDirectives.LIKELY_PROBABILITY, expr);
- }
-
- @AlwaysInline("Straight call to GraalVM")
- @Substitute
- public static boolean unlikely(boolean expr) {
- return Target_GraalDirectives.injectBranchProbability(Target_GraalDirectives.UNLIKELY_PROBABILITY, expr);
- }
-
- @AlwaysInline("Straight call to GraalVM")
- @Substitute
- public static boolean probability(float prob, boolean expr) {
- return Target_GraalDirectives.injectBranchProbability(prob, expr);
- }
- }
-
- @TargetClass(className = "org.graalvm.compiler.api.directives.GraalDirectives")
- static final class Target_GraalDirectives {
- @Alias
- public static double LIKELY_PROBABILITY;
- @Alias
- public static double UNLIKELY_PROBABILITY;
-
- @Alias
- public static double SLOWPATH_PROBABILITY;
- @Alias
- public static double FASTPATH_PROBABILITY;
-
- @Alias
- public static boolean injectBranchProbability(double probability, boolean condition) {
- assert probability >= 0.0 && probability <= 1.0;
- return condition;
- }
- }
-}
diff --git a/src/main/java/org/wildfly/common/lock/Substitutions.java b/src/main/java/org/wildfly/common/lock/Substitutions.java
deleted file mode 100644
index a7a5b1f..0000000
--- a/src/main/java/org/wildfly/common/lock/Substitutions.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2018 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
- *
- * 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 org.wildfly.common.lock;
-
-import com.oracle.svm.core.annotate.Alias;
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-
-final class Substitutions {
- @TargetClass(JDKSpecific.class)
- static final class Target_JDKSpecific {
- @Substitute
- static void onSpinWait() {
- Target_PauseNode.pause();
- }
- }
-
- @TargetClass(className = "org.graalvm.compiler.nodes.PauseNode")
- static final class Target_PauseNode {
- @Alias
- public static native void pause();
- }
-}
diff --git a/src/main/java/org/wildfly/common/net/Substitutions.java b/src/main/java/org/wildfly/common/net/Substitutions.java
deleted file mode 100644
index 5ebb170..0000000
--- a/src/main/java/org/wildfly/common/net/Substitutions.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2018 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
- *
- * 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 org.wildfly.common.net;
-
-import java.net.UnknownHostException;
-import java.util.Collections;
-import java.util.List;
-
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.graalvm.nativeimage.StackValue;
-import org.graalvm.nativeimage.c.CContext;
-import org.graalvm.nativeimage.c.function.CFunction;
-import org.graalvm.nativeimage.c.type.CCharPointer;
-import org.graalvm.nativeimage.c.type.CTypeConversion;
-import org.graalvm.word.UnsignedWord;
-import org.graalvm.word.WordFactory;
-
-/**
- */
-final class Substitutions {
- @TargetClass(className = "org.wildfly.common.net.GetHostInfoAction")
- static final class Target_org_wildfly_common_net_GetHostInfoAction {
- @Substitute
- public String[] run() {
- // still allow host name to be overridden
- String qualifiedHostName = System.getProperty("jboss.qualified.host.name");
- String providedHostName = System.getProperty("jboss.host.name");
- String providedNodeName = System.getProperty("jboss.node.name");
- if (qualifiedHostName == null) {
- // if host name is specified, don't pick a qualified host name that isn't related to it
- qualifiedHostName = providedHostName;
- if (qualifiedHostName == null) {
- // query the operating system
- CCharPointer nameBuf = StackValue.get(ProcessSubstitutions.SIZE); // should be more than enough
- int res = NativeInfo.gethostname(nameBuf, WordFactory.unsigned(ProcessSubstitutions.SIZE));
- if (res != -1 && res > 0) {
- if (res == ProcessSubstitutions.SIZE) {
- // null-terminate a really long name
- nameBuf.write(ProcessSubstitutions.SIZE - 1, (byte) 0);
- }
- qualifiedHostName = CTypeConversion.toJavaString(nameBuf);
- }
- }
- if (qualifiedHostName == null) {
- // POSIX-like OSes including Mac should have this set
- qualifiedHostName = System.getenv("HOSTNAME");
- }
- if (qualifiedHostName == null) {
- // Certain versions of Windows
- qualifiedHostName = System.getenv("COMPUTERNAME");
- }
- if (qualifiedHostName == null) {
- try {
- qualifiedHostName = HostName.getLocalHost().getHostName();
- } catch (UnknownHostException e) {
- qualifiedHostName = null;
- }
- }
- if (qualifiedHostName != null && (Inet.isInet4Address(qualifiedHostName) || Inet.isInet6Address(qualifiedHostName))) {
- // IP address is not acceptable
- qualifiedHostName = null;
- }
- if (qualifiedHostName == null) {
- // Give up
- qualifiedHostName = "unknown-host.unknown-domain";
- } else {
- qualifiedHostName = qualifiedHostName.trim().toLowerCase();
- }
- }
- if (providedHostName == null) {
- // Use the host part of the qualified host name
- final int idx = qualifiedHostName.indexOf('.');
- providedHostName = idx == - 1 ? qualifiedHostName : qualifiedHostName.substring(0, idx);
- }
- if (providedNodeName == null) {
- providedNodeName = providedHostName;
- }
- return new String[] {
- providedHostName,
- qualifiedHostName,
- providedNodeName
- };
-
- }
- }
-
- @CContext(NativeInfoDirectives.class)
- static final class NativeInfo {
- @CFunction
- static native int gethostname(CCharPointer nameBuf, UnsignedWord /* size_t */ len);
- }
-
- static final class NativeInfoDirectives implements CContext.Directives {
- public List<String> getHeaderFiles() {
- return Collections.singletonList("<unistd.h>");
- }
- }
-
- static final class ProcessSubstitutions {
- static final int SIZE = 512;
- }
-
-}
diff --git a/src/main/java/org/wildfly/common/os/Substitutions.java b/src/main/java/org/wildfly/common/os/Substitutions.java
deleted file mode 100644
index 9172245..0000000
--- a/src/main/java/org/wildfly/common/os/Substitutions.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2018 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
- *
- * 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 org.wildfly.common.os;
-
-import java.io.File;
-
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.graalvm.nativeimage.ProcessProperties;
-
-final class Substitutions {
-
- @TargetClass(className = "org.wildfly.common.os.GetProcessInfoAction")
- static final class Target_org_wildfly_common_os_GetProcessInfoAction {
- @Substitute
- public Object[] run() {
- return new Object[] { Long.valueOf(ProcessProperties.getProcessID() & 0xffff_ffffL), ProcessUtils.getProcessName() };
- }
- }
-
- static final class ProcessUtils {
- static String getProcessName() {
- String name = System.getProperty("jboss.process.name");
- if (name == null) {
- String exeName = ProcessProperties.getExecutableName();
- if (! exeName.isEmpty()) {
- int idx = exeName.lastIndexOf(File.separatorChar);
- name = idx == -1 ? exeName : idx == exeName.length() - 1 ? null : exeName.substring(idx + 1);
- }
- }
- if (name == null) {
- name = "<unknown>";
- }
- return name;
- }
- }
-}
diff --git a/src/main/java9/org/wildfly/common/lock/Substitutions.java b/src/main/java9/org/wildfly/common/lock/Substitutions.java
deleted file mode 100644
index 6151f75..0000000
--- a/src/main/java9/org/wildfly/common/lock/Substitutions.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2018 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
- *
- * 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 org.wildfly.common.lock;
-
-final class Substitutions {
- static final class Target_JDKSpecific {
- static void onSpinWait() {
- }
- }
-
- static final class Target_PauseNode {
- public static native void pause();
- }
-}
remove-Substitutions.java.patch
......@@ -25,12 +25,12 @@
<groupId>org.wildfly.common</groupId>
<artifactId>wildfly-common</artifactId>
<version>1.4.0.Final</version>
<version>1.5.2.Final</version>
<parent>
<groupId>org.jboss</groupId>
<artifactId>jboss-parent</artifactId>
<version>24</version>
<version>34</version>
</parent>
<licenses>
......@@ -42,13 +42,28 @@
</licenses>
<properties>
<version.org.jboss.logging.jboss-logging>3.3.1.Final</version.org.jboss.logging.jboss-logging>
<version.org.jboss.logging.jboss-logging-tools>2.1.0.Final</version.org.jboss.logging.jboss-logging-tools>
<version.org.jboss.logging.jboss-logging>3.4.0.Final</version.org.jboss.logging.jboss-logging>
<version.org.jboss.logging.jboss-logging-tools>2.2.0.Final</version.org.jboss.logging.jboss-logging-tools>
<jdk.min.version>9</jdk.min.version>
<jdk.min.version>11</jdk.min.version>
<javadoc.additional.params>--release=8</javadoc.additional.params>
</properties>
<dependencies>
<dependency>
<groupId>org.graalvm.sdk</groupId>
<artifactId>graal-sdk</artifactId>
<version>1.0.0-rc9</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
<version>1.0.0-rc9</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-annotations</artifactId>
......@@ -83,36 +98,6 @@
</dependency>
</dependencies>
<profiles>
<profile>
<id>java8-test-profile</id>
<activation>
<property>
<name>java8.home</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>java8-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<jvm>${java8.home}/bin/java</jvm>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<resources>
<resource>
......@@ -133,74 +118,18 @@
<doctitle><![CDATA[WildFly Common ]]>${project.version}</doctitle>
<header><![CDATA[WildFly Common ]]>${project.version}</header>
<footer><![CDATA[WildFly Common ]]>${project.version}</footer>
<bottom><![CDATA[<i>Copyright &#169; 2017 JBoss, a division of Red Hat, Inc.</i>]]></bottom>
<bottom><![CDATA[<i>Copyright &#169; 2019 JBoss, a division of Red Hat, Inc.</i>]]></bottom>
<links>
<link>http://java.sun.com/javase/8/docs/api/</link>
<link>https://docs.oracle.com/javase/8/docs/api/</link>
</links>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0-jboss-1</version>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>8</release>
<buildDirectory>${project.build.directory}</buildDirectory>
<compileSourceRoots>${project.compileSourceRoots}</compileSourceRoots>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
</configuration>
</execution>
<execution>
<id>compile-java9</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
<buildDirectory>${project.build.directory}</buildDirectory>
<compileSourceRoots>${project.basedir}/src/main/java9</compileSourceRoots>
<outputDirectory>${project.build.directory}/classes/META-INF/versions/9</outputDirectory>
<additionalClasspathElements>
<additionalClasspathElement>${project.build.outputDirectory}</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<trimStackTrace>false</trimStackTrace>
</configuration>
<executions>
<execution>
<id>default-test</id>
<configuration>
<classesDirectory>${project.build.directory}/classes/META-INF/versions/9</classesDirectory>
<additionalClasspathElements>
<additionalClasspathElement>${project.build.directory}/classes</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
<doclint>none</doclint>
<additionalDependencies>
<additionalDependency>
<groupId>org.jboss</groupId>
<artifactId>jdk-misc</artifactId>
<version>${version.jdk-misc}</version>
</additionalDependency>
</additionalDependencies>
</configuration>
</plugin>
<plugin>
......
......@@ -105,6 +105,22 @@ public final class Assert {
return value;
}
/**
* Check that the named parameter is not empty. Use a standard exception message if it is.
*
* @param name the parameter name
* @param value the parameter value
* @return the value that was passed in
* @throws IllegalArgumentException if the value is empty
*/
@NotNull
public static CharSequence checkNotEmptyParam(String name, CharSequence value) {
checkNotNullParamChecked("name", name);
checkNotNullParamChecked("value", value);
if (value.length() == 0) throw CommonMessages.msg.emptyParam(name);
return value;
}
/**
* Check that the named parameter is not empty. Use a standard exception message if it is.
*
......
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* 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 org.wildfly.common;
/**
* Branch probability directives. On JVMs which support these constructs,
*/
public final class Branch {
private Branch() {}
/**
* Assert that the given expression is on the "fast path", which is to say, it will be {@code true} more than 99.9%
* of the time.
*
* @param expr the expression value
* @return the expression value
*/
public static boolean veryLikely(boolean expr) {
return expr;
}
/**
* Assert that the given expression is on the "slow path", which is to say, it will be {@code false} more than 99.9%
* of the time.
*
* @param expr the expression value
* @return the expression value
*/
public static boolean veryUnlikely(boolean expr) {
return expr;
}
/**
* Assert that the given expression is likely, which is to say, it will be {@code true} more than 75%
* of the time.
*
* @param expr the expression value
* @return the expression value
*/
public static boolean likely(boolean expr) {
return expr;
}
/**
* Assert that the given expression is unlikely, which is to say, it will be {@code false} more than 75%
* of the time.
*
* @param expr the expression value
* @return the expression value
*/
public static boolean unlikely(boolean expr) {
return expr;
}
/**
* Assert that the given expression has the given probability of being {@code true}.
*
* @param prob the probability where {@code 0.0f ≤ prob ≤ 1.0f}
* @param expr the expression value
* @return the expression value
*/
public static boolean probability(float prob, boolean expr) {
assert 0.0f <= prob && prob <= 1.0f;
return expr;
}
}
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* 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 org.wildfly.common;
import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.AlwaysInline;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
/**
*/
final class Substitutions {
@TargetClass(Branch.class)
static final class Target_Branch {
@AlwaysInline("Straight call to GraalVM")
@Substitute
public static boolean veryLikely(boolean expr) {
return Target_GraalDirectives.injectBranchProbability(Target_GraalDirectives.FASTPATH_PROBABILITY, expr);
}
@AlwaysInline("Straight call to GraalVM")
@Substitute
public static boolean veryUnlikely(boolean expr) {
return Target_GraalDirectives.injectBranchProbability(Target_GraalDirectives.SLOWPATH_PROBABILITY, expr);
}
@AlwaysInline("Straight call to GraalVM")
@Substitute
public static boolean likely(boolean expr) {
return Target_GraalDirectives.injectBranchProbability(Target_GraalDirectives.LIKELY_PROBABILITY, expr);
}
@AlwaysInline("Straight call to GraalVM")
@Substitute
public static boolean unlikely(boolean expr) {
return Target_GraalDirectives.injectBranchProbability(Target_GraalDirectives.UNLIKELY_PROBABILITY, expr);
}
@AlwaysInline("Straight call to GraalVM")
@Substitute
public static boolean probability(float prob, boolean expr) {
return Target_GraalDirectives.injectBranchProbability(prob, expr);
}
}
@TargetClass(className = "org.graalvm.compiler.api.directives.GraalDirectives")
static final class Target_GraalDirectives {
@Alias
public static double LIKELY_PROBABILITY;
@Alias
public static double UNLIKELY_PROBABILITY;
@Alias
public static double SLOWPATH_PROBABILITY;
@Alias
public static double FASTPATH_PROBABILITY;
@Alias
public static boolean injectBranchProbability(double probability, boolean condition) {
assert probability >= 0.0 && probability <= 1.0;
return condition;
}
}
}
This diff is collapsed.
package org.wildfly.common.archive;
import java.io.InputStream;
import java.nio.ByteBuffer;
final class ByteBufferInputStream extends InputStream {
private final ByteBuffer[] bufs;
private final long offset;
private final long size;
long pos;
long mark;
ByteBufferInputStream(final ByteBuffer[] bufs, final long offset, final long size) {
this.bufs = bufs;
this.offset = offset;
this.size = size;
}
public int read() {
return pos < size ? Archive.getByte(bufs, offset + pos++) : -1;
}
public int read(final byte[] b) {
return read(b, 0, b.length);
}
public int read(final byte[] b, final int off, final int len) {
final long rem = size - pos;
if (rem == 0) return -1;
final int realLen = (int) Math.min(len, rem);
if (realLen > 0) {
Archive.readBytes(bufs, offset + pos, b, off, realLen);
return realLen;
} else {
return 0;
}
}
public long skip(final long n) {
final long rem = size - pos;
final long cnt = Math.min(rem, n);
if (cnt > 0) {
pos += cnt;
return cnt;
} else {
return 0;
}
}
public int available() {
return (int) Math.min(Integer.MAX_VALUE, size - pos);
}
public void close() {
}
public void mark(final int readLimit) {
mark = pos;
}
public void reset() {
pos = mark;
}
public boolean markSupported() {
return true;
}
}
package org.wildfly.common.archive;
import java.util.Arrays;
/**
* An index for archives greater than 4GB in size.
*/
final class HugeIndex extends Index {
private final long[] table;
HugeIndex(final int entries) {
super(entries);
final long[] array = new long[size()];
Arrays.fill(array, -1);
this.table = array;
}
long get(final int index) {
return table[index];
}
void put(int index, final long offset) {
final long[] table = this.table;
long val = table[index];
while (val != -1L) {
index = index + 1 & getMask();
val = table[index];
}
table[index] = offset;
}
}
package org.wildfly.common.archive;
/**
*/
abstract class Index {
final int tableSize;
Index(final int entries) {
if (entries >= 1 << 30) {
throw new IllegalStateException("Index is too large");
}
this.tableSize = Integer.highestOneBit(entries << 2);
}
final int size() {
return tableSize;
}
abstract long get(int index);
abstract void put(int index, long offset);
int getMask() {
return tableSize - 1;
}
}