View BufferByteToShort.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jmh; | |
import jdk.incubator.vector.ByteVector; | |
import jdk.incubator.vector.Vector; | |
import jdk.incubator.vector.VectorMask; | |
import jdk.incubator.vector.VectorOperators; | |
import jdk.incubator.vector.VectorShuffle; | |
import jdk.incubator.vector.VectorSpecies; | |
import org.openjdk.jmh.annotations.Benchmark; | |
import org.openjdk.jmh.annotations.BenchmarkMode; |
View pr-117.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/hotspot/share/classfile/vmIntrinsics.hpp b/src/hotspot/share/classfile/vmIntrinsics.hpp | |
index 0035dc20dde..24cfbfb1ac2 100644 | |
--- a/src/hotspot/share/classfile/vmIntrinsics.hpp | |
+++ b/src/hotspot/share/classfile/vmIntrinsics.hpp | |
@@ -809,140 +809,278 @@ class methodHandle; | |
/* Vector API intrinsification support */ \ | |
\ | |
do_intrinsic(_VectorUnaryOp, jdk_internal_vm_vector_VectorSupport, vector_unary_op_name, vector_unary_op_sig, F_S) \ | |
- do_signature(vector_unary_op_sig, "(ILjava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;ILjdk/internal/vm/vector/VectorSupport$Vector;" \ | |
- "Ljdk/internal/vm/vector/VectorSupport$VectorMask;Ljdk/internal/vm/vector/VectorSupport$UnaryOperation;)"\ |
View TestLoadStoreInts.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jdk.incubator.foreign.CLinker; | |
import jdk.incubator.foreign.MemoryAddress; | |
import jdk.incubator.foreign.MemorySegment; | |
import jdk.incubator.foreign.ResourceScope; | |
import jdk.incubator.vector.IntVector; | |
import jdk.incubator.vector.VectorSpecies; | |
import org.openjdk.jmh.annotations.Benchmark; | |
import org.openjdk.jmh.annotations.BenchmarkMode; | |
import org.openjdk.jmh.annotations.Fork; | |
import org.openjdk.jmh.annotations.Measurement; |
View TestLoadStoreBytes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jmh; | |
import jdk.incubator.foreign.CLinker; | |
import jdk.incubator.foreign.MemoryAccess; | |
import jdk.incubator.foreign.MemoryAddress; | |
import jdk.incubator.foreign.MemorySegment; | |
import jdk.incubator.foreign.ResourceScope; | |
import jdk.incubator.vector.ByteVector; | |
import jdk.incubator.vector.IntVector; | |
import jdk.incubator.vector.VectorSpecies; |
View StringToCharStarStar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/java --source 17 --enable-native-access ALL-UNNAMED --add-modules jdk.incubator.foreign | |
import jdk.incubator.foreign.*; | |
import java.util.*; | |
import java.util.stream.*; | |
public class StringToCharStarStar { | |
public static void main(String[] args) { | |
List<String> strings = List.of(args); |
View JMMSample_06_Finals.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.openjdk.jcstress.tests.singletons; | |
import org.openjdk.jcstress.annotations.Actor; | |
import org.openjdk.jcstress.annotations.JCStressTest; | |
import org.openjdk.jcstress.annotations.Outcome; | |
import org.openjdk.jcstress.annotations.State; | |
import org.openjdk.jcstress.infra.results.I_Result; | |
import static org.openjdk.jcstress.annotations.Expect.ACCEPTABLE; | |
import static org.openjdk.jcstress.annotations.Expect.ACCEPTABLE_INTERESTING; |
View Life.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2013, 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 | |
* under the terms of the GNU General Public License version 2 only, as | |
* published by the Free Software Foundation. Oracle designates this | |
* particular file as subject to the "Classpath" exception as provided | |
* by Oracle in the LICENSE file that accompanied this code. | |
* |
View gist:1334699
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn render-image [image] | |
(let [out (ByteArrayOutputStream.)] | |
(do (ImageIO/write image "png" out) (ByteArrayInputStream. (.toByteArray out))))) | |
; ":use" needed for compojure.response | |
(extend-protocol Renderable | |
BufferedImage | |
(render [image _] | |
(-> (ring.util.response/response (render-image image)) | |
(ring.util.response/content-type "image/png")))) |
View gist:1333859
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn- image-mandel-doseq | |
([[dx dy w h m] limit] | |
(let [image (BufferedImage. w h BufferedImage/TYPE_INT_RGB)] | |
(image-mandel-doseq dx dy m image limit))) | |
([dx dy m ^BufferedImage image limit] | |
(let [raster (.getRaster image)] | |
(doseq [[x y rate] m] | |
(.setPixel raster (int (- x dx)) (int (- y dy)) (ints (rgb (angle rate limit))))) | |
[dx dy image]))) |
View gist:1333795
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn image-mandel | |
([size a b limit] | |
(let [[_ _ ms] (mandelbrot-seqs 1 size a b limit) | |
[_ _ image] (image-mandel-doseq (first ms) limit)] | |
image)) | |
([n size a b limit] | |
(let [[w h ms] (mandelbrot-seqs n size a b limit) | |
image (BufferedImage. w h BufferedImage/TYPE_INT_RGB) | |
raster (.getRaster image)] | |
(dorun |
NewerOlder