<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
Um. I don't see the point of the hashtable actually.<br>All the calls except "m3_alloca" are translated "directly".<br><br>I understand that if there were many things like this new m3_alloca, a hashtable would make sense.<br><br>I understand as well that __builtin_alloca ought to just work w/o special handling, but I didn't debug why.<br><br>I'm testing the below and expect it will work. Even if atomics are used much.<br><br>?<br><br>Index: m3-sys/m3cc/gcc/gcc/m3cg/parse.c<br>===================================================================<br>RCS file: /usr/cvs/cm3/m3-sys/m3cc/gcc/gcc/m3cg/parse.c,v<br>retrieving revision 1.478<br>diff -u -r1.478 parse.c<br>--- m3-sys/m3cc/gcc/gcc/m3cg/parse.c 13 Jan 2011 14:58:29 -0000 1.478<br>+++ m3-sys/m3cc/gcc/gcc/m3cg/parse.c 13 Jan 2011 15:10:35 -0000<br>@@ -1535,37 +1535,6 @@<br> return decl;<br> }<br> <br>-/* Return a definition for a builtin function named NAME and whose data type<br>- is TYPE. TYPE should be a function type with argument types.<br>- FUNCTION_CODE tells later passes how to compile calls to this function.<br>- See tree.h for its possible values.<br>-<br>- If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,<br>- the name to be called if we can't opencode the function. If<br>- ATTRS is nonzero, use that for the function's attribute list.<br>-<br>- copied from gcc/c-decl.c<br>-*/<br>-<br>-static GTY ((param_is (union tree_node))) htab_t builtins;<br>-<br>-static hashval_t<br>-htab_hash_builtin (const PTR p)<br>-{<br>- const_tree t = (const_tree)p;<br>-<br>- return htab_hash_pointer (DECL_NAME (t));<br>-}<br>-<br>-static int<br>-htab_eq_builtin (const PTR p1, const PTR p2)<br>-{<br>- const_tree t1 = (const_tree)p1;<br>- const_tree t2 = (const_tree)p2;<br>-<br>- return DECL_NAME (t1) == DECL_NAME (t2);<br>-}<br>-<br> static tree<br> builtin_function (PCSTR name, tree type,<br> #if GCC42<br>@@ -1595,13 +1564,6 @@<br> gcc_assert (!library_name);<br> }<br> <br>- if (!builtins)<br>- builtins = htab_create_ggc (1021, htab_hash_builtin,<br>- htab_eq_builtin, NULL);<br>- tree* slot = (tree *)htab_find_slot (builtins, decl, INSERT);<br>- gcc_assert (*slot == NULL);<br>- *slot = decl;<br>-<br> TREE_CHAIN (decl) = global_decls;<br> global_decls = decl;<br> <br>@@ -2979,11 +2941,7 @@<br> static tree<br> m3_convert_function_to_builtin (tree p)<br> {<br>- tree *slot = (tree *)htab_find_slot (builtins, p, NO_INSERT);<br>-<br>- if (slot)<br>- p = *slot;<br>- else if (DECL_NAME (p) == m3_alloca)<br>+ if (DECL_NAME (p) == m3_alloca)<br> p = built_in_decls[BUILT_IN_ALLOCA];<br> return p;<br> }<br><br>?<br><br> - Jay<br><br><br><hr id="stopSpelling">From: jay.krell@cornell.edu<br>To: jkrell@elego.de; m3commit@elegosoft.com<br>Subject: RE: [M3commit] CVS Update: cm3<br>Date: Thu, 13 Jan 2011 15:06:37 +0000<br><br>
<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<meta name="Generator" content="Microsoft SafeHTML">
<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}
</style>
Hm. I'll try the hashtable instead.<br><br> - Jay<br><br><hr id="ecxstopSpelling">From: jay.krell@cornell.edu<br>To: jkrell@elego.de; m3commit@elegosoft.com<br>Subject: RE: [M3commit] CVS Update: cm3<br>Date: Thu, 13 Jan 2011 15:00:24 +0000<br><br>
<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}
</style>
Index: m3-sys/m3front/src/misc/Marker.m3<br>===================================================================<br>RCS file: /usr/cvs/cm3/m3-sys/m3front/src/misc/Marker.m3,v<br>retrieving revision 1.8<br>diff -u -r1.8 Marker.m3<br>--- m3-sys/m3front/src/misc/Marker.m3 6 Jan 2011 20:40:16 -0000 1.8<br>+++ m3-sys/m3front/src/misc/Marker.m3 13 Jan 2011 14:56:53 -0000<br>@@ -248,7 +248,7 @@<br> END;<br> (* void* _alloca(size_t); *)<br> IF (alloca = NIL) THEN<br>- alloca := CG.Import_procedure (M3ID.Add ("_alloca"), 1, CG.Type.Addr,<br>+ alloca := CG.Import_procedure (M3ID.Add ("m3_alloca"), 1, CG.Type.Addr,<br> Target.DefaultCall, new);<br> IF (new) THEN<br> EVAL CG.Declare_param (M3ID.NoID, Target.Word.size, Target.Word.align,<br>Index: m3-sys/m3cc/gcc/gcc/m3cg/parse.c<br>===================================================================<br>RCS file: /usr/cvs/cm3/m3-sys/m3cc/gcc/gcc/m3cg/parse.c,v<br>retrieving revision 1.477<br>diff -u -r1.477 parse.c<br>--- m3-sys/m3cc/gcc/gcc/m3cg/parse.c 5 Jan 2011 14:34:53 -0000 1.477<br>+++ m3-sys/m3cc/gcc/gcc/m3cg/parse.c 13 Jan 2011 14:56:53 -0000<br>@@ -473,6 +473,8 @@<br> #define t_void void_type_node<br> static GTY (()) tree t_set;<br> <br>+static tree m3_alloca;<br>+<br> static const struct { UINT32 type_id; tree* t; } builtin_uids[] = {<br> { UID_INTEGER, &t_int },<br> { UID_LONGINT, &t_longint },<br>@@ -1750,6 +1752,7 @@<br> bits_per_integer_tree = build_int_cst (t_word, BITS_PER_INTEGER);<br> bytes_per_integer_tree = build_int_cst (t_word, BITS_PER_INTEGER / BITS_PER_UNIT);<br> tree stdcall = get_identifier_with_length (CONSTANT_STRING_AND_LENGTH ("stdcall"));<br>+ m3_alloca = get_identifier_with_length (CONSTANT_STRING_AND_LENGTH ("m3_alloca"));<br> stdcall_list = build_tree_list (stdcall, NULL);<br> t_set = m3_build_pointer_type (t_word);<br> <br>@@ -2979,22 +2982,9 @@<br> tree *slot = (tree *)htab_find_slot (builtins, p, NO_INSERT);<br> <br> if (slot)<br>- {<br> p = *slot;<br>- }<br>- else<br>- {<br>- const char *name = IDENTIFIER_POINTER (DECL_NAME (p));<br>- if (name[0] == 'a' || name[0] == '_')<br>- {<br>- if (strcmp(name, "alloca") == 0<br>- || strcmp(name, "_alloca") == 0<br>- || strcmp(name, "__builtin_alloca") == 0)<br>- {<br>- p = built_in_decls[BUILT_IN_ALLOCA];<br>- }<br>- }<br>- }<br>+ else if (DECL_NAME (p) == m3_alloca)<br>+ p = built_in_decls[BUILT_IN_ALLOCA];<br> return p;<br> }<br> <br> - Jay<br><br><br>> Date: Thu, 13 Jan 2011 15:58:29 +0000<br>> To: m3commit@elegosoft.com<br>> From: jkrell@elego.de<br>> Subject: [M3commit] CVS Update: cm3<br>> <br>> CVSROOT: /usr/cvs<br>> Changes by: jkrell@birch. 11/01/13 15:58:29<br>> <br>> Modified files:<br>> cm3/m3-sys/m3front/src/misc/: Marker.m3 <br>> cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c <br>> <br>> Log message:<br>> __builtin_alloca didn't work w/o translation<br>> among alloca, _alloca, __builtin_alloca, make up our own name, m3_alloca<br>> and do the comparison by pointer equality (since gcc uses<br>> string interning)<br>> I'd also go for _m3_alloca, __m3_alloca, or alloca, or darn near<br>> anything else.<br>> <br> </body>
</html>