A high level API to express vectorized operations in Java

Overview

vector-handle

A high level API to express vectorized operations on primitive arrays in Java allowing to specify the vectorized operations as a simple lambda.

example

private static final VH = VectorHandle.of(lookup(), int.class, int.class, int.class);
...
var dest = new int[4];
var a = new int[] { 1, 2, 3, 4 };
var b = new int[] { 4, 4, 4, 4 };
VH.apply(dest, a, b, (x, y) -> x + y * 2);
System.out.println(Arrays.toString(dest)); // [9, 10, 11, 12]

available operations

The lambda used by the variations of the method apply() only accept the following operator

  • constants (any static final fields): Foo.A_CONSTANT
  • literals: 1, 1L, 1.0f, 1.0
  • parameters (any lambda parameters): x, y, etc
  • Unary operator: -
  • Binary operators: +, -, *, /, Math.min(), Math.max()

how to build it

This project requires the JDK 16, it uses internally the Vector API (jdk.incubator.vector)

  mvn packages

how it works ?

Lambdas in Java are desugared as static method where there are declared. To find the corresponding class and method name to the lambda, the lambda is first serialized by explicitly calling writeReplace() (all serialized lambda proxies have that method) to get the resulting java.lang.invoke.SerializedLambda. Then using ASM, the bytecode lambda method is read and transformed to a tree of expressions (AST) using a simple abstract interpretation. From the AST, a new bytecode using the vector API (jdk.incubator.vector) is generated with ASM and loaded using Lookup.defineHiddenClass. When calling apply, a mutable call site is used to do all the operations above and see the generated bytecode as a method handle.

You might also like...

The project was created using the API of the Spotify application.

Spotify API The project was created using the API of the Spotify application.

Jan 27, 2022

This API provides functionalities to lookup and manage user accounts

This API provides functionalities to lookup and manage user accounts. Any human or computer system that will interact with any of the API's requires being authenticated as a user. The API allows for common functionalities such as creating a new user account, resetting passwords and generating JWT tokens.

Jan 22, 2022

A Fast, Secure, Ready to use, Highly customizable email verifier API

Email verification API What is this? A Fast, Secure, Ready to use, Highly customizable email verifier API. How to use Clone the project git clone http

Oct 4, 2022

Simple, server side api for drawing on maps with runtime only state and no id collisions

Simple, server side api for drawing on maps with runtime only state and no id collisions! It can be used in non-main/server threads for better performance/more fps.

Sep 2, 2022

A JavaCard applet for setting the global PIN (0x11) on a card using GlobalPlatform API

A JavaCard applet for setting the global PIN (0x11) on a card using GlobalPlatform API

Mar 4, 2022

An open-source component of TabLight project "Base-API"

DataAddons is a library (or framework?) created for Minecraft providing comfortable abstractions making additions over already existing data, generally, it is anti-pattern ans YOU SHOULDN'T USE IT in normal programms.

Mar 8, 2022

Backend for Saunah Management App provides a REST-API for the Saunah management app

🛁 🔥 Saunah Backend Backend for Saunah Management App. This application provides a REST-API for the Saunah management app. 👨🏼‍💻 Technology Stack T

Jun 13, 2022

Public API for all of ID2R's projects

Public API for all of ID2R's projects. This API contains some useful utilities and tools that will help ID2R to deliver high quality code. originally developed by Invvk.

Sep 8, 2022

A Parser That parses OpenAPI definitions in JSON or YAML format and Generates Pact files That contain HTTP request/response interactions by parsing Given Open API specifications

This is a Parser That parses OpenAPI definitions in JSON or YAML format and Generates Pact files That contain HTTP request/response interactions by parsing Given Open API specifications.

Mar 19, 2022
Owner
Rémi Forax
Rémi Forax
A calculator that performs various operations such as addition, subtraction, multiplication and division of positive and negative values

A calculator that performs various operations such as addition, subtraction, multiplication and division of positive and negative values The calculator also does percentages, square roots and squares

Andrey Fabricio 1 Jan 31, 2022
JPassport works like Java Native Access (JNA) but uses the Foreign Linker API instead of JNI. Similar to JNA, you declare a Java interface that is bound to the external C library using method names.

JPassport works like Java Native Access (JNA) but uses the Foreign Linker API instead of JNI. Similar to JNA, you declare a Java interface t

null 28 Dec 30, 2022
API gateway for REST and SOAP written in Java.

Membrane Service Proxy Reverse HTTP proxy (framework) written in Java, that can be used as an API gateway as a security proxy for HTTP based integrati

predic8 GmbH 389 Dec 31, 2022
Leveraging Java 8, create an API with a multi-tier user system.

Project 0 Description Leveraging Java 8, create an API with a multi-tier user system. You may choose the actual use case for your application as long

null 1 Jan 9, 2022
Simple API, Complex Emails (JavaMail smtp wrapper)

Simple Java Mail Simple Java Mail is the simplest to use lightweight mailing library for Java, while being able to send complex emails including CLI s

Benny Bottema 1k Jan 5, 2023
This service checks the Co-WIN public API at a specific interval and send update to users specified telegram bot.

COVID VACCINE TELEGRAM BOT USING SPRING BOOT This application is a covid vaccine slot notifier via telegram bot. This application uses public CO-WIN A

Hardeek Sharma 6 Oct 4, 2022
Jiskord is a selfbot wrapper for Discord with almost every API endpoint accessible

Jiskord Jiskord is a selfbot wrapper for Discord with almost every API endpoint accessible. This library is inspired by Discum. It is made using Java

Vinesh Rajpurohit 5 Feb 28, 2022
SpringBoot Micro Services, Discovery Server, Discovery Client, API-Gateway

SpringBoot Micro Services, Discovery Server, Discovery Client, API-Gateway

null 2 Jan 26, 2022
Simple way of causing a bsod using the native api implemented into a 1.12.2 Forge mod

Simple-BSOD-Mod Simple way of causing a bsod using the native api implemented into a 1.12.2 Forge mod. Dowload It HERE To make your own you can go to

INZO_Technologies 5 Dec 28, 2022
This repository holds the source code for TML (Tecknix Mod Loader)'s API.

This repository contains the modding API not the MDK (Mod Development Kit). This repository will not give you the ability to mod Tecknix Client but you can contribute to the repository if you have events you would like to add.

Tecknix Client 6 Aug 1, 2022