< prev index next >

src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp

Print this page

        

@@ -81,17 +81,23 @@
 
 #ifdef BUILTIN_SIM
 #define REG_SP REG_RSP
 #define REG_PC REG_RIP
 #define REG_FP REG_RBP
+#define SPELL_REG_SP "rsp"
+#define SPELL_REG_FP "rbp"
 #else
 #define REG_FP 29
 #define REG_LR 30
+
+#define SPELL_REG_SP "sp"
+#define SPELL_REG_FP "x29"
 #endif
 
-NOINLINE address os::current_stack_pointer() {
-  return (address)__builtin_frame_address(0);
+address os::current_stack_pointer() {
+  register void *esp __asm__ (SPELL_REG_SP);
+  return (address) esp;
 }
 
 char* os::non_memory_address_word() {
   // Must never look like an address returned by reserve_memory,
   // even in its subfields (as defined by the CPU immediate fields,

@@ -222,12 +228,27 @@
 #else
   return frame(fr->link(), fr->link(), fr->sender_pc());
 #endif
 }
 
-NOINLINE frame os::current_frame() {
-  intptr_t *fp = *(intptr_t **)__builtin_frame_address(0);
+intptr_t* _get_previous_fp() {
+  register intptr_t **fp __asm__ (SPELL_REG_FP);
+
+  // fp is for this frame (_get_previous_fp). We want the fp for the
+  // caller of os::current_frame*(), so go up two frames. However, for
+  // optimized builds, _get_previous_fp() will be inlined, so only go
+  // up 1 frame in that case.
+  #ifdef _NMT_NOINLINE_
+    return **(intptr_t***)fp;
+  #else
+    return *fp;
+  #endif
+}
+
+
+frame os::current_frame() {
+  intptr_t* fp = _get_previous_fp();
   frame myframe((intptr_t*)os::current_stack_pointer(),
                 (intptr_t*)fp,
                 CAST_FROM_FN_PTR(address, os::current_frame));
   if (os::is_first_C_frame(&myframe)) {
     // stack is not walkable

@@ -236,10 +257,16 @@
     return os::get_sender_for_C_frame(&myframe);
   }
 }
 
 // Utility functions
+
+// From IA32 System Programming Guide
+enum {
+  trap_page_fault = 0xE
+};
+
 #ifdef BUILTIN_SIM
 extern "C" void Fetch32PFI () ;
 extern "C" void Fetch32Resume () ;
 extern "C" void FetchNPFI () ;
 extern "C" void FetchNResume () ;

@@ -638,69 +665,69 @@
 extern "C" {
   int SpinPause() {
     return 0;
   }
 
-  void _Copy_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) {
+  void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
     if (from > to) {
-      const jshort *end = from + count;
+      jshort *end = from + count;
       while (from < end)
         *(to++) = *(from++);
     }
     else if (from < to) {
-      const jshort *end = from;
+      jshort *end = from;
       from += count - 1;
       to   += count - 1;
       while (from >= end)
         *(to--) = *(from--);
     }
   }
-  void _Copy_conjoint_jints_atomic(const jint* from, jint* to, size_t count) {
+  void _Copy_conjoint_jints_atomic(jint* from, jint* to, size_t count) {
     if (from > to) {
-      const jint *end = from + count;
+      jint *end = from + count;
       while (from < end)
         *(to++) = *(from++);
     }
     else if (from < to) {
-      const jint *end = from;
+      jint *end = from;
       from += count - 1;
       to   += count - 1;
       while (from >= end)
         *(to--) = *(from--);
     }
   }
-  void _Copy_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) {
+  void _Copy_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {
     if (from > to) {
-      const jlong *end = from + count;
+      jlong *end = from + count;
       while (from < end)
         os::atomic_copy64(from++, to++);
     }
     else if (from < to) {
-      const jlong *end = from;
+      jlong *end = from;
       from += count - 1;
       to   += count - 1;
       while (from >= end)
         os::atomic_copy64(from--, to--);
     }
   }
 
-  void _Copy_arrayof_conjoint_bytes(const HeapWord* from,
+  void _Copy_arrayof_conjoint_bytes(HeapWord* from,
                                     HeapWord* to,
                                     size_t    count) {
     memmove(to, from, count);
   }
-  void _Copy_arrayof_conjoint_jshorts(const HeapWord* from,
+  void _Copy_arrayof_conjoint_jshorts(HeapWord* from,
                                       HeapWord* to,
                                       size_t    count) {
     memmove(to, from, count * 2);
   }
-  void _Copy_arrayof_conjoint_jints(const HeapWord* from,
+  void _Copy_arrayof_conjoint_jints(HeapWord* from,
                                     HeapWord* to,
                                     size_t    count) {
     memmove(to, from, count * 4);
   }
-  void _Copy_arrayof_conjoint_jlongs(const HeapWord* from,
+  void _Copy_arrayof_conjoint_jlongs(HeapWord* from,
                                      HeapWord* to,
                                      size_t    count) {
     memmove(to, from, count * 8);
   }
 };
< prev index next >