Changeset 14608
- Timestamp:
- Jan 29, 2011, 6:38:14 PM (14 years ago)
- Location:
- trunk/source
- Files:
-
- 2 edited
-
lib/dumplisp.lisp (modified) (4 diffs)
-
lisp-kernel/mach-o-image.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/lib/dumplisp.lisp
r13225 r14608 75 75 (mode #o644) 76 76 prepend-kernel 77 #+windows-target (application-type :console)) 77 #+windows-target (application-type :console) 78 native) 78 79 (declare (ignore toplevel-function error-handler application-class 79 80 clear-clos-caches init-file impurify)) … … 89 90 (cerror "Un-watch them." "There are watched objects.") 90 91 (mapc #'unwatch watched))) 92 (when (and native prepend-kernel) 93 (error "~S and ~S can't both be specified (yet)." :native :prepend-kernel)) 91 94 (let* ((ip *initial-process*) 92 95 (cp *current-process*)) … … 97 100 #+windows-target #+windows-target 98 101 :application-type application-type))) 102 (when native 103 #+(or darwinx8632-target darwin-x8664-target) (setq fd (- fd)) 104 #-(or darwinx8632-target darwin-x8664-target) 105 (progn 106 (warn "native image support not available, ignoring ~s option." :native))) 107 99 108 (process-interrupt ip 100 109 #'(lambda () … … 119 128 (clear-clos-caches t) 120 129 prepend-kernel 121 #+windows-target application-type) 122 (declare (ignore mode prepend-kernel #+windows-target application-type)) 130 #+windows-target application-type 131 native) 132 (declare (ignore mode prepend-kernel #+windows-target application-type native)) 123 133 (when (and application-class (neq (class-of *application*) 124 134 (if (symbolp application-class) -
trunk/source/lisp-kernel/mach-o-image.c
r14605 r14608 27 27 #include "lisp.h" 28 28 #include "gc.h" 29 #include "lisp_globals.h" 29 30 30 31 #if WORD_SIZE==64 … … 483 484 484 485 seg = add_macho_segment(p, 485 " __TEXT",486 "READONLY", 486 487 (natural)(readonly_area->low-4096), 487 488 4096+align_to_power_of_2(readonly_area->active-readonly_area->low,12), … … 491 492 VM_PROT_READ|VM_PROT_EXECUTE, 492 493 1, 493 " text");494 "purespace"); 494 495 init_macho_section(seg, 495 496 0, … … 505 506 506 507 if (managed_static_area->active != managed_static_area->low) { 507 nrefbytes = (( (area_dnode(managed_static_area->active,managed_static_area->low)>>dnode_shift)+7)>>3);508 nrefbytes = ((area_dnode(managed_static_area->active,managed_static_area->low)+7)>>3); 508 509 509 510 prepare_to_write_dynamic_space(managed_static_area); … … 698 699 load_native_library(char *path) 699 700 { 701 extern BytePtr allocate_from_reserved_area(natural); 700 702 void *lib; 701 703 LispObj image_nil = 0; … … 749 751 } else { 750 752 area *a; 751 char *p, *q; 752 753 p = (BytePtr)dlsym(lib,"DYNAMIC_HEAP_END"); 754 if (p == NULL) { 753 natural initsize,totalsize,nrefbytes; 754 char 755 *ro_start = dlsym(lib,"READONLY_START"), 756 *ro_end = dlsym(lib,"READONLY_END"), 757 *ms_start = dlsym(lib,"MANAGED_STATIC_START"), 758 *ms_end = dlsym(lib,"MANAGED_STATIC_END"), 759 *msr_end = dlsym(lib,"MANAGED_STATIC_REFMAP_END"), 760 *sc_start = dlsym(lib,"STATIC_CONS_START"), 761 *sc_end = dlsym(lib,"STATIC_CONS_START"), 762 *dh_end = dlsym(lib,"DYNAMIC_HEAP_END"), 763 *p, 764 *q; 765 766 if ((dh_end == NULL) || 767 (ro_start != pure_space_active)) { 755 768 dlclose(lib); 756 769 return 0; 757 770 } 758 p = (BytePtr)align_to_power_of_2( p,12);771 p = (BytePtr)align_to_power_of_2(dh_end,12); 759 772 q = static_space_active; 760 773 mprotect(q,8192,PROT_READ|PROT_WRITE|PROT_EXEC); 761 774 memcpy(q,p,8192); 775 memset(p,0,8192); 762 776 763 777 a = nilreg_area = new_area(q,q+8192,AREA_STATIC); … … 781 795 #endif 782 796 set_nil(image_nil); 783 784 785 786 797 add_area_holding_area_lock(a); 787 798 799 a = new_area(pure_space_active,pure_space_limit,AREA_READONLY); 800 readonly_area = a; 801 add_area_holding_area_lock(a); 802 pure_space_active = a->active = ro_end; 788 803 789 if ((BytePtr)dlsym(lib,"READONLY_START") == pure_space_active) { 790 a = new_area(pure_space_active,pure_space_limit,AREA_READONLY); 791 readonly_area = a; 792 add_area_holding_area_lock(a); 793 pure_space_active = a->active = (BytePtr)dlsym(lib,"READONLY_END"); 794 795 796 797 798 } 799 } 800 } 804 initsize = dh_end - sc_end; 805 totalsize = align_to_power_of_2(initsize, log2_heap_segment_size); 806 807 p = allocate_from_reserved_area(totalsize); 808 q = p+totalsize; 809 a = new_area(p,q,AREA_DYNAMIC); 810 a->active = dh_end; 811 a->h = p; 812 CommitMemory((char *)(align_to_power_of_2(dh_end,12)), 813 q-(char *)align_to_power_of_2(dh_end,12)); 814 map_initial_reloctab(p, q); 815 map_initial_markbits(p, q); 816 lisp_global(HEAP_START) = (LispObj)p; 817 lisp_global(HEAP_END) = (LispObj)q; 818 add_area_holding_area_lock(a); 819 resize_dynamic_heap(dh_end, lisp_heap_gc_threshold); 820 xMakeDataExecutable(a->low, a->active - a->low); 821 822 static_cons_area = new_area(sc_start, sc_end, AREA_STATIC_CONS); 823 static_cons_area->active = sc_start; 824 lower_heap_start(sc_start,a); 825 a->static_dnodes = area_dnode(sc_end,sc_start); 826 827 managed_static_area = new_area(ms_start,ms_end,AREA_MANAGED_STATIC); 828 managed_static_area->active = ms_end; 829 lisp_global(REF_BASE) = (LispObj) ms_start; 830 831 nrefbytes = msr_end - ms_end; 832 CommitMemory(global_mark_ref_bits,align_to_power_of_2(nrefbytes, 12)); 833 memcpy(global_mark_ref_bits,ms_end,nrefbytes); 834 memset(ms_end,0,nrefbytes); 835 836 return image_nil; 837 } 838 }
Note:
See TracChangeset
for help on using the changeset viewer.
