@@ -618,8 +618,7 @@ static NOINLINE int true_main(int argc, char *argv[])
618
618
static void lock_low32 (void )
619
619
{
620
620
#if defined(_OS_WINDOWS_ ) && defined(_P64 ) && defined(JL_DEBUG_BUILD )
621
- // Wine currently has a that causes it to answer VirtualQuery incorrectly.
622
- // block usage of the 32-bit address space on win64, to catch pointer cast errors
621
+ // Prevent usage of the 32-bit address space on Win64, to catch pointer cast errors.
623
622
char * const max32addr = (char * )0xffffffffL ;
624
623
SYSTEM_INFO info ;
625
624
MEMORY_BASIC_INFORMATION meminfo ;
@@ -643,11 +642,12 @@ static void lock_low32(void)
643
642
if ((char * )p != first )
644
643
// Wine and Windows10 seem to have issues with reporting memory access information correctly
645
644
// so we sometimes end up with unexpected results - this is just ignore those and continue
646
- // this is just a debugging aid to help find accidental pointer truncation anyways, so it's not critical
645
+ // this is just a debugging aid to help find accidental pointer truncation anyways,
646
+ // so it is not critical
647
647
VirtualFree (p , 0 , MEM_RELEASE );
648
648
}
649
649
}
650
- meminfo .BaseAddress += meminfo .RegionSize ;
650
+ meminfo .BaseAddress = ( void * )(( char * ) meminfo .BaseAddress + meminfo . RegionSize ) ;
651
651
}
652
652
#endif
653
653
return ;
@@ -656,16 +656,16 @@ static void lock_low32(void)
656
656
// Actual definition in `ast.c`
657
657
void jl_lisp_prompt (void );
658
658
659
- static void rr_detach_teleport (void ) {
660
659
#ifdef _OS_LINUX_
660
+ static void rr_detach_teleport (void ) {
661
661
#define RR_CALL_BASE 1000
662
662
#define SYS_rrcall_detach_teleport (RR_CALL_BASE + 9)
663
663
int err = syscall (SYS_rrcall_detach_teleport , 0 , 0 , 0 , 0 , 0 , 0 );
664
664
if (err < 0 || jl_running_under_rr (1 )) {
665
665
jl_error ("Failed to detach from rr session" );
666
666
}
667
- #endif
668
667
}
668
+ #endif
669
669
670
670
JL_DLLEXPORT int jl_repl_entrypoint (int argc , char * argv [])
671
671
{
@@ -682,16 +682,18 @@ JL_DLLEXPORT int jl_repl_entrypoint(int argc, char *argv[])
682
682
memmove (& argv [1 ], & argv [2 ], (argc - 2 )* sizeof (void * ));
683
683
argc -- ;
684
684
}
685
- char * * orig_argv = argv ;
686
- jl_parse_opts (& argc , (char * * * )& argv );
685
+ char * * new_argv = argv ;
686
+ jl_parse_opts (& argc , (char * * * )& new_argv );
687
687
688
688
// The parent process requested that we detach from the rr session.
689
689
// N.B.: In a perfect world, we would only do this for the portion of
690
690
// the execution where we actually need to exclude rr (e.g. because we're
691
691
// testing for the absence of a memory-model-dependent bug).
692
692
if (jl_options .rr_detach && jl_running_under_rr (0 )) {
693
+ #ifdef _OS_LINUX_
693
694
rr_detach_teleport ();
694
- execv ("/proc/self/exe" , orig_argv );
695
+ execv ("/proc/self/exe" , argv );
696
+ #endif
695
697
jl_error ("Failed to self-execute" );
696
698
}
697
699
@@ -701,7 +703,7 @@ JL_DLLEXPORT int jl_repl_entrypoint(int argc, char *argv[])
701
703
jl_lisp_prompt ();
702
704
return 0 ;
703
705
}
704
- int ret = true_main (argc , (char * * )argv );
706
+ int ret = true_main (argc , (char * * )new_argv );
705
707
jl_atexit_hook (ret );
706
708
return ret ;
707
709
}
0 commit comments