prefetch instructions in Hotspot

Vladimir Kozlov vladimir.kozlov at oracle.com
Wed Apr 2 17:18:51 UTC 2014


Yes, you need to rebuild jdk after you modified Unsafe.java.

Vladimir

On 4/2/14 10:15 AM, Mahmood Naderan wrote:
> Right... got it.
> Since I am more familiar with C++ than Java, just want to know if I have to recompile/rebuild or update the jdk since I have modified Unsafe.java. Here is my simple code which fails
>
> $ cat Arr.java
> public class Arr
> {
>    public static void main(String[] args)
>    {
>      int [] a = new int[3];
>      a[0] = 10; a[1] = 20; a[2] = 30;
>      for (int i = 0; i < 3; i++)
>      {
>        sun.misc.Unsafe.prefetchRead(a[i]);
>        System.out.println(a[i]);
>      }
>    }
> }
>
>
>
> $ javac Arr.java
> Arr.java:11: warning: sun.misc.Unsafe is internal proprietary API and may be removed in a future release
>        sun.misc.Unsafe.prefetchRead(a[i]);
>                ^
> Arr.java:11: cannot find symbol
> symbol  : method prefetchRead(int)
> location: class sun.misc.Unsafe
>        sun.misc.Unsafe.prefetchRead(a[i]);
>                       ^
> 1 error
> 1 warning
>
>
>
> What did I miss?
>
>
> Regards,
> Mahmood
>
>
> On Wednesday, April 2, 2014 8:54 PM, Vladimir Kozlov <vladimir.kozlov at oracle.com> wrote:
>
>> You need to download Hotspot JVM sources too that is where library_call.cpp.
>>
>> Vladimir


More information about the hotspot-dev mailing list