source: release/1.9/source/lisp-kernel/m4macros.m4 @ 16083

Last change on this file since 16083 was 15370, checked in by gb, 7 years ago

Define assembly lisp-globals in lisp_globals.s, not in *constants.s
Provide _rnode and support, so that the lisp_globals structure can
have its elements defined in predecremented descending order.
Make managed_static_dnodes/_refbits new globals so that they can
be used on all platforms (even though the managed_static_area is only
used on x86 at the moment.
When disabling the EGC, set lisp_global(OLDSPACE_DNODE_COUNT) to 0
(not effectively to lisp_global(MANAGED_STATIC_DNODES), since the
new write barrier code doesn't overload a single set of refbits.

Hopefully, that's it for these changes.
(We'll see if the code even compiles on other platforms.)

-

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.1 KB
Line 
1changecom(`/*',`*/')
2
3
4
5/*   Copyright (C) 1994-2001 Digitool, Inc  */
6/*   Copyright (c) 2009 Clozure Associates */
7/*   This file is part of Clozure CL.    */
8
9/*   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public  */
10/*   License , known as the LLGPL and distributed with Clozure CL as the  */
11/*   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,  */
12/*   which is distributed with Clozure CL as the file "LGPL".  Where these  */
13/*   conflict, the preamble takes precedence.    */
14
15/*   Clozure CL is referenced in the preamble as the "LIBRARY."  */
16
17/*   The LLGPL is also available online at  */
18/*   http://opensource.franz.com/preamble.html  */
19
20
21
22/*  BSD debugging information (line numbers, etc) is a little different  */
23/*  from ELF/SVr4 debugging information.  There are probably lots more  */
24/*  differences, but this helps us to distinguish between what LinuxPPC  */
25/*  (ELF/SVr4) wants and what Darwin(BSD) wants.  */
26
27
28define(`BSDstabs',`1')
29define(`ELFstabs',`2')
30define(`COFFstabs',`3')
31undefine(`EABI')
32undefine(`POWEROPENABI')
33undefine(`rTOC')
34
35
36ifdef(`DARWIN',`define(`SYSstabs',`BSDstabs')
37                define(`DarwinAssembler',`')
38                define(`CNamesNeedUnderscores',`')
39                define(`LocalLabelPrefix',`L')
40                define(`MacroLabelPrefix',`L__')
41                define(`StartTextLabel',`Ltext0')
42                define(`EndTextLabel',`Letext')
43                ifdef(`PPC',`
44                define(`POWEROPENABI',`')')
45                ifdef(`X86',`
46                define(`SYSCALL_SETS_CARRY_ON_ERROR',`')
47                define(`SSE2_MATH_LIB',`')')
48')
49
50ifdef(`LINUX',`define(`SYSstabs',`ELFstabs')
51               define(`HaveWeakSymbols',`')
52               define(`LocalLabelPrefix',`.L')
53               define(`MacroLabelPrefix',`.L__')
54               define(`StartTextLabel',`.Ltext0')
55               define(`EndTextLabel',`.Letext')
56               ifdef(`PPC64',`
57               define(`POWEROPENABI',`')
58               define(`rTOC',`r2')', `
59               define(`EABI',`')')')
60
61ifdef(`FREEBSD',`define(`SYSstabs',`ELFstabs')
62               define(`HaveWeakSymbols',`')
63               define(`LocalLabelPrefix',`.L')
64               define(`MacroLabelPrefix',`.L__')
65               define(`StartTextLabel',`.Ltext0')
66               define(`EndTextLabel',`.Letext')'
67                ifdef(`X86',`
68                define(`SYSCALL_SETS_CARRY_ON_ERROR',`')')
69)
70
71ifdef(`SOLARIS',`define(`SYSstabs',`ELFstabs')
72               define(`HaveWeakSymbols',`')
73               define(`LocalLabelPrefix',`.L')
74               define(`MacroLabelPrefix',`.L__')
75               define(`StartTextLabel',`.Ltext0')
76               define(`EndTextLabel',`.Letext')')
77
78ifdef(`WINDOWS',`define(`SYSstabs',`COFFstabs')
79        ifdef(`WIN_32',`define(`CNamesNeedUnderscores',`')')
80               define(`LocalLabelPrefix',`L')
81               define(`MacroLabelPrefix',`L__')
82               define(`StartTextLabel',`Ltext0')
83               define(`EndTextLabel',`Letext')')
84
85
86/*  Names exported to (or imported from) C may need leading underscores.  */
87/*  Still.  After all these years.  Why ?  */
88
89define(`C',`ifdef(`CNamesNeedUnderscores',``_'$1',`$1')')
90
91define(`_linecounter_',0)
92
93define(`_emit_BSD_source_line_stab',`
94ifdef(`X86',`
95# __line__ "__file__" 1',`
96        .stabd 68,0,$1
97')')
98
99
100/*  We don't really do "weak importing" of symbols from a separate  */
101/*  subprims library anymore; if we ever do and the OS supports it,  */
102/*  here's how to say that we want it ...  */
103
104define(`WEAK',`ifdef(`HaveWeakSymbols',`
105        .weak $1
106',`
107        .globl $1
108')')
109
110define(`_emit_ELF_source_line_stab',`
111  define(`_linecounter_',incr(_linecounter_))
112        .stabn 68,0,$1,`.LM'_linecounter_`-'__func_name
113`.LM'_linecounter_:
114')
115
116define(`_emit_COFF_source_line_stab',`
117        _emit_ELF_source_line_stab($1)
118')
119
120
121define(`emit_source_line_stab',`
122        ifelse(eval(SYSstabs),
123             eval(BSDstabs),
124              `_emit_BSD_source_line_stab($1)',
125              eval(SYSstabs),
126              eval(ELFstabs),
127              `_emit_ELF_source_line_stab($1)',
128              `_emit_COFF_source_line_stab($1)')')
129
130
131
132
133
134
135/*  Assemble a reference to the high half of a 32-bit constant,  */
136/*  possibly adjusted for sign-extension of thw low half.  */
137
138
139define(`HA',`ifdef(`DARWIN',`ha16($1)',`$1@ha')')
140
141 
142/*  Likewise for the low half, and for the high half without  */
143/*  concern for sign-extension of the low half.  */
144
145define(`LO',`ifdef(`DARWIN',`lo16($1)',`$1@l')')
146define(`HI',`ifdef(`DARWIN',`hi16($1)',`$1@hi')')
147
148/*  Note that m4 macros that could be expanded in the .text segment  */
149/*  need to advertise the current line number after they have finished  */
150/*  expanding.  That shouldn't be too onerous, if only because there  */
151/*  should not be too many of them.  */
152
153
154define(`N_FUN',36)
155define(`N_SO',100)
156
157/*    I wish that there was a less-dumb way of doing this.  */
158
159define(`pwd0',esyscmd(`/bin/pwd'))
160define(`__pwd__',substr(pwd0,0,decr(len(pwd0)))`/')
161
162/*   _beginfile() -- gets line/file in synch, generates N_SO for file,  */
163/*   starts .text section  */
164
165
166define(`_beginfile',`
167        .stabs "__pwd__",N_SO,0,0,StartTextLabel()
168        .stabs "__file__",N_SO,0,0,StartTextLabel()
169ifdef(`PPC64',`
170ifdef(`DARWIN',`
171        .machine ppc64
172')')
173        .text
174StartTextLabel():
175# __line__ "__file__"
176')
177
178define(`_endfile',`
179        .stabs "",N_SO,0,0,EndTextLabel()
180EndTextLabel():
181# __line__
182')
183
184define(`_startfn',`define(`__func_name',$1)
185# __line__
186        ifelse(eval(SYSstabs),eval(ELFstabs),`
187        .type $1,ifdef(`ARM',%function,@function)
188')
189
190$1:
191ifdef(`WINDOWS',`
192        .def    $1;     .scl    2;      .type   32;     .endef
193',`
194        .stabd 68,0,__line__
195')
196        .stabs "$1:F1",36,0,__line__,$1
197        .set func_start,$1
198# __line__ "__file__" 1 ')
199
200
201
202define(`_exportfn',`
203        .globl $1
204        _startfn($1)
205ifdef(`PPC64',`
206ifdef(`LINUX',`
207        .global `.'$1
208`.'$1:
209')')
210# __line__
211')
212
213
214define(`_endfn',`
215LocalLabelPrefix`'__func_name`999':
216ifdef(`WINDOWS',`
217',`
218        .stabs "",36,0,0,LocalLabelPrefix`'__func_name`999'-__func_name
219        .line __line__
220        ifelse(eval(SYSstabs),eval(ELFstabs),`
221        .size __func_name,LocalLabelPrefix`'__func_name`999'-__func_name
222')
223')
224        undefine(`__func_name')
225')
226
227
228/* _struct(name,start_offset)  */
229/*   This just generates a bunch of assembler equates; m4  */
230/*   doesn't remember much of it ..  */
231
232define(`_struct', `define(`__struct_name',$1)
233 define(`_struct_org_name', _$1_org)
234 define(`_struct_base_name', _$1_base)
235        .set _struct_org_name,$2
236        .set _struct_base_name,_struct_org_name
237 ifelse($3,`',`
238  undefine(`_struct_fixed_size_name')
239  ',`
240  define(`_struct_fixed_size_name', _$1_fixed_size)
241        .set _struct_fixed_size_name,$3
242  ')
243')
244
245define(`_struct_pad',`
246        .set _struct_org_name,_struct_org_name + $1
247')
248 
249define(`_struct_label',`
250        .set __struct_name`.'$1, _struct_org_name
251')
252
253/*  _field(name,size)   */
254define(`_field',`_struct_label($1) _struct_pad($2)')
255/* predecrement */
256define(`_rfield',`_struct_pad(-$2) _struct_label($1)')
257
258define(`_halfword', `_field($1, 2)')
259define(`_word', `_field($1, 4)')
260define(`_dword',`_field($1, 8)')
261define(`_node', `_field($1, node_size)')
262define(`_rnode', `_rfield($1, node_size)')
263
264
265define(`_ends',`ifdef(`_struct_fixed_size_name',`
266        .set  __struct_name`.size',_struct_fixed_size_name
267        ',`
268        .set  __struct_name`.size', _struct_org_name-_struct_base_name
269        ')
270')
271
272
273/*   Lisp fixed-size objects always have a 1-word header  */
274/*   and are always accessed from a "fulltag_misc"-tagged pointer.  */
275/*   We also want to define STRUCT_NAME.element_count for each  */
276/*   such object.  */
277
278
279define(`_structf',`
280        _struct($1,ifelse($2,`',-misc_bias,$2))
281        _node(header)
282')
283
284define(`_endstructf',`
285        .set __struct_name.`element_count',((_struct_org_name-node_size)-_struct_base_name)/node_size
286        _ends
287')
288
289
290define(`__',`emit_source_line_stab(__line__)
291        $@
292        ')
293
294define(`__local_label_counter__',0)
295define(`__macro_label_counter__',0)
296
297define(`new_local_labels',
298  `define(`__local_label_counter__',incr(__local_label_counter__))')
299
300define(`new_macro_labels',
301  `define(`__macro_label_counter__',incr(__macro_label_counter__))')
302
303define(`_local_label',`LocalLabelPrefix()`'$1')
304define(`_macro_label',`MacroLabelPrefix()`'$1')
305
306define(`local_label',`_local_label($1`'__local_label_counter__)')
307
308define(`macro_label',`_macro_label($1`'__macro_label_counter__)')
309
310
311/* The Darwin assembler doesn't seem to support .ifdef/.ifndef, but  */
312/* does understand .if.    */
313/* Note that using M4's own ifdef is certainly possible, but it's  */
314/* hard to generate source line information when doing so.  */
315
316 
317define(`__ifdef',`ifdef(`$1',`.if 1',`.if 0')')
318define(`__ifndef',`ifdef(`$1',`.if 0',`.if 1')')
319define(`__else',`.else')
320define(`__endif',`.endif')
321define(`__if',`.if $1')
322
323define(`equate_if_defined',`ifdef($1,`
324`$1' = 1
325',`
326`$1' = 0
327')')
328
329equate_if_defined(`DARWIN')
330equate_if_defined(`LINUX')
331equate_if_defined(`FREEBSD')
332equate_if_defined(`SOLARIS')
333equate_if_defined(`WIN_64')
334equate_if_defined(`PPC64')
335equate_if_defined(`X8664')
336equate_if_defined(`WIN_32')
337equate_if_defined(`WINDOWS')
338
339equate_if_defined(`HAVE_TLS')
340
341equate_if_defined(`TCR_IN_GPR')
342
343/* Well, so much for that. Maybe this will go away soon ? */
344equate_if_defined(`WIN32_ES_HACK')
345equate_if_defined(`SYSCALL_SETS_CARRY_ON_ERROR')
346
347
348
349/* We use (more-or-less) a PowerOpen C frame, except on LinuxPPC32  */
350
351define(`USE_POWEROPEN_C_FRAME',`')
352undefine(`USE_EABI_C_FRAME')
353
354ifdef(`LINUX',`
355ifdef(`PPC64',`',`
356define(`USE_EABI_C_FRAME',`')
357undefine(`USE_POWEROPEN_C_FRAME')
358')')
359
360
361
362
Note: See TracBrowser for help on using the repository browser.