Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Linux/ARM: Fix +3000 bus errors of unit-test in case of O2/O3 levels #6379

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/jit/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,27 +743,27 @@ unsigned __int8 getU1LittleEndian(const BYTE * ptr)

inline
unsigned __int16 getU2LittleEndian(const BYTE * ptr)
{ return *(UNALIGNED unsigned __int16 *)ptr; }
{ return GET_UNALIGNED_VAL16(ptr); }

inline
unsigned __int32 getU4LittleEndian(const BYTE * ptr)
{ return *(UNALIGNED unsigned __int32*)ptr; }
{ return GET_UNALIGNED_VAL32(ptr); }

inline
signed __int8 getI1LittleEndian(const BYTE * ptr)
{ return * (UNALIGNED signed __int8 *)ptr; }
{ return *(UNALIGNED signed __int8 *)ptr; }

inline
signed __int16 getI2LittleEndian(const BYTE * ptr)
{ return * (UNALIGNED signed __int16 *)ptr; }
{ return GET_UNALIGNED_VAL16(ptr); }

inline
signed __int32 getI4LittleEndian(const BYTE * ptr)
{ return *(UNALIGNED signed __int32*)ptr; }
{ return GET_UNALIGNED_VAL32(ptr); }

inline
signed __int64 getI8LittleEndian(const BYTE * ptr)
{ return *(UNALIGNED signed __int64*)ptr; }
{ return GET_UNALIGNED_VAL64(ptr); }

inline
float getR4LittleEndian(const BYTE * ptr)
Expand Down
10 changes: 7 additions & 3 deletions src/pal/inc/pal_endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,12 @@ inline void SwapGuid(GUID *pGuid)
#define VALPTR(x) VAL32(x)
#endif

#if defined(ALIGN_ACCESS) && !defined(_MSC_VER)
#ifdef _ARM_
#define LOG2_PTRSIZE 2
Copy link
Author

@leemgs leemgs Jul 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas , @janvorli The line 102-103 is derived from ./src/inc/stdmacros.h#L131.
For example,

#ifdef _TARGET_ARM_
    #define ALIGN_ACCESS        ((1<<LOG2_PTRSIZE)-1)
#endif

Could you review if the lines are correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep the existing code as is, and just defined the ALIGN_ACCESS macro. It will make it easy to define it for new platforms as necessary. Also, this should be just _ARM_ not _TARGET_ARM_.

#ifdef _ARM_
#define LOG2_PTRSIZE    2 
#define ALIGN_ACCESS    ((1<<LOG2_PTRSIZE)-1) 
#endif

#if defined(ALIGN_ACCESS) && !defined(_MSC_VER) 
... existing code ...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas Thanks. Applied.

#define ALIGN_ACCESS ((1<<LOG2_PTRSIZE)-1)
#endif

#if defined(ALIGN_ACCESS) && !defined(_MSC_VER)
#ifdef __cplusplus
extern "C++" {
// Get Unaligned values from a potentially unaligned object
Expand Down Expand Up @@ -138,7 +142,7 @@ inline void SET_UNALIGNED_64(void *pObject, UINT64 Value)
}
#endif // __cplusplus

#else
#else // defined(ALIGN_ACCESS) && !defined(_MSC_VER)

// Get Unaligned values from a potentially unaligned object
#define GET_UNALIGNED_16(_pObject) (*(UINT16 UNALIGNED *)(_pObject))
Expand All @@ -150,7 +154,7 @@ inline void SET_UNALIGNED_64(void *pObject, UINT64 Value)
#define SET_UNALIGNED_32(_pObject, _Value) (*(UNALIGNED UINT32 *)(_pObject)) = (UINT32)(_Value)
#define SET_UNALIGNED_64(_pObject, _Value) (*(UNALIGNED UINT64 *)(_pObject)) = (UINT64)(_Value)

#endif
#endif // defined(ALIGN_ACCESS) && !defined(_MSC_VER)

// Get Unaligned values from a potentially unaligned object and swap the value
#define GET_UNALIGNED_VAL16(_pObject) VAL16(GET_UNALIGNED_16(_pObject))
Expand Down