View | Details | Raw Unified | Return to bug 236988 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-1 / +6 lines)
Lines 22-28 Link Here
22
		libfluidsynth.so:audio/fluidsynth \
22
		libfluidsynth.so:audio/fluidsynth \
23
		libgme.so:audio/libgme
23
		libgme.so:audio/libgme
24
24
25
USES=		cmake gettext jpeg openal pkgconfig
25
USES=		cmake compiler:openmp gettext gl gnome jpeg openal pkgconfig \
26
		sdl
26
27
27
DATADIR=	${DMDIR}/${PORTNAME}
28
DATADIR=	${DMDIR}/${PORTNAME}
28
29
Lines 43-48 Link Here
43
44
44
.include "${.CURDIR}/../doom-data/Makefile.include"
45
.include "${.CURDIR}/../doom-data/Makefile.include"
45
46
47
.if exists(/usr/lib/libstdc++.so)
48
USE_GCC=	yes
49
.endif
50
46
do-install:
51
do-install:
47
	${MKDIR} ${STAGEDIR}${DATADIR}
52
	${MKDIR} ${STAGEDIR}${DATADIR}
48
	${INSTALL_PROGRAM} ${CONFIGURE_WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
53
	${INSTALL_PROGRAM} ${CONFIGURE_WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
(-)files/patch-CMakeLists.txt (+55 lines)
Line 0 Link Here
1
--- CMakeLists.txt.orig	2019-01-20 17:58:02 UTC
2
+++ CMakeLists.txt
3
@@ -163,10 +163,22 @@ option( NO_OPENAL "Disable OpenAL sound support" OFF )
4
 find_package( BZip2 )
5
 find_package( JPEG )
6
 find_package( ZLIB )
7
-# find_package( asmjit )
8
- # no, we're not using external asmjit for now, we made too many modifications to our's.
9
- # if the asmjit author uses our changes then we'll update this.
10
 
11
+include( TargetArch )
12
+
13
+target_architecture(ZDOOM_TARGET_ARCH)
14
+
15
+if( ${ZDOOM_TARGET_ARCH} MATCHES "x86_64" )
16
+	set( HAVE_VM_JIT ON )
17
+endif()
18
+
19
+# no, we're not using external asmjit for now, we made too many modifications to our's.
20
+# if the asmjit author uses our changes then we'll update this.
21
+
22
+#if( ${HAVE_VM_JIT} )
23
+#	find_package( asmjit )
24
+#endif()
25
+
26
 # GME
27
 find_path( GME_INCLUDE_DIR gme/gme.h )
28
 find_library( GME_LIBRARIES gme )
29
@@ -297,15 +309,17 @@ else()
30
 	set( ZLIB_LIBRARY z )
31
 endif()
32
 
33
-if( ASMJIT_FOUND AND NOT FORCE_INTERNAL_ASMJIT )
34
-	message( STATUS "Using system asmjit, includes found at ${ASMJIT_INCLUDE_DIR}" )
35
-else()
36
-	message( STATUS "Using internal asmjit" )
37
-	set( SKIP_INSTALL_ALL TRUE ) # Avoid installing asmjit alongside zdoom
38
-	add_subdirectory( asmjit )
39
-	set( ASMJIT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/asmjit )
40
-	set( ASMJIT_LIBRARIES asmjit )
41
-	set( ASMJIT_LIBRARY asmjit )
42
+if( ${HAVE_VM_JIT} )
43
+	if( ASMJIT_FOUND AND NOT FORCE_INTERNAL_ASMJIT )
44
+		message( STATUS "Using system asmjit, includes found at ${ASMJIT_INCLUDE_DIR}" )
45
+	else()
46
+		message( STATUS "Using internal asmjit" )
47
+		set( SKIP_INSTALL_ALL TRUE ) # Avoid installing asmjit alongside zdoom
48
+		add_subdirectory( asmjit )
49
+		set( ASMJIT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/asmjit )
50
+		set( ASMJIT_LIBRARIES asmjit )
51
+		set( ASMJIT_LIBRARY asmjit )
52
+	endif()
53
 endif()
54
 
55
 if( JPEG_FOUND AND NOT FORCE_INTERNAL_JPEG )
(-)files/patch-src_CMakeLists.txt (+91 lines)
Line 0 Link Here
1
--- src/CMakeLists.txt.orig	2019-01-20 17:58:02 UTC
2
+++ src/CMakeLists.txt
3
@@ -13,7 +13,6 @@ include( CheckIncludeFile )
4
 include( CheckIncludeFiles )
5
 include( CheckLibraryExists )
6
 include( FindPkgConfig )
7
-include( TargetArch )
8
 
9
 if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
10
 	option( NO_STRIP "Do not strip Release or MinSizeRel builds" )
11
@@ -33,8 +32,6 @@ if( APPLE )
12
     option( OSX_COCOA_BACKEND "Use native Cocoa backend instead of SDL" ON )
13
 endif()
14
 
15
-target_architecture(ZDOOM_TARGET_ARCH)
16
-
17
 if( ${ZDOOM_TARGET_ARCH} MATCHES "x86_64" )
18
 	set( X64 64 )
19
 endif()
20
@@ -460,9 +457,15 @@ add_custom_target( revision_check ALL
21
 # Libraries ZDoom needs
22
 
23
 message( STATUS "Fluid synth libs: ${FLUIDSYNTH_LIBRARIES}" )
24
-set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ZLIB_LIBRARIES}" "${JPEG_LIBRARIES}" "${BZIP2_LIBRARIES}" "${GME_LIBRARIES}" "${ASMJIT_LIBRARIES}" "${CMAKE_DL_LIBS}" )
25
-include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" "${ASMJIT_INCLUDE_DIR}" )
26
+set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ZLIB_LIBRARIES}" "${JPEG_LIBRARIES}" "${BZIP2_LIBRARIES}" "${GME_LIBRARIES}" "${CMAKE_DL_LIBS}" )
27
+include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" )
28
 
29
+if( ${HAVE_VM_JIT} )
30
+	add_definitions( -DHAVE_VM_JIT )
31
+	include_directories( "${ASMJIT_INCLUDE_DIR}" )
32
+	set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ASMJIT_LIBRARIES}")
33
+endif()
34
+
35
 if( SNDFILE_FOUND )
