-
Notifications
You must be signed in to change notification settings - Fork 79
Add FEATURE_JIT_SIMD option #966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: pharo-12
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,27 +17,35 @@ include(cmake/macros.cmake) | |
message(STATUS "CMAKE_GENERATOR=${CMAKE_GENERATOR}") | ||
|
||
# Build options | ||
option(VERBOSE_BUILD "Verbose Build" OFF) | ||
option(FEATURE_FFI "Enable FFI" ON) | ||
option(FEATURE_THREADED_FFI "Enable Threaded (running in another thread) FFI" ON) | ||
option(FEATURE_MESSAGE_COUNT "Enable the option to count messages, only valid for StackVM" OFF) | ||
option(FEATURE_NETWORK "Enable network and sockets" ON) | ||
option(FEATURE_LIB_SDL2 "Build SDL2 support" ON) | ||
option(FEATURE_LIB_CAIRO "Build Cairo support" ON) | ||
option(FEATURE_LIB_FREETYPE2 "Build freetype2 support" ON) | ||
option(FEATURE_LIB_GIT2 "Build LibGit2 support" ON) | ||
option(FEATURE_LIB_PTHREADW32 "Windows only, link to win32 version of pthread" OFF) | ||
option(GENERATE_VMMAKER "If it generates the VMMaker image" ON) | ||
option(GENERATE_SOURCES "If it generates the C sources" ON) | ||
option(ALWAYS_INTERACTIVE "Be interactive by default" OFF) | ||
option(BUILD_BUNDLE "Builds a bundle with all dependencies" ON) | ||
option(FEATURE_COMPILE_GNUISATION "Use gcc gnu extensions to compile the VM" ON) | ||
option(PHARO_DEPENDENCIES_PREFER_DOWNLOAD_BINARIES "Prefer downloading dependencies" OFF) | ||
option(FEATURE_COMPILE_INLINE_MEMORY_ACCESSORS "Use inline memory accessors instead of macros" ON) | ||
option(PHARO_VM_IN_WORKER_THREAD "Have support for pharo running in a different thread that the main one" ON) | ||
option(DEPENDENCIES_FORCE_BUILD "Force build libraries" OFF) | ||
option(BUILD_WITH_GRAPHVIZ "Generate dependency graphs" ON) | ||
option(VERSION_UPDATE_FROM_GIT "Extract version information from git tags. Default to true. Follow vX.Y.Z-suffix" TRUE) | ||
option(VERBOSE_BUILD "Verbose Build" OFF) | ||
option(FEATURE_FFI "Enable FFI" ON) | ||
option(FEATURE_THREADED_FFI "Enable Threaded (running in another thread) FFI" ON) | ||
option(FEATURE_MESSAGE_COUNT "Enable the option to count messages, only valid for StackVM" OFF) | ||
option(FEATURE_NETWORK "Enable network and sockets" ON) | ||
option(FEATURE_JIT_SIMD "Use SIMD support in JIT compilation when available" ON) | ||
option(FEATURE_LIB_SDL2 "Build SDL2 support" ON) | ||
option(FEATURE_LIB_CAIRO "Build Cairo support" ON) | ||
option(FEATURE_LIB_FREETYPE2 "Build freetype2 support" ON) | ||
option(FEATURE_LIB_GIT2 "Build LibGit2 support" ON) | ||
option(FEATURE_LIB_PTHREADW32 "Windows only, link to win32 version of pthread" OFF) | ||
option(GENERATE_VMMAKER "If it generates the VMMaker image" ON) | ||
option(GENERATE_SOURCES "If it generates the C sources" ON) | ||
option(ALWAYS_INTERACTIVE "Be interactive by default" OFF) | ||
option(BUILD_BUNDLE "Builds a bundle with all dependencies" ON) | ||
option(FEATURE_COMPILE_GNUISATION | ||
"Use gcc gnu extensions to compile the VM" ON) | ||
option(FEATURE_COMPILE_INLINE_MEMORY_ACCESSORS | ||
"Use inline memory accessors instead of macros" ON) | ||
option(PHARO_DEPENDENCIES_PREFER_DOWNLOAD_BINARIES | ||
"Prefer downloading dependencies" OFF) | ||
option(PHARO_VM_IN_WORKER_THREAD | ||
"Run the VM in a thread different that the main" ON) | ||
option(DEPENDENCIES_FORCE_BUILD | ||
"Force build libraries" OFF) | ||
option(BUILD_WITH_GRAPHVIZ | ||
"Generate dependency graphs" ON) | ||
option(VERSION_UPDATE_FROM_GIT | ||
"Extract version information from git tags. Default to true. Follow vX.Y.Z-suffix" ON) | ||
|
||
|
||
set(APPNAME "Pharo" CACHE STRING "VM Application name") | ||
|
@@ -248,10 +256,6 @@ else() | |
set(GENERATED_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE STRING "Source directory where to find the generated source. Default value is CMAKE_CURRENT_BINARY_DIR") | ||
endif() | ||
|
||
if (${FEATURE_COMPILE_INLINE_MEMORY_ACCESSORS}) | ||
add_compile_definitions(USE_INLINE_MEMORY_ACCESSORS=1) | ||
endif() | ||
|
||
Comment on lines
-251
to
-254
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cleaned a bit these compile time definitions to make them local to the VM library compilation and not global options to the entire project. |
||
set(PLUGIN_GENERATED_FILES | ||
${GENERATED_SOURCE_DIR}/generated/plugins/src/FilePlugin/FilePlugin.c) | ||
|
||
|
@@ -470,6 +474,14 @@ set(VM_SOURCES | |
add_executable(${VM_EXECUTABLE_NAME} ${VM_FRONTEND_APPLICATION_TYPE} ${VM_FRONTEND_SOURCES}) | ||
addLibraryWithRPATH(${VM_LIBRARY_NAME} ${VM_SOURCES}) | ||
|
||
if (${FEATURE_COMPILE_INLINE_MEMORY_ACCESSORS}) | ||
target_compile_definitions(${VM_LIBRARY_NAME} PRIVATE USE_INLINE_MEMORY_ACCESSORS=1) | ||
endif() | ||
|
||
if(${FEATURE_JIT_SIMD}) | ||
target_compile_definitions(${VM_LIBRARY_NAME} PRIVATE FEATURE_JIT_SIMD=1) | ||
endif() | ||
|
||
# | ||
# LibFFI | ||
# | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,7 @@ VMBasicConstants class >> namesDefinedAtCompileTime [ | |
will be emitted within #if defined(ANameDefinedAtCompileTime)...#endif." | ||
^#( VMBIGENDIAN | ||
IMMUTABILITY | ||
FEATURE_JIT_SIMD | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to move this |
||
STACKVM COGVM SPURVM | ||
PharoVM "Pharo vs Squeak" | ||
CheckRememberedInTrampoline "IMMUTABILITY" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -433,6 +433,13 @@ CogX64Compiler >> canZeroExtend [ | |
^true | ||
] | ||
|
||
{ #category : 'testing' } | ||
CogX64Compiler >> checkIs32bit: offset [ | ||
|
||
(offset between: -2147483648 and: 2147483647) ifFalse: [ | ||
self error: 'Cannot jump to distances larger than 32 bits' ] | ||
] | ||
|
||
{ #category : 'accessing' } | ||
CogX64Compiler >> cmpC32RTempByteSize [ | ||
^5 | ||
|
@@ -3596,21 +3603,24 @@ CogX64Compiler >> dispatchConcretizeProcessorSpecific [ | |
{ #category : 'concretize' } | ||
CogX64Compiler >> fillFrom: startMemoryAddr until: endMemoryAddr with: fillReg usingVr: vectorRegister [ | ||
<inline: true> | ||
| fillLoop | | ||
|
||
cogit MoveR: fillReg Mw: 0 r: startMemoryAddr. | ||
cogit AddCq: 8 R: startMemoryAddr. | ||
|
||
cogit AndCq: 16rFFFFFFFFFFFFFFF0 R: startMemoryAddr. | ||
|
||
cogit DupS: 64 R: fillReg Vr: vectorRegister. | ||
"St1 copies data in 128-bit chunks. This may exceed the size of an object (that only needs to be a multiple of 64 bits). | ||
This overflow is not an issue, however. The reason for that is that objects are allocated sequentially in the Eden space | ||
using a bumpAllocator, which means that the overflowing bits won't overwrite another object. This is true even when reaching | ||
the end of the Eden space, as after it we reserve additional headroom." | ||
fillLoop := cogit AlignedSt1S: 64 Vr: vectorRegister R: startMemoryAddr Mw: 16. | ||
cogit CmpR: startMemoryAddr R: endMemoryAddr. | ||
cogit JumpAbove: fillLoop. | ||
self cppIf: #FEATURE_JIT_SIMD | ||
ifTrue: [ | fillLoop | | ||
cogit MoveR: fillReg Mw: 0 r: startMemoryAddr. | ||
cogit AddCq: 8 R: startMemoryAddr. | ||
|
||
cogit AndCq: 16rFFFFFFFFFFFFFFF0 R: startMemoryAddr. | ||
|
||
cogit DupS: 64 R: fillReg Vr: vectorRegister. | ||
"St1 copies data in 128-bit chunks. This may exceed the size of an object (that only needs to be a multiple of 64 bits). | ||
This overflow is not an issue, however. The reason for that is that objects are allocated sequentially in the Eden space | ||
using a bumpAllocator, which means that the overflowing bits won't overwrite another object. This is true even when reaching | ||
the end of the Eden space, as after it we reserve additional headroom." | ||
fillLoop := cogit AlignedSt1S: 64 Vr: vectorRegister R: startMemoryAddr Mw: 16. | ||
cogit CmpR: startMemoryAddr R: endMemoryAddr. | ||
cogit JumpAbove: fillLoop. | ||
] ifFalse: [ | ||
super fillFrom: startMemoryAddr until: endMemoryAddr with: fillReg usingVr: vectorRegister ]. | ||
|
||
^0 "Necessary to keep Slang happy" | ||
] | ||
|
@@ -4276,13 +4286,6 @@ CogX64Compiler >> is32BitSignedImmediate: a64BitUnsignedOperand [ | |
inSmalltalk: [((a64BitUnsignedOperand >> 32) signedIntFromLong + 1 bitXor: 1) = (a64BitUnsignedOperand >> 31 bitAnd: 1)] | ||
] | ||
|
||
{ #category : 'testing' } | ||
CogX64Compiler >> checkIs32bit: offset [ | ||
|
||
(offset between: -2147483648 and: 2147483647) ifFalse: [ | ||
self error: 'Cannot jump to distances larger than 32 bits' ] | ||
] | ||
|
||
Comment on lines
-4279
to
-4285
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method has just been reordered by tonel... |
||
{ #category : 'testing' } | ||
CogX64Compiler >> isAddressRelativeToVarBase: varAddress [ | ||
"Support for addressing variables off the dedicated VarBaseReg. Allow for 1Mb of variables. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I formatted a bit this code, the actually important line is line 25 adding
FEATURE_JIT_SIMD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you formatted or unformatted the code 😆