summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-03-06 23:11:11 -0800
committerIan Rogers <irogers@google.com>2014-03-06 23:11:11 -0800
commit44d6ff197b340b5ac2a4094db148b39c366317dd (patch)
tree818c34e10f126b20a22ee7abd5f054b7f34c3100
parentb35d722809e93cd2aeaf523255fdfac9eba75f76 (diff)
downloadart-44d6ff197b340b5ac2a4094db148b39c366317dd.zip
art-44d6ff197b340b5ac2a4094db148b39c366317dd.tar.gz
art-44d6ff197b340b5ac2a4094db148b39c366317dd.tar.bz2
Fix issues with clang and BUILD_HOST_64bit.
Change-Id: Id954d0c1144de6eaf89a4d27d205e3bf6ccb655f
-rw-r--r--runtime/arch/x86_64/asm_support_x86_64.S78
-rw-r--r--runtime/arch/x86_64/quick_entrypoints_x86_64.S42
-rw-r--r--runtime/monitor_pool.cc1
-rw-r--r--runtime/monitor_pool.h9
4 files changed, 63 insertions, 67 deletions
diff --git a/runtime/arch/x86_64/asm_support_x86_64.S b/runtime/arch/x86_64/asm_support_x86_64.S
index b59c0cb..14975da 100644
--- a/runtime/arch/x86_64/asm_support_x86_64.S
+++ b/runtime/arch/x86_64/asm_support_x86_64.S
@@ -19,38 +19,25 @@
#include "asm_support_x86_64.h"
-#if defined(__APPLE__)
- // Mac OS' as(1) doesn't let you name macro parameters.
+#if defined(__clang__)
+ // Clang's as(1) doesn't let you name macro parameters.
#define MACRO0(macro_name) .macro macro_name
#define MACRO1(macro_name, macro_arg1) .macro macro_name
#define MACRO2(macro_name, macro_arg1, macro_args2) .macro macro_name
#define MACRO3(macro_name, macro_arg1, macro_args2, macro_args3) .macro macro_name
#define END_MACRO .endmacro
- // Mac OS' as(1) uses $0, $1, and so on for macro arguments, and function names
- // are mangled with an extra underscore prefix. The use of $x for arguments
- // mean that literals need to be represented with $$x in macros.
- #define SYMBOL(name) _ ## name
- #define PLT_SYMBOL(name) _ ## name
+ // Clang's as(1) uses $0, $1, and so on for macro arguments.
#define VAR(name,index) SYMBOL($index)
#define PLT_VAR(name, index) SYMBOL($index)
#define REG_VAR(name,index) %$index
#define CALL_MACRO(name,index) $index
+ #define FUNCTION_TYPE(name,index) .type $index, @function
+ #define SIZE(name,index) .size $index, .-$index
+
+ // The use of $x for arguments mean that literals need to be represented with $$x in macros.
#define LITERAL(value) $value
#define MACRO_LITERAL(value) $$value
-
- // Mac OS' doesn't like cfi_* directives
- #define CFI_STARTPROC
- #define CFI_ENDPROC
- #define CFI_ADJUST_CFA_OFFSET(size)
- #define CFI_DEF_CFA(reg,size)
- #define CFI_DEF_CFA_REGISTER(reg)
- #define CFI_RESTORE(reg)
- #define CFI_REL_OFFSET(reg,size)
-
- // Mac OS' doesn't support certain directives
- #define FUNCTION_TYPE(name)
- #define SIZE(name)
#else
// Regular gas(1) lets you name macro parameters.
#define MACRO0(macro_name) .macro macro_name
@@ -65,16 +52,19 @@
// no special meaning to $, so literals are still just $x. The use of altmacro means % is a
// special character meaning care needs to be taken when passing registers as macro arguments.
.altmacro
- #define SYMBOL(name) name
- #define PLT_SYMBOL(name) name@PLT
#define VAR(name,index) name&
#define PLT_VAR(name, index) name&@PLT
#define REG_VAR(name,index) %name
#define CALL_MACRO(name,index) name&
+ #define FUNCTION_TYPE(name,index) .type name&, @function
+ #define SIZE(name,index) .size name, .-name
+
#define LITERAL(value) $value
#define MACRO_LITERAL(value) $value
+#endif
- // CFI support
+ // CFI support.
+#if !defined(__APPLE__)
#define CFI_STARTPROC .cfi_startproc
#define CFI_ENDPROC .cfi_endproc
#define CFI_ADJUST_CFA_OFFSET(size) .cfi_adjust_cfa_offset size
@@ -82,9 +72,25 @@
#define CFI_DEF_CFA_REGISTER(reg) .cfi_def_cfa_register reg
#define CFI_RESTORE(reg) .cfi_restore reg
#define CFI_REL_OFFSET(reg,size) .cfi_rel_offset reg,size
+#else
+ // Mac OS' doesn't like cfi_* directives.
+ #define CFI_STARTPROC
+ #define CFI_ENDPROC
+ #define CFI_ADJUST_CFA_OFFSET(size)
+ #define CFI_DEF_CFA(reg,size)
+ #define CFI_DEF_CFA_REGISTER(reg)
+ #define CFI_RESTORE(reg)
+ #define CFI_REL_OFFSET(reg,size)
+#endif
- #define FUNCTION_TYPE(name) .type name&, @function
- #define SIZE(name) .size name, .-name
+ // Symbols.
+#if !defined(__APPLE__)
+ #define SYMBOL(name) name
+ #define PLT_SYMBOL(name) name ## @PLT
+#else
+ // Mac OS' symbols have an _ prefix.
+ #define SYMBOL(name) _ ## name
+ #define PLT_SYMBOL(name) _ ## name
#endif
/* Cache alignment for function entry */
@@ -93,7 +99,7 @@ MACRO0(ALIGN_FUNCTION_ENTRY)
END_MACRO
MACRO1(DEFINE_FUNCTION, c_name)
- FUNCTION_TYPE(\c_name)
+ FUNCTION_TYPE(\c_name, 0)
.globl VAR(c_name, 0)
ALIGN_FUNCTION_ENTRY
VAR(c_name, 0):
@@ -102,7 +108,7 @@ END_MACRO
MACRO1(END_FUNCTION, c_name)
CFI_ENDPROC
- SIZE(\c_name)
+ SIZE(\c_name, 0)
END_MACRO
MACRO1(PUSH, reg)
@@ -118,7 +124,7 @@ MACRO1(POP, reg)
END_MACRO
MACRO1(UNIMPLEMENTED,name)
- FUNCTION_TYPE(\name)
+ FUNCTION_TYPE(\name, 0)
.globl VAR(name, 0)
ALIGN_FUNCTION_ENTRY
VAR(name, 0):
@@ -126,21 +132,7 @@ VAR(name, 0):
int3
int3
CFI_ENDPROC
- SIZE(\name)
-END_MACRO
-
-MACRO0(SETUP_GOT_NOSAVE)
- call __x86.get_pc_thunk.bx
- addl $_GLOBAL_OFFSET_TABLE_, %ebx
-END_MACRO
-
-MACRO0(SETUP_GOT)
- PUSH ebx
- SETUP_GOT_NOSAVE
-END_MACRO
-
-MACRO0(UNDO_SETUP_GOT)
- POP ebx
+ SIZE(\name, 0)
END_MACRO
#endif // ART_RUNTIME_ARCH_X86_64_ASM_SUPPORT_X86_64_S_
diff --git a/runtime/arch/x86_64/quick_entrypoints_x86_64.S b/runtime/arch/x86_64/quick_entrypoints_x86_64.S
index 863fa31..da09861 100644
--- a/runtime/arch/x86_64/quick_entrypoints_x86_64.S
+++ b/runtime/arch/x86_64/quick_entrypoints_x86_64.S
@@ -33,7 +33,7 @@ MACRO0(SETUP_SAVE_ALL_CALLEE_SAVE_FRAME)
PUSH r12 // Callee save.
PUSH rbp // Callee save.
PUSH rbx // Callee save.
- subq LITERAL(8), %rsp // Space for Method* (also aligns the frame).
+ subq MACRO_LITERAL(8), %rsp // Space for Method* (also aligns the frame).
CFI_ADJUST_CFA_OFFSET(8)
// R10 := ArtMethod* for ref and args callee save frame method.
movq RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET(%r10), %r10
@@ -76,7 +76,7 @@ MACRO0(SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME)
PUSH rdx // Quick arg 2.
PUSH rcx // Quick arg 3.
// Create space for FPR args and create 2 slots, 1 of padding and 1 for the ArtMethod*.
- subq LITERAL(80), %rsp
+ subq MACRO_LITERAL(80), %rsp
CFI_ADJUST_CFA_OFFSET(80)
// R10 := ArtMethod* for ref and args callee save frame method.
movq RUNTIME_REF_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET(%r10), %r10
@@ -103,7 +103,7 @@ MACRO0(RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME)
movq 56(%rsp), %xmm5
movq 64(%rsp), %xmm6
movq 72(%rsp), %xmm7
- addq LITERAL(80), %rsp
+ addq MACRO_LITERAL(80), %rsp
CFI_ADJUST_CFA_OFFSET(-80)
// Restore callee and GPR args, mixed together to agree with core spills bitmap.
POP rcx
@@ -226,26 +226,26 @@ INVOKE_TRAMPOLINE art_quick_invoke_virtual_trampoline_with_access_check, artInvo
MACRO2(LOOP_OVER_SHORTY_LOADING_XMMS, xmm_reg, finished)
1: // LOOP
movb (%r10), %al // al := *shorty
- addq LITERAL(1), %r10 // shorty++
- cmpb LITERAL(0), %al // if (al == '\0') goto xmm_setup_finished
+ addq MACRO_LITERAL(1), %r10 // shorty++
+ cmpb MACRO_LITERAL(0), %al // if (al == '\0') goto xmm_setup_finished
je VAR(finished, 1)
- cmpb LITERAL(68), %al // if (al == 'D') goto FOUND_DOUBLE
+ cmpb MACRO_LITERAL(68), %al // if (al == 'D') goto FOUND_DOUBLE
je 2f
- cmpb LITERAL(70), %al // if (al == 'F') goto FOUND_FLOAT
+ cmpb MACRO_LITERAL(70), %al // if (al == 'F') goto FOUND_FLOAT
je 3f
- addq LITERAL(4), %r11 // arg_array++
+ addq MACRO_LITERAL(4), %r11 // arg_array++
// Handle extra space in arg array taken by a long.
- cmpb LITERAL(74), %al // if (al != 'J') goto LOOP
+ cmpb MACRO_LITERAL(74), %al // if (al != 'J') goto LOOP
jne 1b
- addq LITERAL(4), %r11 // arg_array++
+ addq MACRO_LITERAL(4), %r11 // arg_array++
jmp 1b // goto LOOP
2: // FOUND_DOUBLE
movsd (%r11), REG_VAR(xmm_reg, 0)
- addq LITERAL(8), %r11 // arg_array+=2
+ addq MACRO_LITERAL(8), %r11 // arg_array+=2
jmp 4f
3: // FOUND_FLOAT
movss (%r11), REG_VAR(xmm_reg, 0)
- addq LITERAL(4), %r11 // arg_array++
+ addq MACRO_LITERAL(4), %r11 // arg_array++
4:
END_MACRO
@@ -257,27 +257,27 @@ END_MACRO
MACRO3(LOOP_OVER_SHORTY_LOADING_GPRS, gpr_reg64, gpr_reg32, finished)
1: // LOOP
movb (%r10), %al // al := *shorty
- addq LITERAL(1), %r10 // shorty++
- cmpb LITERAL(0), %al // if (al == '\0') goto gpr_setup_finished
+ addq MACRO_LITERAL(1), %r10 // shorty++
+ cmpb MACRO_LITERAL(0), %al // if (al == '\0') goto gpr_setup_finished
je VAR(finished, 2)
- cmpb LITERAL(74), %al // if (al == 'J') goto FOUND_LONG
+ cmpb MACRO_LITERAL(74), %al // if (al == 'J') goto FOUND_LONG
je 2f
- cmpb LITERAL(70), %al // if (al == 'F') goto SKIP_FLOAT
+ cmpb MACRO_LITERAL(70), %al // if (al == 'F') goto SKIP_FLOAT
je 3f
- cmpb LITERAL(68), %al // if (al == 'D') goto SKIP_DOUBLE
+ cmpb MACRO_LITERAL(68), %al // if (al == 'D') goto SKIP_DOUBLE
je 4f
movl (%r11), REG_VAR(gpr_reg32, 1)
- addq LITERAL(4), %r11 // arg_array++
+ addq MACRO_LITERAL(4), %r11 // arg_array++
jmp 5f
2: // FOUND_LONG
movq (%r11), REG_VAR(gpr_reg64, 0)
- addq LITERAL(8), %r11 // arg_array+=2
+ addq MACRO_LITERAL(8), %r11 // arg_array+=2
jmp 5f
3: // SKIP_FLOAT
- addq LITERAL(4), %r11 // arg_array++
+ addq MACRO_LITERAL(4), %r11 // arg_array++
jmp 1b
4: // SKIP_DOUBLE
- addq LITERAL(8), %r11 // arg_array+=2
+ addq MACRO_LITERAL(8), %r11 // arg_array+=2
jmp 1b
5:
END_MACRO
diff --git a/runtime/monitor_pool.cc b/runtime/monitor_pool.cc
index 19e569d..eb7525a 100644
--- a/runtime/monitor_pool.cc
+++ b/runtime/monitor_pool.cc
@@ -18,6 +18,7 @@
#include "base/logging.h"
#include "base/mutex-inl.h"
+#include "thread-inl.h"
#include "monitor.h"
namespace art {
diff --git a/runtime/monitor_pool.h b/runtime/monitor_pool.h
index 32f3f4e..82d0fee 100644
--- a/runtime/monitor_pool.h
+++ b/runtime/monitor_pool.h
@@ -17,11 +17,14 @@
#ifndef ART_RUNTIME_MONITOR_POOL_H_
#define ART_RUNTIME_MONITOR_POOL_H_
-#include "monitor.h"
+#ifdef __LP64__
+#include <bitset>
+#include <stdint.h>
+#include "monitor.h"
+#include "runtime.h"
#include "safe_map.h"
-
-#include <stdint.h>
+#endif
namespace art {