Both sun.nio.fs.UnixException and sun.nio.fs.WindowsException are thrown from the native code with an error code in hands. NIO code then translates them to appropriate public exceptions, ignoring the original stack traces. In order to improve performance for methods that "normally" return non-zero errors (like Files.exists culminating in stat call), we need to make these exceptions stackless.
Benchmark:
http://cr.openjdk.java.net/~shade/8153414/StatBench.java
Runnable JAR:
http://cr.openjdk.java.net/~shade/8153414/benchmarks.jar
Webrev:
http://cr.openjdk.java.net/~shade/8153414/webrev.00/