Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /MLRISC/trunk/vararg-ccall/test/ia32-test-varargs.c
ViewVC logotype

Diff of /MLRISC/trunk/vararg-ccall/test/ia32-test-varargs.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3054, Tue Jun 3 01:26:28 2008 UTC revision 3055, Tue Jun 3 06:55:14 2008 UTC
# Line 10  Line 10 
10    void* val;    void* val;
11    void* kind;    void* kind;
12    void* loc;    void* loc;
13  }  triplet_t;    void* ty;
14    }  zipped_arg_t;
15    
16  typedef struct varargs_s {  typedef struct varargs_s {
17    triplet_t* hd;    zipped_arg_t* hd;
18    struct varargs_s* tl;    struct varargs_s* tl;
19  } varargs_t;  } varargs_t;
20    
# Line 53  Line 54 
54    for (int i = N_ARGS-2; i >= 0; i--)    for (int i = N_ARGS-2; i >= 0; i--)
55      args[i]->tl = args[i+1];      args[i]->tl = args[i+1];
56    
57    args[0]->hd = NEW(triplet_t);    args[0]->hd = NEW(zipped_arg_t);
58    args[0]->hd->val = (void*)"arg1=%f\n";    args[0]->hd->val = (void*)"arg1=%f\n";
59    args[0]->hd->kind = (void*)STK;    args[0]->hd->kind = (void*)STK;
60    args[0]->hd->loc = (void*)(0*4);    args[0]->hd->loc = (void*)(0*4);
   /*  
   args[1]->hd = NEW(triplet_t);  
   args[1]->hd->val = (void*)0xdeadbeef;  
   args[1]->hd->kind = (void*)STK;  
   args[1]->hd->loc = (void*)(1*4);  
   */  
61    
62    float f = 3.14f;    float f = 3.14f;
63    void** x = (void*)&f;    void** x = (void*)&f;
64    printf("%f\n",*(float*)x);    printf("%f\n",*(float*)x);
65    
66    args[1]->hd = NEW(triplet_t);    args[1]->hd = NEW(zipped_arg_t);
67    args[1]->hd->val = *x;    args[1]->hd->val = *x;
68    args[1]->hd->kind = (void*)FSTK;    args[1]->hd->kind = (void*)FSTK;
69    args[1]->hd->loc = (void*)(1*4);    args[1]->hd->loc = (void*)(1*4);
70      args[1]->hd->ty = (void*)32;
71    
72    varargs(Say, args[0], alignb(N_ARGS));    varargs(Say, args[0], alignb(N_ARGS));
73    

Legend:
Removed from v.3054  
changed lines
  Added in v.3055

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0