From 57b73dd16e5c5f155bf9c548679d8aefefc4f72b Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Mon, 6 Apr 2015 20:27:02 +0300 Subject: [PATCH] Remove commented out code in AmigaOS.c, gcconfig.h and os_dep.c * doc/README.amiga: Remove note about "#if 0'ed" code. * extra/AmigaOS.c: Remove "#if 0'ed" code. * include/private/gcconfig.h: Likewise. * os_dep.c: Likewise. --- doc/README.amiga | 5 +- extra/AmigaOS.c | 75 +---------------------------- include/private/gcconfig.h | 9 ---- os_dep.c | 116 --------------------------------------------- 4 files changed, 2 insertions(+), 203 deletions(-) diff --git a/doc/README.amiga b/doc/README.amiga index bf18d3f..d4b825a 100644 --- a/doc/README.amiga +++ b/doc/README.amiga @@ -117,10 +117,7 @@ STILL MISSING: Programs can not be started from workbench, at least not for SAS/C. (Martin Tauchmanns note about that it now works with workbench is definitely wrong -when concerning SAS/C). I guess it works if you use the old "#if 0'ed"-code, -but I haven't tested it. I think the reason for MT to replace the -"#if 0'ed"-code was only because it was a bit to SAS/C-specific. But I -don't know. An iconx-script solves this problem anyway. +when concerning SAS/C). An iconx-script solves this problem. BEWARE! diff --git a/extra/AmigaOS.c b/extra/AmigaOS.c index 8f99b74..366ef94 100644 --- a/extra/AmigaOS.c +++ b/extra/AmigaOS.c @@ -57,34 +57,6 @@ ptr_t GC_get_main_stack_base() } } -#if 0 /* old version */ -ptr_t GC_get_stack_base() -{ - extern struct WBStartup *_WBenchMsg; - extern long __base; - extern long __stack; - struct Task *task; - struct Process *proc; - struct CommandLineInterface *cli; - long size; - - if ((task = FindTask(0)) == 0) { - GC_err_puts("Cannot find own task structure\n"); - ABORT("task missing"); - } - proc = (struct Process *)task; - cli = BADDR(proc->pr_CLI); - - if (_WBenchMsg != 0 || cli == 0) { - size = (char *)task->tc_SPUpper - (char *)task->tc_SPLower; - } else { - size = cli->cli_DefaultStack * 4; - } - return (ptr_t)(__base + GC_max(size, __stack)); -} -#endif - - #endif @@ -156,52 +128,7 @@ ptr_t GC_get_stack_base() ABORT("Can`t find correct Segments.\nSolution: Use an newer version of ixemul.library"); } # endif - } - -#if 0 /* old version */ - void GC_register_data_segments() - { - extern struct WBStartup *_WBenchMsg; - struct Process *proc; - struct CommandLineInterface *cli; - BPTR myseglist; - ULONG *data; - - if ( _WBenchMsg != 0 ) { - if ((myseglist = _WBenchMsg->sm_Segment) == 0) { - GC_err_puts("No seglist from workbench\n"); - return; - } - } else { - if ((proc = (struct Process *)FindTask(0)) == 0) { - GC_err_puts("Cannot find process structure\n"); - return; - } - if ((cli = BADDR(proc->pr_CLI)) == 0) { - GC_err_puts("No CLI\n"); - return; - } - if ((myseglist = cli->cli_Module) == 0) { - GC_err_puts("No seglist from CLI\n"); - return; - } - } - - for (data = (ULONG *)BADDR(myseglist); data != 0; - data = (ULONG *)BADDR(data[0])) { -# ifdef AMIGA_SKIP_SEG - if (((ULONG) GC_register_data_segments < (ULONG) &data[1]) || - ((ULONG) GC_register_data_segments > (ULONG) &data[1] + data[-1])) { -# else - { -# endif /* AMIGA_SKIP_SEG */ - GC_add_roots_inner((char *)&data[1], - ((char *)&data[1]) + data[-1], FALSE); - } - } - } -#endif /* old version */ - + } #endif diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index e5df5c0..9dfcc06 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -1306,15 +1306,6 @@ # ifdef LINUX # define OS_TYPE "LINUX" # define LINUX_STACKBOTTOM -# if 0 -# define HEURISTIC1 -# undef STACK_GRAN -# define STACK_GRAN 0x10000000 - /* STACKBOTTOM is usually 0xc0000000, but this changes with */ - /* different kernel configurations. In particular, systems */ - /* with 2GB physical memory will usually move the user */ - /* address space limit, and hence initial SP to 0x80000000. */ -# endif # if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC) # define MPROTECT_VDB # else diff --git a/os_dep.c b/os_dep.c index a1bafbd..8cd240c 100644 --- a/os_dep.c +++ b/os_dep.c @@ -3451,127 +3451,11 @@ GC_INNER GC_bool GC_page_was_dirty(struct hblk *h) * can be called from within GC_call_with_alloc_lock, and the cord * package does so. On systems that allow nested lock acquisition, this * happens to work. - * On other systems, SET_LOCK_HOLDER and friends must be suitably defined. */ -#if 0 -static GC_bool syscall_acquired_lock = FALSE; /* Protected by GC lock. */ - -void GC_begin_syscall(void) -{ - /* FIXME: Resurrecting this code would require fixing the */ - /* test, which can spuriously return TRUE. */ - if (!I_HOLD_LOCK()) { - LOCK(); - syscall_acquired_lock = TRUE; - } -} - -void GC_end_syscall(void) -{ - if (syscall_acquired_lock) { - syscall_acquired_lock = FALSE; - UNLOCK(); - } -} - -void GC_unprotect_range(ptr_t addr, word len) -{ - struct hblk * start_block; - struct hblk * end_block; - register struct hblk *h; - ptr_t obj_start; - - if (!GC_dirty_maintained) return; - obj_start = GC_base(addr); - if (obj_start == 0) return; - if (GC_base(addr + len - 1) != obj_start) { - ABORT("GC_unprotect_range(range bigger than object)"); - } - start_block = (struct hblk *)((word)addr & ~(GC_page_size - 1)); - end_block = (struct hblk *)((word)(addr + len - 1) & ~(GC_page_size - 1)); - end_block += GC_page_size/HBLKSIZE - 1; - for (h = start_block; (word)h <= (word)end_block; h++) { - register word index = PHT_HASH(h); - - async_set_pht_entry_from_index(GC_dirty_pages, index); - } - UNPROTECT(start_block, - ((ptr_t)end_block - (ptr_t)start_block) + HBLKSIZE); -} - - /* We no longer wrap read by default, since that was causing too many */ /* problems. It is preferred that the client instead avoids writing */ /* to the write-protected heap with a system call. */ -/* This still serves as sample code if you do want to wrap system calls.*/ - -#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(GC_USE_LD_WRAP) -/* Replacement for UNIX system call. */ -/* Other calls that write to the heap should be handled similarly. */ -/* Note that this doesn't work well for blocking reads: It will hold */ -/* the allocation lock for the entire duration of the call. */ -/* Multi-threaded clients should really ensure that it won't block, */ -/* either by setting the descriptor non-blocking, or by calling select */ -/* or poll first, to make sure that input is available. */ -/* Another, preferred alternative is to ensure that system calls never */ -/* write to the protected heap (see above). */ -# include -# include -ssize_t read(int fd, void *buf, size_t nbyte) -{ - int result; - - GC_begin_syscall(); - GC_unprotect_range(buf, (word)nbyte); -# if defined(IRIX5) || defined(GC_LINUX_THREADS) - /* Indirect system call may not always be easily available. */ - /* We could call _read, but that would interfere with the */ - /* libpthread interception of read. */ - /* On Linux, we have to be careful with the linuxthreads */ - /* read interception. */ - { - struct iovec iov; - - iov.iov_base = buf; - iov.iov_len = nbyte; - result = readv(fd, &iov, 1); - } -# else -# if defined(HURD) - result = __read(fd, buf, nbyte); -# else - /* The two zero args at the end of this list are because one - IA-64 syscall() implementation actually requires six args - to be passed, even though they aren't always used. */ - result = syscall(SYS_read, fd, buf, nbyte, 0, 0); -# endif /* !HURD */ -# endif - GC_end_syscall(); - return(result); -} -#endif /* !MSWIN32 && !MSWINCE && !GC_LINUX_THREADS */ - -#if defined(GC_USE_LD_WRAP) && !defined(THREADS) - /* We use the GNU ld call wrapping facility. */ - /* I'm not sure that this actually wraps whatever version of read */ - /* is called by stdio. That code also mentions __read. */ -# include - ssize_t __wrap_read(int fd, void *buf, size_t nbyte) - { - int result; - - GC_begin_syscall(); - GC_unprotect_range(buf, (word)nbyte); - result = __real_read(fd, buf, nbyte); - GC_end_syscall(); - return(result); - } - - /* We should probably also do this for __read, or whatever stdio */ - /* actually calls. */ -#endif -#endif /* 0 */ # ifdef CHECKSUMS GC_INNER GC_bool GC_page_was_ever_dirty(struct hblk * h GC_ATTR_UNUSED) -- 2.7.4