81 |
int flags; |
int flags; |
82 |
long nativeArgPosn; |
long nativeArgPosn; |
83 |
long nativeArgHeight; |
long nativeArgHeight; |
84 |
|
ILExecProcess *process; /* Backpointer to the owning process */ |
85 |
}; |
}; |
86 |
|
|
87 |
/* |
/* |
88 |
|
* Convert a pointer to an ILCoder to a pointer to the ILCVMVoder instance |
89 |
|
*/ |
90 |
|
#define _ILCoderToILCVMCoder(coder) ((ILCVMCoder *)coder) |
91 |
|
|
92 |
|
/* |
93 |
* Include the CVM code generation macros. |
* Include the CVM code generation macros. |
94 |
*/ |
*/ |
95 |
#include "cvmc_gen.h" |
#include "cvmc_gen.h" |
111 |
/* |
/* |
112 |
* Get the size of a type in stack words. |
* Get the size of a type in stack words. |
113 |
*/ |
*/ |
114 |
static ILUInt32 GetTypeSize(ILType *type) |
static ILUInt32 GetTypeSize(ILExecProcess *process, ILType *type) |
115 |
{ |
{ |
116 |
ILUInt32 size = _ILSizeOfTypeLocked(type); |
ILUInt32 size = _ILSizeOfTypeLocked(process, type); |
117 |
return (size + sizeof(CVMWord) - 1) / sizeof(CVMWord); |
return (size + sizeof(CVMWord) - 1) / sizeof(CVMWord); |
118 |
} |
} |
119 |
|
|
120 |
/* |
/* |
121 |
* Get the size of a type in stack words, taking float expansion into account. |
* Get the size of a type in stack words, taking float expansion into account. |
122 |
*/ |
*/ |
123 |
static ILUInt32 GetStackTypeSize(ILType *type) |
static ILUInt32 GetStackTypeSize(ILExecProcess *process, ILType *type) |
124 |
{ |
{ |
125 |
ILUInt32 size; |
ILUInt32 size; |
126 |
if(type == ILType_Float32 || type == ILType_Float64) |
if(type == ILType_Float32 || type == ILType_Float64) |
129 |
} |
} |
130 |
else |
else |
131 |
{ |
{ |
132 |
size = _ILSizeOfTypeLocked(type); |
size = _ILSizeOfTypeLocked(process, type); |
133 |
} |
} |
134 |
return (size + sizeof(CVMWord) - 1) / sizeof(CVMWord); |
return (size + sizeof(CVMWord) - 1) / sizeof(CVMWord); |
135 |
} |
} |
137 |
/* |
/* |
138 |
* Create a new CVM coder instance. |
* Create a new CVM coder instance. |
139 |
*/ |
*/ |
140 |
static ILCoder *CVMCoder_Create(ILUInt32 size, unsigned long cachePageSize) |
static ILCoder *CVMCoder_Create(ILExecProcess *process, ILUInt32 size, |
141 |
|
unsigned long cachePageSize) |
142 |
{ |
{ |
143 |
ILCVMCoder *coder; |
ILCVMCoder *coder; |
144 |
if((coder = (ILCVMCoder *)ILMalloc(sizeof(ILCVMCoder))) == 0) |
if((coder = (ILCVMCoder *)ILMalloc(sizeof(ILCVMCoder))) == 0) |
172 |
coder->flags = 0; |
coder->flags = 0; |
173 |
coder->nativeArgPosn = 0; |
coder->nativeArgPosn = 0; |
174 |
coder->nativeArgHeight = 0; |
coder->nativeArgHeight = 0; |
175 |
|
coder->process = process; |
176 |
|
|
177 |
/* Call the interpreter to export the label tables for |
/* Call the interpreter to export the label tables for |
178 |
use in code generation for direct threading */ |
use in code generation for direct threading */ |