Skip to content

Commit

Permalink
- apply asmjit register allocator bugfix
Browse files Browse the repository at this point in the history
- enable debug builds of asmjit
  • Loading branch information
dpjudas committed Oct 9, 2018
1 parent b7c0cd5 commit e66015c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion asmjit/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 2.8.7)

make_release_only()
#make_release_only()

project(asmjit C)

Expand Down
2 changes: 1 addition & 1 deletion asmjit/asmjit/x86/x86regalloc.cpp
Expand Up @@ -3341,7 +3341,7 @@ ASMJIT_INLINE void X86CallAlloc::alloc() {
// allocation tasks by a single 'xchg' instruction, swapping
// two registers required by the instruction/node or one register
// required with another non-required.
if (C == X86Reg::kKindGp) {
if (C == X86Reg::kKindGp && sPhysId != Globals::kInvalidRegId) {
_context->swapGp(aVReg, bVReg);

aTied->flags |= TiedReg::kRDone;
Expand Down

3 comments on commit e66015c

@noabody
Copy link

@noabody noabody commented on e66015c Dec 4, 2018

Choose a reason for hiding this comment

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

Maybe add an Findasmjit.cmake?
On Ubuntu 18.04 I was seeing messages:

Make Warning at CMakeLists.txt:166 (find_package):
  By not providing "Findasmjit.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "asmjit", but
  CMake did not find one.

  Could not find a package configuration file provided by "asmjit" with any
  of the following names:

    asmjitConfig.cmake
    asmjit-config.cmake

  Add the installation prefix of "asmjit" to CMAKE_PREFIX_PATH or set
  "asmjit_DIR" to a directory containing one of the above files.  If "asmjit"
  provides a separate development package or SDK, be sure it has been
  installed.

So I built asmjit:

git clone --branch master --depth 1 --recursive https://github.com/asmjit/asmjit asmjit

But still seeing messages so I search around and found:
https://raw.githubusercontent.com/xantares/pkgtest/master/cmake/FindAsmJit.cmake which when renamed and placed in cmake cleared the messages.

diff --git a/cmake/Findasmjit.cmake b/cmake/Findasmjit.cmake
index e69de29bb..534130f0d 100644
--- a/cmake/Findasmjit.cmake
+++ b/cmake/Findasmjit.cmake
@@ -0,0 +1,65 @@
+# - Find AsmJit
+# Complete x86/x64 JIT and Remote Assembler for C++
+# https://github.com/kobalicek/asmjit
+#
+# The module defines the following variables:
+#  ASMJIT_FOUND - the system has asmjit
+#  ASMJIT_INCLUDE_DIR - where to find asmjit.h
+#  ASMJIT_INCLUDE_DIRS - asmjit includes
+#  ASMJIT_LIBRARY - where to find the asmjit library
+#  ASMJIT_LIBRARIES - aditional libraries
+#  ASMJIT_ROOT_DIR - root dir (ex. /usr/local)
+
+# set ASMJIT_INCLUDE_DIR
+find_path ( ASMJIT_INCLUDE_DIR
+  NAMES
+    asmjit.h
+  PATH_SUFFIX
+    asmjit
+  DOC
+    "AsmJit include directory"
+)
+
+# set ASMJIT_INCLUDE_DIRS
+set ( ASMJIT_INCLUDE_DIRS ${ASMJIT_INCLUDE_DIR} )
+
+# set ASMJIT_LIBRARY
+find_library ( ASMJIT_LIBRARY
+  NAMES
+    asmjit
+  DOC
+    "AsmJit library location"
+)
+
+# set ASMJIT_LIBRARIES
+set ( ASMJIT_LIBRARIES ${ASMJIT_LIBRARY} )
+
+# root dir
+# try to guess root dir from include dir
+if ( ASMJIT_INCLUDE_DIR )
+  string ( REGEX REPLACE "(.*)/include.*" "\\1" ASMJIT_ROOT_DIR ${ASMJIT_INCLUDE_DIR} )
+
+# try to guess root dir from library dir
+elseif ( ASMJIT_LIBRARY )
+  string ( REGEX REPLACE "(.*)/lib[/|32|64].*" "\\1" ASMJIT_ROOT_DIR ${ASMJIT_LIBRARY} )
+endif ()
+
+# handle REQUIRED and QUIET options
+include ( FindPackageHandleStandardArgs )
+
+find_package_handle_standard_args ( AsmJit DEFAULT_MSG ASMJIT_LIBRARY
+  ASMJIT_INCLUDE_DIR
+  ASMJIT_INCLUDE_DIRS
+  ASMJIT_LIBRARIES
+  ASMJIT_ROOT_DIR
+)
+
+
+mark_as_advanced (
+  ASMJIT_LIBRARY
+  ASMJIT_LIBRARIES
+  ASMJIT_INCLUDE_DIR
+  ASMJIT_INCLUDE_DIRS
+  ASMJIT_ROOT_DIR
+  ASMJIT_INTERFACE_VERSION
+)

But probably would make more sense to just force internal with a command like:

cmake -DFORCE_INTERNAL_ASMJIT=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..

@noabody
Copy link

@noabody noabody commented on e66015c Dec 4, 2018

Choose a reason for hiding this comment

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

Without asmjit libraries, internal is forced by default. The message is just a notification which can be ignored. Just interesting information for Ubuntu users I suppose.

@dpjudas
Copy link
Contributor Author

@dpjudas dpjudas commented on e66015c Dec 4, 2018

Choose a reason for hiding this comment

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

I tried to make the CMake logic for asmjit work the same way as it does for the other 3rd party libraries that are included with GZDoom. However, my cmake skills are extremely poor and if it isn't working I don't know what it takes to fix it.

As of right now, you don't want to use an external build of asmjit anyway. The commit you're commenting on hasn't been PR'ed to the asmjit upstream repository yet. Without it you GZDoom will crash.

Please sign in to comment.