ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/uae_cpu/compiler/compemu_support.cpp
(Generate patch)

Comparing BasiliskII/src/uae_cpu/compiler/compemu_support.cpp (file contents):
Revision 1.1 by gbeauche, 2002-09-17T16:04:06Z vs.
Revision 1.4 by gbeauche, 2002-09-18T11:41:56Z

# Line 2 | Line 2
2   #error "Only Real or Direct Addressing is supported with the JIT Compiler"
3   #endif
4  
5 + #if X86_ASSEMBLY && !SAHF_SETO_PROFITABLE
6 + #error "Only [LS]AHF scheme to [gs]et flags is supported with the JIT Compiler"
7 + #endif
8 +
9   #define USE_MATCH 0
10  
11   /* kludge for Brian, so he can compile under MSVC++ */
# Line 21 | Line 25
25   #include "main.h"
26   #include "prefs.h"
27   #include "user_strings.h"
28 + #include "vm_alloc.h"
29  
30   #include "m68k.h"
31   #include "memory.h"
# Line 78 | Line 83 | const bool             JITDebug                        = false;        // Don't
83  
84   const uae_u32   MIN_CACHE_SIZE          = 2048;         // Minimal translation cache size (2048 KB)
85   static uae_u32  cache_size                      = 0;            // Size of total cache allocated for compiled blocks
86 < static uae_u32  current_cache_size      = 0;            // Cache grows upwards: how much has been consumed yet
86 > static uae_u32  current_cache_size      = 0;            // Cache grows upwards: how much has been consumed already
87   static bool             lazy_flush                      = true;         // Flag: lazy translation cache invalidation
88   static bool             avoid_fpu                       = true;         // Flag: compile FPU instructions ?
89   static bool             have_cmov                       = false;        // target has CMOV instructions ?
# Line 4588 | Line 4593 | void compiler_exit(void)
4593          
4594          // Deallocate translation cache
4595          if (compiled_code) {
4596 < #ifndef WIN32
4592 <                munmap((caddr_t)compiled_code, cache_size);
4593 < #else
4594 <                free(compiled_code);
4595 < #endif
4596 >                vm_release(compiled_code, cache_size * 1024);
4597                  compiled_code = 0;
4598          }
4599          
# Line 5144 | Line 5145 | void alloc_cache(void)
5145   {
5146          if (compiled_code) {
5147                  flush_icache_hard(6);
5148 < #ifndef WIN32
5148 <                munmap((caddr_t)compiled_code, cache_size*1024);
5149 < #else
5150 <                free(compiled_code);
5151 < #endif
5148 >                vm_release(compiled_code, cache_size * 1024);
5149                  compiled_code = 0;
5150          }
5151          
# Line 5156 | Line 5153 | void alloc_cache(void)
5153                  return;
5154          
5155          while (!compiled_code && cache_size) {
5156 < #ifndef WIN32
5160 <                compiled_code = (uae_u8 *)mmap(0, cache_size * 1024,
5161 <                        PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, zero_fd, 0);
5162 <                if (compiled_code == (uae_u8 *)MAP_FAILED) {
5163 < #else
5164 <                compiled_code = (uae_u8 *)malloc(cache_size * 1024);
5165 <                if (compiled_code == 0) {
5166 < #endif
5156 >                if ((compiled_code = (uae_u8 *)vm_acquire(cache_size * 1024)) == VM_MAP_FAILED) {
5157                          compiled_code = 0;
5158                          cache_size /= 2;
5159                  }
5160          }
5161 +        vm_protect(compiled_code, cache_size, VM_PAGE_READ | VM_PAGE_WRITE | VM_PAGE_EXECUTE);
5162          
5163          if (compiled_code) {
5164                  write_log("<JIT compiler> : actual translation cache size : %d KB at 0x%08X\n", cache_size, compiled_code);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines