Book Image

OpenJDK Cookbook

Book Image

OpenJDK Cookbook

Overview of this book

Table of Contents (20 chapters)
OpenJDK Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Adding new intrinsic to HotSpot


Intrinsic is a function whose implementation is handled specially by a compiler. Typically, it means that the function call is replaced by automatically generated instructions. This is very similar to the inline functions, but the compiler knows more about intrinsics as they are part of the compiler itself, so it can use them more wisely.

Intrinsics are usually more performance-oriented than native functions because there is no JNI overhead.

Getting ready

To get started, all we need is an installed NetBeans IDE for code editing and OpenJDK sources. The user should be able to read C++ code and a little knowledge of assembly would be beneficial.

It would be worth checking that SSE4.2 (an extended instruction set with six new commands, mostly for character searching and comparison) is supported by the CPU (the CRC32 command used in our example is from that command set). It was introduced with Core i7 Intel chips back in 2009, so if you are using an Intel CPU, it...