1: #include "../h/config.h" 2: /* 3: * gcollect(n) - switch to expression stack for &main and call collect(n), 4: * switch back to current expression stack when done. 5: */ 6: Global(_collect) /* Garbage collection */ 7: Global(_boundary) /* Icon/C boundary */ 8: Global(_current) /* Current co-expression */ 9: Global(_k_main) /* Main co-expression */ 10: 11: Global(_gcollect) 12: #ifdef VAX 13: _gcollect: 14: Mask 0x0 # Don't need to save any registers 15: 16: movl _current+4,r0 # Get pointer to heap block for 17: # current co-expression. 18: movl sp,16(r0) # Save sp, 19: movl ap,20(r0) # ap, 20: movl _boundary,24(r0) # and current boundary in block. 21: movl _k_main+4,r0 # Get pointer to heap block for 22: # &main. 23: movl 16(r0),sp # Restore sp, 24: movl 20(r0),ap # ap, 25: movl 24(r0),_boundary # and boundary for &main 26: pushl 4(ap) # Push n on stack 27: calls $1,_collect # collect(n) 28: movl _current+4,r0 # Get pointer to heap block for 29: # current co-expression 30: movl 16(r0),sp # Restore sp, 31: movl 20(r0),ap # ap, 32: movl 24(r0),_boundary # and boundary 33: ret # Return from garbage collection 34: #endif VAX 35: 36: #ifdef PORT 37: DummyFcn(_gcollect) 38: #endif PORT 39: 40: #ifdef PDP11 41: / gcollect(n) - switch to expression stack for &main and call collect(n), 42: / switch to current expression stack when done. 43: 44: / Register Usage: 45: / r0-r1 general utility 46: _gcollect: 47: mov _current+2,r0 / r0 <- pointer to current stack header 48: mov sp,8.(r0) / save current stack pointer 49: mov _boundary,12.(r0) / save current boundary 50: mov sp,r1 / r1 <- saved stack pointer 51: mov _k_main+2,r0 / r0 <- pointer to main stack header 52: mov 8.(r0),sp / get stack pointer for &main 53: mov 12.(r0),_boundary / get boundary for &main 54: mov 2(r1),-(sp) / move n to this stack 55: jsr pc,_collect / call collect(n) 56: tst (sp)+ / pop n off of this stack 57: mov _current+2,r0 / r0 <- pointer to current stack header 58: mov 8.(r0),sp / restore current stack pointer 59: mov 12.(r0),_boundary / restore current boundary 60: rts pc / return 61: #endif PDP11