36
     set( ZDOOM_LIBS ${ZDOOM_LIBS} "${SNDFILE_LIBRARIES}" )
37
     include_directories( "${SNDFILE_INCLUDE_DIRS}" )
38
@@ -799,6 +802,17 @@ set( NOT_COMPILED_SOURCE_FILES
39
 	zcc-parse.h
40
 )
41
 
42
+set( VM_JIT_SOURCES
43
+	scripting/vm/jit.cpp
44
+	scripting/vm/jit_runtime.cpp
45
+	scripting/vm/jit_call.cpp
46
+	scripting/vm/jit_flow.cpp
47
+	scripting/vm/jit_load.cpp
48
+	scripting/vm/jit_math.cpp
49
+	scripting/vm/jit_move.cpp
50
+	scripting/vm/jit_store.cpp
51
+)
52
+
53
 # This is disabled for now because I cannot find a way to give the .pch file a different name.
54
 # Visual C++ 2015 seems hell-bent on only allowing one .pch file with the same name as the executable.
55
 #enable_precompiled_headers( g_pch2.h FASTMATH_PCH_SOURCES )
56
@@ -1174,14 +1188,6 @@ set (PCH_SOURCES
57
 	scripting/decorate/thingdef_states.cpp
58
 	scripting/vm/vmexec.cpp
59
 	scripting/vm/vmframe.cpp
60
-	scripting/vm/jit.cpp
61
-	scripting/vm/jit_runtime.cpp
62
-	scripting/vm/jit_call.cpp
63
-	scripting/vm/jit_flow.cpp
64
-	scripting/vm/jit_load.cpp
65
-	scripting/vm/jit_math.cpp
66
-	scripting/vm/jit_move.cpp
67
-	scripting/vm/jit_store.cpp
68
 	scripting/zscript/ast.cpp
69
 	scripting/zscript/zcc_compile.cpp
70
 	scripting/zscript/zcc_parser.cpp
71
@@ -1256,6 +1262,12 @@ set (PCH_SOURCES
72
 	events.cpp
73
 )
74
 
75
+if( ${HAVE_VM_JIT} )
76
+	set( PCH_SOURCES ${PCH_SOURCES} ${VM_JIT_SOURCES} )
77
+else()
78
+	set( NOT_COMPILED_SOURCE_FILES ${NOT_COMPILED_SOURCE_FILES} ${VM_JIT_SOURCES} )
79
+endif()
80
+
81
 enable_precompiled_headers( g_pch.h PCH_SOURCES )
82
 
83
 add_executable( zdoom WIN32 MACOSX_BUNDLE
84
@@ -1263,7 +1275,6 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE
85
 	${NOT_COMPILED_SOURCE_FILES}
86
 	__autostart.cpp
87
 	${SYSTEM_SOURCES}
88
-	${X86_SOURCES}
89
 	${FASTMATH_SOURCES}
90
 	${PCH_SOURCES}
91
 	x86.cpp
(-)files/patch-src_d__dehacked.cpp (+18 lines)
Line 0 Link Here
1
--- src/d_dehacked.cpp.orig	2019-01-20 17:58:02 UTC
2
+++ src/d_dehacked.cpp
3
@@ -807,6 +807,7 @@ void SetDehParams(FState *state, int codepointer)
4
 			}
5
 			fclose(dump);
6
 		}
7
+#ifdef HAVE_VM_JIT
8
 		if (Args->CheckParm("-dumpjit"))
9
 		{
10
 			FILE *dump = fopen("dumpjit.txt", "a");
11
@@ -816,6 +817,7 @@ void SetDehParams(FState *state, int codepointer)
12
 			}
13
 			fclose(dump);
14
 		}
15
+#endif // HAVE_VM_JIT
16
 	}
17
 }
18
 
