Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2015-12-30 00:57:26 +0300
committerJan Kotas <jkotas@microsoft.com>2015-12-30 16:54:31 +0300
commitcc1a7ca9e7894345116c6a2d2b4d7e908847aa66 (patch)
treef378b7e429534f5f781ff392ce31d1fde8099481 /src/Native
parent1bc1dfa2a8470ec9508e04b11d7504e7df907206 (diff)
Compile with -fvisibility=hidden
- Produce smaller and faster code, especially for access to static and thread-local variables - Fix a return value corruption in Unix RhpCheckedLockCmpXchg and RhpCheckedXchg helpers.
Diffstat (limited to 'src/Native')
-rw-r--r--src/Native/CMakeLists.txt1
-rw-r--r--src/Native/Runtime/amd64/WriteBarriers.S36
-rw-r--r--src/Native/Runtime/unix/unixasmmacrosamd64.inc12
-rwxr-xr-xsrc/Native/jitinterface/CMakeLists.txt4
-rw-r--r--src/Native/jitinterface/corinfoexception.cpp7
-rw-r--r--src/Native/jitinterface/dllexport.h10
-rw-r--r--src/Native/jitinterface/jitinterface.cpp3
-rw-r--r--src/Native/jitinterface/jitinterface.def9
-rw-r--r--src/Native/jitinterface/jitwrapper.cpp3
9 files changed, 33 insertions, 52 deletions
diff --git a/src/Native/CMakeLists.txt b/src/Native/CMakeLists.txt
index fe648a769..b7d400b1c 100644
--- a/src/Native/CMakeLists.txt
+++ b/src/Native/CMakeLists.txt
@@ -79,6 +79,7 @@ if (CLR_CMAKE_PLATFORM_UNIX)
add_compile_options(-fms-extensions)
add_compile_options(-fPIC)
+ add_compile_options(-fvisibility=hidden)
endif(CLR_CMAKE_PLATFORM_UNIX)
if(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM)
diff --git a/src/Native/Runtime/amd64/WriteBarriers.S b/src/Native/Runtime/amd64/WriteBarriers.S
index e2f226a1b..3da2b6f21 100644
--- a/src/Native/Runtime/amd64/WriteBarriers.S
+++ b/src/Native/Runtime/amd64/WriteBarriers.S
@@ -15,8 +15,7 @@
.endif
// If g_GCShadow is 0, don't perform the check.
- PREPARE_EXTERNAL_VAR g_GCShadow, rax
- cmp qword ptr [rax], 0
+ cmp qword ptr [C_VAR(g_GCShadow)], 0
je \BASENAME\()_UpdateShadowHeap_Done_\REFREG
// Save DESTREG since we're about to modify it (and we need the original value both within the macro and
@@ -31,13 +30,10 @@
push \DESTREG
// Transform DESTREG into the equivalent address in the shadow heap.
- PREPARE_EXTERNAL_VAR g_lowest_address, rax
- sub \DESTREG, [rax]
+ sub \DESTREG, [C_VAR(g_lowest_address)]
jb \BASENAME\()_UpdateShadowHeap_PopThenDone_\REFREG
- PREPARE_EXTERNAL_VAR g_GCShadow, rax
- add \DESTREG, [rax]
- PREPARE_EXTERNAL_VAR g_GCShadowEnd, rax
- cmp \DESTREG, [rax]
+ add \DESTREG, [C_VAR(g_GCShadow)]
+ cmp \DESTREG, [C_VAR(g_GCShadowEnd)]
ja \BASENAME\()_UpdateShadowHeap_PopThenDone_\REFREG
// Update the shadow heap.
@@ -95,11 +91,9 @@
// If the reference is to an object that's not in an ephemeral generation we have no need to track it
// (since the object won't be collected or moved by an ephemeral collection).
- PREPARE_EXTERNAL_VAR g_ephemeral_low, rax
- cmp \REFREG, [rax]
+ cmp \REFREG, [C_VAR(g_ephemeral_low)]
jb \BASENAME\()_NoBarrierRequired_\REFREG
- PREPARE_EXTERNAL_VAR g_ephemeral_high, rax
- cmp \REFREG, [rax]
+ cmp \REFREG, [C_VAR(g_ephemeral_high)]
jae \BASENAME\()_NoBarrierRequired_\REFREG
// We have a location on the GC heap being updated with a reference to an ephemeral object so we must
@@ -107,8 +101,7 @@
// an entire byte in the card table since it's quicker than messing around with bitmasks and we only write
// the byte if it hasn't already been done since writes are expensive and impact scaling.
shr rdi, 11
- PREPARE_EXTERNAL_VAR g_card_table, rax
- add rdi, [rax]
+ add rdi, [C_VAR(g_card_table)]
cmp byte ptr [rdi], 0FFh
jne \BASENAME\()_UpdateCardTable_\REFREG
@@ -167,11 +160,9 @@ DEFINE_UNCHECKED_WRITE_BARRIER RSI, ESI
// The location being updated might not even lie in the GC heap (a handle or stack location for instance),
// in which case no write barrier is required.
- PREPARE_EXTERNAL_VAR g_lowest_address, rax
- cmp rdi, [rax]
+ cmp rdi, [C_VAR(g_lowest_address)]
jb \BASENAME\()_NoBarrierRequired_\REFREG
- PREPARE_EXTERNAL_VAR g_highest_address, rax
- cmp rdi, [rax]
+ cmp rdi, [C_VAR(g_highest_address)]
jae \BASENAME\()_NoBarrierRequired_\REFREG
DEFINE_UNCHECKED_WRITE_BARRIER_CORE \BASENAME, \REFREG
@@ -262,11 +253,9 @@ LEAF_ENTRY RhpByRefAssignRef, _TEXT
// If the reference is to an object that's not in an ephemeral generation we have no need to track it
// (since the object won't be collected or moved by an ephemeral collection).
- PREPARE_EXTERNAL_VAR g_ephemeral_low, rax
- cmp rcx, [rax]
+ cmp rcx, [C_VAR(g_ephemeral_low)]
jb RhpByRefAssignRef_NotInHeap
- PREPARE_EXTERNAL_VAR g_ephemeral_high, rax
- cmp rcx, [rax]
+ cmp rcx, [C_VAR(g_ephemeral_high)]
jae RhpByRefAssignRef_NotInHeap
// move current rdi value into rcx and then increment the pointers
@@ -279,8 +268,7 @@ LEAF_ENTRY RhpByRefAssignRef, _TEXT
// an entire byte in the card table since it's quicker than messing around with bitmasks and we only write
// the byte if it hasn't already been done since writes are expensive and impact scaling.
shr rcx, 11
- PREPARE_EXTERNAL_VAR g_card_table, rax
- add rcx, [rax]
+ add rcx, [C_VAR(g_card_table)]
cmp byte ptr [rcx], 0FFh
jne RhpByRefAssignRef_UpdateCardTable
ret
diff --git a/src/Native/Runtime/unix/unixasmmacrosamd64.inc b/src/Native/Runtime/unix/unixasmmacrosamd64.inc
index 5669aabf6..bb8738c0b 100644
--- a/src/Native/Runtime/unix/unixasmmacrosamd64.inc
+++ b/src/Native/Runtime/unix/unixasmmacrosamd64.inc
@@ -3,6 +3,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
+#define C_VAR(Name) rip + C_FUNC(Name)
+
.macro NESTED_ENTRY Name, Section, Handler
LEAF_ENTRY \Name, \Section
.ifnc \Handler, NoHandler
@@ -57,16 +59,6 @@ C_FUNC(\Name\()_End):
.cfi_endproc
.endm
-.macro TAILJMP_RAX
- .byte 0x48
- .byte 0xFF
- .byte 0xE0
-.endm
-
-.macro PREPARE_EXTERNAL_VAR Name, HelperReg
- mov \HelperReg, [rip + C_FUNC(\Name)@GOTPCREL]
-.endm
-
.macro push_nonvol_reg Register
push \Register
.cfi_adjust_cfa_offset 8
diff --git a/src/Native/jitinterface/CMakeLists.txt b/src/Native/jitinterface/CMakeLists.txt
index 9832cbce7..1dee1e87c 100755
--- a/src/Native/jitinterface/CMakeLists.txt
+++ b/src/Native/jitinterface/CMakeLists.txt
@@ -6,10 +6,6 @@ set(NATIVE_SOURCES
corinfoexception.cpp
)
-if (WIN32)
- list(APPEND NATIVE_SOURCES jitinterface.def)
-endif ()
-
add_library(jitinterface
SHARED
${NATIVE_SOURCES}
diff --git a/src/Native/jitinterface/corinfoexception.cpp b/src/Native/jitinterface/corinfoexception.cpp
index b8e44fab9..c2dd97c7a 100644
--- a/src/Native/jitinterface/corinfoexception.cpp
+++ b/src/Native/jitinterface/corinfoexception.cpp
@@ -4,18 +4,19 @@
//
#include "corinfoexception.h"
+#include "dllexport.h"
-extern "C" CorInfoException* AllocException(const WCHAR* message, int messageLength)
+DLL_EXPORT CorInfoException* AllocException(const WCHAR* message, int messageLength)
{
return new CorInfoException(message, messageLength);
}
-extern "C" void FreeException(CorInfoException* pException)
+DLL_EXPORT void FreeException(CorInfoException* pException)
{
delete pException;
}
-extern "C" const WCHAR* GetExceptionMessage(const CorInfoException* pException)
+DLL_EXPORT const WCHAR* GetExceptionMessage(const CorInfoException* pException)
{
return pException->GetMessage();
}
diff --git a/src/Native/jitinterface/dllexport.h b/src/Native/jitinterface/dllexport.h
new file mode 100644
index 000000000..3fd5e8989
--- /dev/null
+++ b/src/Native/jitinterface/dllexport.h
@@ -0,0 +1,10 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+#ifdef _WIN32
+#define DLL_EXPORT extern "C" __declspec(dllexport)
+#else
+#define DLL_EXPORT extern "C" __attribute((visibility("default")))
+#endif
diff --git a/src/Native/jitinterface/jitinterface.cpp b/src/Native/jitinterface/jitinterface.cpp
index 7b73f4644..7c04ed30e 100644
--- a/src/Native/jitinterface/jitinterface.cpp
+++ b/src/Native/jitinterface/jitinterface.cpp
@@ -4,6 +4,7 @@
//
#include "jitinterface.h"
+#include "dllexport.h"
enum CORINFO_RUNTIME_LOOKUP_KIND { };
struct CORINFO_LOOKUP_KIND
@@ -31,7 +32,7 @@ CORINFO_LOOKUP_KIND JitInterfaceWrapper::getLocationOfThisType(void* context)
static JitInterfaceWrapper instance;
-extern "C" void* GetJitInterfaceWrapper(IJitInterface *pCorInfo)
+DLL_EXPORT void* GetJitInterfaceWrapper(IJitInterface *pCorInfo)
{
instance._pCorInfo = pCorInfo;
return &instance;
diff --git a/src/Native/jitinterface/jitinterface.def b/src/Native/jitinterface/jitinterface.def
deleted file mode 100644
index ea19c75fa..000000000
--- a/src/Native/jitinterface/jitinterface.def
+++ /dev/null
@@ -1,9 +0,0 @@
-; Copyright (c) Microsoft. All rights reserved.
-; Licensed under the MIT license. See LICENSE file in the project root for full license information.
-
-EXPORTS
- GetJitInterfaceWrapper
- JitWrapper
- AllocException
- FreeException
- GetExceptionMessage
diff --git a/src/Native/jitinterface/jitwrapper.cpp b/src/Native/jitinterface/jitwrapper.cpp
index 3da42ace9..3428356d5 100644
--- a/src/Native/jitinterface/jitwrapper.cpp
+++ b/src/Native/jitinterface/jitwrapper.cpp
@@ -4,6 +4,7 @@
//
#include "corinfoexception.h"
+#include "dllexport.h"
class Jit
{
@@ -16,7 +17,7 @@ public:
void* nativeSizeOfCode) = 0;
};
-extern "C" int JitWrapper(
+DLL_EXPORT int JitWrapper(
CorInfoException **ppException,
Jit* pJit,
void* compHnd,