URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [boehm-gc/] [doc/] [README.amiga] - Rev 721
Compare with Previous | Blame | View Log
===========================================================================Kjetil S. Matheussen's notes (28-11-2000)===========================================================================Compiles under SAS/C again. Should allso still compile under otheramiga compilers without big changes. I haven't checked if it stillworks under gcc, because I don't have gcc for amiga. But I haveupdated 'Makefile', and hope it compiles fine.WHATS NEW:1.Made a pretty big effort in preventing GCs allocating-functions from returningchip-mem.The lower part of the new file AmigaOS.c does this in various ways, mainly bywrapping GC_malloc, GC_malloc_atomic, GC_malloc_uncollectable,GC_malloc_atomic_uncollectable, GC_malloc_stubborn, GC_malloc_ignore_off_pageand GC_malloc_atomic_ignore_off_page. GC_realloc is allso wrapped, butdoesn't do the same effort in preventing to return chip-mem.Other allocating-functions (f.ex. GC_*_typed_) can probably beused without any problems, but beware that the warn hook will not be called.In case of problems, don't define GC_AMIGA_FASTALLOC.Programs using more time actually using the memory allocated(instead of just allocate and free rapidly) havethe most to earn on this, but even gctest now normally runs twiceas fast and uses less memory, on my poor 8MB machine.The changes have only effect when there is no morefast-mem left. But with the way GC works, itcould happen quite often. Beware that an atexit handler had to be added,so using the abort() function will make a big memory-loss.If you absolutely must call abort() instead of exit(), try callingthe GC_amiga_free_all_mem function before abort().New amiga-spesific compilation flags:GC_AMIGA_FASTALLOC - By NOT defining this option, GC will work like before,it will not try to force fast-mem out of the OS, andit will use normal calloc for allocation, and the restof the following flags will have no effect.GC_AMIGA_ONLYFAST - Makes GC never to return chip-mem. GC_AMIGA_RETRY haveno effect if this flag is set.GC_AMIGA_GC - If gc returns NULL, do a GC_gcollect, and try again. Thisusually is a success with the standard GC configuration.It is allso the most important flag to set to preventGC from returning chip-mem. Beware that it slows down a lotwhen a program is rapidly allocating/deallocating whentheres either very little fast-memory left or verly littlechip-memory left. Its not a very common situation, but gctestsometimes (very rare) use many minutes because of this.GC_AMIGA_RETRY - If gc succeed allocating memory, but it is chip-mem,try again and see if it is fast-mem. Most of the time,it will actually return fast-mem for the second try.I have set max number of retries to 9 or size/5000. Youcan change this if you like. (see GC_amiga_rec_alloc())GC_AMIGA_PRINTSTATS - Gather some statistics during the execution of aprogram, and prints out the info when the atexit-handleris called.My reccomendation is to set all this flags, except GC_AMIGA_PRINTSTATS andGC_AMIGA_ONLYFAST.If your program demands high response-time, you shouldnot define GC_AMIGA_GC, and possible allso define GC_AMIGA_ONLYFAST.GC_AMIGA_RETRY does not seem to slow down much.Allso, when compiling up programs, and GC_AMIGA_FASTALLOC was not defined whencompilling gc, you can define GC_AMIGA_MAKINGLIB to avoid having these allocation-functions wrapped. (see gc.h)Note that GC_realloc must not be called before any ofthe other above mentioned allocating-functions have been called. (shouldn't beany programs doing so either, I hope).Another note. The allocation-function is wrapped when definingGC_AMIGA_FASTALLOC by letting the function go thru the newGC_amiga_allocwrapper_do function-pointer (see gc.h). Means thatsending function-pointers, such as GC_malloc, GC_malloc_atomic, etc.,for later to be called like f.ex this, (*GC_malloc_functionpointer)(size),will not wrap the function. This is normally not a big problem, unlessall allocation function is called like this, which will cause theatexit un-allocating function never to be called. Then you eitherhave to manually add the atexit handler, or call the allocation-functions function-pointer functions like this;(*GC_amiga_allocwrapper_do)(size,GC_malloc_functionpointer).There are probably better ways this problem could be handled, unfortunately,I didn't find any without rewriting or replacing a lot of the GC-code, whichI really didn't want to. (Making new GC_malloc_* functions, and justdefine f.ex GC_malloc as GC_amiga_malloc should allso work).New amiga-spesific function:void GC_amiga_set_toany(void (*func)(void));'func' is a function that will be called right before gc has to changeallocation-method from MEMF_FAST to MEMF_ANY. Ie. when it is likelyit will return chip-mem.2. A few small compiler-spesific additions to make it compile with SAS/C again.3. Updated and rewritten the smakefile, so that it works again and thatthe "unnecesarry" 'SCOPTIONS' files could be removed. Allso includedthe cord-smakefile stuff in the main smakefile, so that the cord smakefilecould be removed too. By writing smake -f Smakefile.smk, both gc.lib andcord.lib will be made.STILL MISSING:Programs can not be started from workbench, at least not for SAS/C. (MartinTauchmanns note about that it now works with workbench is definitely wrongwhen 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-spesific. But Idon't know. An iconx-script solves this problem anyway.BEWARE!-To run gctest, set the stack to around 200000 bytes first.-SAS/C-spesific: cord will crash if you compile gc.lib witheither parm=reg or parm=both. (missing legal prototypes forfunction-pointers someplace is the reason I guess.).tested with software: Radium, http://www.stud.ifi.uio.no/~ksvalast/radium/tested with hardware: MC68060-ksvalast@ifi.uio.no===========================================================================Martin Tauchmann's notes (1-Apr-99)===========================================================================Works now, also with the GNU-C compiler V2.7.2.1. <ftp://ftp.unina.it/pub/amiga/geekgadgets/amiga/m68k/snapshots/971125/amiga-bin/>Modify the `Makefile`CC=cc $(ABI_FLAG)toCC=gcc $(ABI_FLAG)TECHNICAL NOTES- `GC_get_stack_base()`, `GC_register_data_segments()` works now with everyC compiler; also Workbench.- Removed AMIGA_SKIP_SEG, but the Code-Segment must not be scanned by GC.PROBLEMS- When the Linker, does`t merge all Code-Segments to an single one. LD of GCCdo it always.- With ixemul.library V47.3, when an GC program launched from another program(example: `Make` or `if_mach M68K AMIGA gctest`), `GC_register_data_segments()`found the Segment-List of the caller program.Can be fixed, if the run-time initialization code (for C programs, usually *crt0*)support `__data` and `__bss`.- PowerPC Amiga currently not supported.- Dynamic libraries (dyn_load.c) not supported.TESTED WITH SOFTWARE`Optimized Oberon 2 C` (oo2c) <http://cognac.informatik.uni-kl.de/download/index.html>TESTED WITH HARDWAREMC68030CONTACTPlease, contact me at <martintauchmann@bigfoot.com>, when you change theAmiga port. <http://martintauchmann.home.pages.de>===========================================================================Michel Schinz's notes===========================================================================WHO DID WHATThe original Amiga port was made by Jesper Peterson. I (Michel Schinz)modified it slightly to reflect the changes made in the new officialdistributions, and to take advantage of the new SAS/C 6.x features. I alsocreated a makefile to compile the "cord" package (see the cordsubdirectory).TECHNICAL NOTESIn addition to Jesper's notes, I have the following to say:- Starting with version 4.3, gctest checks to see if the code segment isadded to the root set or not, and complains if it is. Previous versionsof this Amiga port added the code segment to the root set, so I tried tofix that. The only problem is that, as far as I know, it is impossible toknow which segments are code segments and which are data segments (thereare indeed solutions to this problem, like scanning the program on diskor patch the LoadSeg functions, but they are rather complicated). Thesolution I have chosen (see os_dep.c) is to test whether the programcounter is in the segment we are about to add to the root set, and if itis, to skip the segment. The problems are that this solution is ratherawkward and that it works only for one code segment. This means that ifyour program has more than one code segment, all of them but one will beadded to the root set. This isn't a big problem in fact, since thecollector will continue to work correctly, but it may be slower.Anyway, the code which decides whether to skip a segment or not can beremoved simply by not defining AMIGA_SKIP_SEG. But notice that if you doso, gctest will complain (it will say that "GC_is_visible produced wrongfailure indication"). However, it may be useful if you happen to havepointers stored in a code segment (you really shouldn't).If anyone has a good solution to the problem of finding, when a programis loaded in memory, whether a segment is a code or a data segment,please let me know.PROBLEMSIf you have any problem with this version, please contact me atschinz@alphanet.ch (but do *not* send long files, since we pay forevery mail!).===========================================================================Jesper Peterson's notes===========================================================================ADDITIONAL NOTES FOR AMIGA PORTThese notes assume some familiarity with Amiga internals.WHY I PORTED TO THE AMIGAThe sole reason why I made this port was as a first step in gettingthe Sather(*) language on the Amiga. A port of this language willbe done as soon as the Sather 1.0 sources are made available to me.Given this motivation, the garbage collection (GC) port is ratherminimal.(*) For information on Sather read the comp.lang.sather newsgroup.LIMITATIONSThis port assumes that the startup code linked with target programsis that supplied with SAS/C versions 6.0 or later. This allowsassumptions to be made about where to find the stack base pointerand data segments when programs are run from WorkBench, as opposedto running from the CLI. The compiler dependent code is all in theGC_get_stack_base() and GC_register_data_segments() functions, butmay spread as I add Amiga specific features.Given that SAS/C was assumed, the port is set up to be built with"smake" using the "SMakefile". Compiler options in "SCoptions" canbe set with "scopts" program. Both "smake" and "scopts" are part ofthe SAS/C commercial development system.In keeping with the porting philosophy outlined above, this portwill not behave well with Amiga specific code. Especially not inter-process comms via messages, and setting up public structures likeIntuition objects or anything else in the system lists. For thetime being the use of this library is limited to single threadedANSI/POSIX compliant or near-complient code. (ie. Stick to stdiofor now). Given this limitation there is currently no mechanism forallocating "CHIP" or "PUBLIC" memory under the garbage collector.I'll add this after giving it considerable thought. The majorproblem is the entire physical address space may have to me scanned,since there is no telling who we may have passed memory to.If you allocate your own stack in client code, you will have toassign the pointer plus stack size to GC_stackbottom.The initial stack size of the target program can be compiled in bysetting the __stack symbol (see SAS documentaion). It can be over-ridden from the CLI by running the AmigaDOS "stack" program, or fromthe WorkBench by setting the stack size in the tool types window.SAS/C COMPILER OPTIONS (SCoptions)You may wish to check the "CPU" code option is appropriate for yourintended target system.Under no circumstances set the "StackExtend" code option in eithercompiling the library or *ANY* client code.All benign compiler warnings have been suppressed. These mainlyinvolve lack of prototypes in the code, and dead assignmentsdetected by the optimizer.THE GOOD NEWSThe library as it stands is compatible with the GigaMem commercialvirtual memory software, and probably similar PD software.The performance of "gctest" on an Amiga 2630 (68030 @ 25Mhz)compares favourably with an HP9000 with similar architecture (a 325with a 68030 I think).-----------------------------------------------------------------------The Amiga port has been brought to you by:Jesper Peterson.jep@mtiame.mtia.oz.au (preferred, but 1 week turnaround)jep@orca1.vic.design.telecom.au (that's orca<one>, 1 day turnaround)At least one of these addresses should be around for a while, eventhough I don't work for either of the companies involved.