(-)files/patch-src_hwrenderer_scene_hw__bsp.cpp (+29 lines)
Line 0 Link Here
1
--- src/hwrenderer/scene/hw_bsp.cpp.orig	2019-03-24 01:44:59 UTC
2
+++ src/hwrenderer/scene/hw_bsp.cpp
3
@@ -40,7 +40,10 @@
4
 #include "hwrenderer/scene/hw_portal.h"
5
 #include "hwrenderer/utility/hw_clock.h"
6
 #include "hwrenderer/data/flatvertices.h"
7
+
8
+#ifdef ARCH_IA32
9
 #include <immintrin.h>
10
+#endif
11
 
12
 CVAR(Bool, gl_multithread, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
13
 
14
@@ -106,6 +109,7 @@ void HWDrawInfo::WorkerThread()
15
 		auto job = jobQueue.GetJob();
16
 		if (job == nullptr)
17
 		{
18
+#ifdef ARCH_IA32
19
 			// The queue is empty. But yielding would be too costly here and possibly cause further delays down the line if the thread is halted.
20
 			// So instead add a few pause instructions and retry immediately.
21
 			_mm_pause();
22
@@ -118,6 +122,7 @@ void HWDrawInfo::WorkerThread()
23
 			_mm_pause();
24
 			_mm_pause();
25
 			_mm_pause();
26
+#endif
27
 		}
28
 		// Note that the main thread MUST have prepared the fake sectors that get used below!
29
 		// This worker thread cannot prepare them itself without costly synchronization.
(-)files/patch-src_m__swap.h (+19 lines)
Line 0 Link Here
1
--- src/m_swap.h.orig	2019-04-03 11:35:28 UTC
2
+++ src/m_swap.h
3
@@ -129,6 +129,16 @@ inline int BigLong(int &x)
4
 	return x;
5
 }
6
 
7
+inline unsigned int BigLong(unsigned int x)
8
+{
9
+	return x;
10
+}
11
+
12
+inline int BigLong(int x)
13
+{
14
+	return x;
15
+}
16
+
17
 #else
18
 
19
 inline short LittleShort(short x)
(-)files/patch-src_scripting_backend_vmbuilder.cpp (+18 lines)
Line 0 Link Here
1
--- src/scripting/backend/vmbuilder.cpp.orig	2019-01-20 17:58:02 UTC
2
+++ src/scripting/backend/vmbuilder.cpp
3
@@ -922,6 +922,7 @@ void FFunctionBuildList::Build()
4
 
5
 void FFunctionBuildList::DumpJit()
6
 {
7
+#ifdef HAVE_VM_JIT
8
 	FILE *dump = fopen("dumpjit.txt", "w");
9
 	if (dump == nullptr)
10
 		return;
11
@@ -932,6 +933,7 @@ void FFunctionBuildList::DumpJit()
12
 	}
13
 
14
 	fclose(dump);
15
+#endif // HAVE_VM_JIT
16
 }
17
 
18
 
(-)files/patch-src_scripting_vm_vmframe.cpp (+47 lines)
Line 0 Link Here
1
--- src/scripting/vm/vmframe.cpp.orig	2019-01-20 17:58:02 UTC
2
+++ src/scripting/vm/vmframe.cpp
3
@@ -44,11 +44,7 @@
4
 #include "c_cvars.h"
5
 #include "version.h"
6
 
7
-#if (defined(_M_X64  ) || defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(__amd64 ) || defined(__amd64__ ))
8
-#define ARCH_X64
9
-#endif
10
-
11
-#ifdef ARCH_X64
12
+#ifdef HAVE_VM_JIT
13
 CUSTOM_CVAR(Bool, vm_jit, true, CVAR_NOINITCALL)
14
 {
15
 	Printf("You must restart " GAMENAME " for this change to take effect.\n");
16
@@ -56,6 +52,8 @@ CUSTOM_CVAR(Bool, vm_jit, true, CVAR_NOINITCALL)
17
 }
18
 #else
19
 CVAR(Bool, vm_jit, false, CVAR_NOINITCALL|CVAR_NOSET)
20
+FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames) { return FString(); }
21
+void JitRelease() {}
22
 #endif
23
 
24
 cycle_t VMCycles[10];
25
@@ -282,7 +280,7 @@ static bool CanJit(VMScriptFunction *func)
26
 
27
 int VMScriptFunction::FirstScriptCall(VMFunction *func, VMValue *params, int numparams, VMReturn *ret, int numret)
28
 {
29
-#ifdef ARCH_X64
30
+#ifdef HAVE_VM_JIT
31
 	if (vm_jit && CanJit(static_cast<VMScriptFunction*>(func)))
32
 	{
33
 		func->ScriptCall = JitCompile(static_cast<VMScriptFunction*>(func));
34
@@ -290,12 +288,10 @@ int VMScriptFunction::FirstScriptCall(VMFunction *func
35
 			func->ScriptCall = VMExec;
36
 	}
37
 	else
38
+#endif // HAVE_VM_JIT
39
 	{
40
 		func->ScriptCall = VMExec;
41
 	}
42
-#else
43
-	func->ScriptCall = VMExec;
44
-#endif
45
 
46
 	return func->ScriptCall(func, params, numparams, ret, numret);
47
 }

Return to bug 236988