< prev index next >

src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp

Print this page
rev 55764 : 8227680: FastJNIAccessors: Check for JVMTI field access event requests at runtime
Summary: Check JvmtiExport::_field_access_count != 0 at runtime
Reviewed-by: dholmes, eosterlund

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, 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.

@@ -73,10 +73,18 @@
 
   ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
   __ mov32 (rcx, counter);
   __ testb (rcx, 1);
   __ jcc (Assembler::notZero, slow);
+
+  if (JvmtiExport::can_post_field_access()) {
+    // Check to see if a field access watch has been set before we
+    // take the fast path.
+    __ cmp32(ExternalAddress((address) JvmtiExport::get_field_access_count_addr()), 0);
+    __ jcc(Assembler::notZero, slow);
+  }
+
   __ mov(rax, rcx);
   __ andptr(rax, 1);                         // rax, must end up 0
   __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
                                             // obj, notice rax, is 0.
                                             // rdx is data dependent on rcx.

@@ -186,10 +194,18 @@
 
   __ push  (rsi);
   __ mov32 (rcx, counter);
   __ testb (rcx, 1);
   __ jcc (Assembler::notZero, slow);
+
+  if (JvmtiExport::can_post_field_access()) {
+    // Check to see if a field access watch has been set before we
+    // take the fast path.
+    __ cmp32(ExternalAddress((address) JvmtiExport::get_field_access_count_addr()), 0);
+    __ jcc(Assembler::notZero, slow);
+  }
+
   __ mov(rax, rcx);
   __ andptr(rax, 1);                         // rax, must end up 0
   __ movptr(rdx, Address(rsp, rax, Address::times_1, 3*wordSize));
                                             // obj, notice rax, is 0.
                                             // rdx is data dependent on rcx.

@@ -270,10 +286,18 @@
   ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
 
   __ mov32 (rcx, counter);
   __ testb (rcx, 1);
   __ jcc (Assembler::notZero, slow);
+
+  if (JvmtiExport::can_post_field_access()) {
+    // Check to see if a field access watch has been set before we
+    // take the fast path.
+    __ cmp32(ExternalAddress((address) JvmtiExport::get_field_access_count_addr()), 0);
+    __ jcc(Assembler::notZero, slow);
+  }
+
   __ mov(rax, rcx);
   __ andptr(rax, 1);                         // rax, must end up 0
   __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
                                             // obj, notice rax, is 0.
                                             // rdx is data dependent on rcx.
< prev index next >