dyngen-exec.h cleanup
Hi,
This patch cleans up dyngen-exec.h a bit. It works for me with Linux and OpenBSD hosts, but I wonder if some other hosts will be broken. Please test.
dyngen-exec.h +0 -54
@@ -32,56 +32,9 @@host headers do not allow that. */ #include <stddef.h> -#ifdef __OpenBSD__ -#include <sys/types.h> -#else -typedef unsigned char uint8_t ; -typedef unsigned short uint16_t ; -typedef unsigned int uint32_t ; -// Linux/Sparc64 defines uint64_t -#if !(defined (__sparc_v9__) && defined(__linux__)) && !(defined(__APPLE__) && defined(__x86_64__)) -/* XXX may be done for all 64 bits targets ? */ -#if defined (__x86_64__) || defined(__ia64) || defined(__s390x__) || defined(__alpha__) || defined(_ARCH_PPC64) -typedef unsigned long uint64_t ; -#else -typedef unsigned long long uint64_t ; -#endif -#endif - -/* if Solaris/__sun__, don't typedef int8_t, as it will be typedef'd -prior to this and will cause an error in compliation, conflicting -with /usr/include/sys/int_types.h, line 75 */ -#ifndef __sun__ -typedef signed char int8_t ; -#endif -typedef signed short int16_t ; -typedef signed int int32_t ; -// Linux/Sparc64 defines int64_t -#if !(defined (__sparc_v9__) && defined(__linux__)) && !(defined(__APPLE__) && defined(__x86_64__)) -#if defined (__x86_64__) || defined(__ia64) || defined(__s390x__) || defined(__alpha__) || defined(_ARCH_PPC64) -typedef signed long int64_t ; -#else -typedef signed long long int64_t ; -#endif -#endif -#endif -/* XXX: This may be wrong for 64-bit ILP32 hosts. */ typedef void *host_reg_t ; -#define INT8_MIN (-128) -#define INT16_MIN (-32767-1) -#define INT32_MIN (-2147483647-1) -#define INT64_MIN (-(int64_t)(9223372036854775807)-1) -#define INT8_MAX (127) -#define INT16_MAX (32767) -#define INT32_MAX (2147483647) -#define INT64_MAX ((int64_t)(9223372036854775807)) -#define UINT8_MAX (255) -#define UINT16_MAX (65535) -#define UINT32_MAX (4294967295U) -#define UINT64_MAX ((uint64_t)(18446744073709551615)) -#ifdef HOST_BSD typedef struct __sFILE FILE ;#else
@@ -90,8 +43,6 @@extern int fprintf (FILE *,const char *, ...);extern int fputs (const char *,FILE *);extern int printf (const char *, ...); -#undef NULL -#define NULL 0#if defined(__i386__)#define AREG0 "ebp"
@@ -155,11 +106,6 @@#error unsupported CPU#endif -#define xglue (x, y) x ## y -#define glue (x, y) xglue(x, y) -#define stringify (s) tostring(s) -#define tostring (s) #s -/* The return address may point to the start of the next instruction. Subtracting one gets us the call instruction itself. */ #if defined(__s390__)
Quoted 5 lines · Blue Swirl
Hi,
This patch cleans up
dyngen-exec.ha bit. It works for me with Linux and OpenBSD hosts, but I wonder if some other hosts will be broken. Please test.
Mmmh, I played with such removals as well but always felt highly uncomfortable due to the hard-to-assess side effects of this old code. Also, some discussion on this list suggested that it's more efficient to look into converting the remaining AREGS to TCG and finally do the ultimative "rm dyngen-exec.h". Don't you want to spend some time on this already?
Jan
PS: Please try to post such patches inlined or at least without base64 encoding.
Quoted 4 lines · Jan Kiszka
Also, some discussion on this list suggested that it's more efficient to look into converting the remaining AREGS to TCG and finally do the ultimative "rm
dyngen-exec.h". Don't you want to spend some time on this already?
This requires modifying ARM translator which is the last one to use AREGn with n>0. And don't all targets use AREG0 as a pointer to the CPU state?
Laurent
Quoted 9 lines · Laurent Desnogues
Quoted 4 lines · Jan Kiszka
Also, some discussion on this list suggested that it's more efficient to look into converting the remaining AREGS to TCG and finally do the ultimative "rm
dyngen-exec.h". Don't you want to spend some time on this already?This requires modifying ARM translator which is the last one to use AREGn with n>0. And don't all targets use AREG0 as a pointer to the CPU state?
Yes, but wasn't it you who suggested that all those users should be converted over to the tcg_global_reg API?
There is surely some work to do, and that probably across all archs. But the sooner we should start. dyngen-exec.h is a constant source of pain when you try to introduce new headers or refactor existing ones. /me was so far lacking the time to finally attack this (and instead had to add yet another hack with the recent monitor series, see disas.h).
Jan
Quoted 7 lines · Jan Kiszka
Quoted 6 lines · Laurent Desnogues
Quoted 4 lines · Jan Kiszka
Also, some discussion on this list suggested that it's more efficient to look into converting the remaining AREGS to TCG and finally do the ultimative "rm
dyngen-exec.h". Don't you want to spend some time on this already?
Quoted 6 lines
Quoted 3 lines
This requires modifying ARM translator which is the last one to use AREGn with n>0. And don't all targets use AREG0 as a pointer to the CPU state?
Yes, but wasn't it you who suggested that all those users should be converted over to the
tcg_global_regAPI?
Yes, and I did the work for ARM. However when considering the removal of AREG0, and after looking at generated code, I came to the perhaps premature conclusion that removing it would not bring me any speedup (at least for a not so register starved target as x86_64).
Quoted 3 lines
There is surely some work to do, and that probably across all archs. But the sooner we should start.
dyngen-exec.his a constant source of pain when you try to introduce new headers or refactor existing ones.
Well dyngen-exec.h is long gone in my sources even though AREG0 is still used. I would have to backtrack my changes to see how I arrived to that, but for sure the first thing to do is to remove cpu_T from ARM target.
Laurent
Quoted 10 lines · Laurent Desnogues
Quoted 9 lines · Jan Kiszka
Quoted 8 lines · Laurent Desnogues
Quoted 4 lines · Jan Kiszka
Also, some discussion on this list suggested that it's more efficient to look into converting the remaining AREGS to TCG and finally do the ultimative "rm
dyngen-exec.h". Don't you want to spend some time on this already?This requires modifying ARM translator which is the last one to use AREGn with n>0. And don't all targets use AREG0 as a pointer to the CPU state?
Quoted 8 lines
Quoted 2 lines
Yes, but wasn't it you who suggested that all those users should be converted over to the
tcg_global_regAPI?Yes, and I did the work for ARM. However when considering the removal of AREG0, and after looking at generated code, I came to the perhaps premature conclusion that removing it would not bring me any speedup (at least for a not so register starved target as
x86_64).
I don't think we are looking for speedup here, just for cleanup. Status quo regarding performance after a conversion would be more than fine IMHO.
Quoted 9 lines
Quoted 4 lines
There is surely some work to do, and that probably across all archs. But the sooner we should start.
dyngen-exec.his a constant source of pain when you try to introduce new headers or refactor existing ones.Well
dyngen-exec.his long gone in my sources even though AREG0 is still used. I would have to backtrack my changes to see how I arrived to that, but for sure the first thing to do is to removecpu_Tfrom ARM target.
Yes, please share your wisdom!
Jan
Quoted 1 line · Jan Kiszka
Laurent Desnogues wrote:
[...]
Quoted 8 lines
Quoted 5 lines
Yes, and I did the work for ARM. However when considering the removal of AREG0, and after looking at generated code, I came to the perhaps premature conclusion that removing it would not bring me any speedup (at least for a not so register starved target as
x86_64).I don't think we are looking for speedup here, just for cleanup. Status quo regarding performance after a conversion would be more than fine IMHO.
I was ambiguous, I meant I expect slowdowns... But given how many times I was wrong in the past when I thought some tricks would speedup things, I should probably not trust my a priori.
Quoted 6 lines
Quoted 4 lines
Well
dyngen-exec.his long gone in my sources even though AREG0 is still used. I would have to backtrack my changes to see how I arrived to that, but for sure the first thing to do is to removecpu_Tfrom ARM target.Yes, please share your wisdom!
Sorry if I sounded arrogant, I just wanted to highlight the fact one can achieve your aim. As far as sharing goes, that's another story.
Laurent
Quoted 19 lines · Laurent Desnogues
Quoted 1 line · Jan Kiszka
Laurent Desnogues wrote:
[...]
Quoted 7 lines
Quoted 5 lines
Yes, and I did the work for ARM. However when considering the removal of AREG0, and after looking at generated code, I came to the perhaps premature conclusion that removing it would not bring me any speedup (at least for a not so register starved target as
x86_64).I don't think we are looking for speedup here, just for cleanup. Status quo regarding performance after a conversion would be more than fine IMHO.
I was ambiguous, I meant I expect slowdowns... But given how many times I was wrong in the past when I thought some tricks would speedup things, I should probably not trust my a priori.
Quoted 4 lines
Quoted 4 lines
Well
dyngen-exec.his long gone in my sources even though AREG0 is still used. I would have to backtrack my changes to see how I arrived to that, but for sure the first thing to do is to removecpu_Tfrom ARM target.
Quoted 5 lines
Quoted 1 line
Yes, please share your wisdom!
Sorry if I sounded arrogant, I just wanted to highlight the fact one can achieve your aim. As far as sharing goes, that's another story.
No, no, you didn't sound arrogant. I just forgot your boundary conditions.
But it's good to know that there might be a way to overcome dyngen-exec.h without dropping AREGs altogether in case performance requires this.
Jan
Quoted 3 lines · Blue Swirl
This patch cleans up
dyngen-exec.ha bit. It works for me with Linux and OpenBSD hosts, but I wonder if some other hosts will be broken. Please test.
I had to modify target-arm/exec.h and target-m68k/exec.h to include sys/types.h on DragonFly to make it compile. Otherwise it complained about uint32_t.
regards,
Signature · 1 line
Hasso Tepper
Quoted 6 lines · Blue Swirl
Hi,
This patch cleans up
dyngen-exec.ha bit. It works for me with Linux and OpenBSD hosts, but I wonder if some other hosts will be broken. Please test.
The windows build still works.
Regards,
Anthony Liguori