[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog engine/jitc_array.c engine/jitc_...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog engine/jitc_array.c engine/jitc_... |
Date: |
Sun, 06 Jan 2008 21:40:07 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Klaus Treichel <ktreichel> 08/01/06 21:40:07
Modified files:
. : ChangeLog
engine : jitc_array.c jitc_pinvoke.c
Log message:
Make the names GetArrayLength and GetarrayBase conforming to the other
functions and pass the jit function to these functions instead of the
coder
to make them usable in jitc_pinvoke.c.
Use the functions above to fix 32/64bit bugs in jitc_pinvoke.c.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3531&r2=1.3532
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc_array.c?cvsroot=dotgnu-pnet&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc_pinvoke.c?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3531
retrieving revision 1.3532
diff -u -b -r1.3531 -r1.3532
--- ChangeLog 4 Jan 2008 23:46:32 -0000 1.3531
+++ ChangeLog 6 Jan 2008 21:40:05 -0000 1.3532
@@ -1,3 +1,14 @@
+2008-01-06 Klaus Treichel <address@hidden>
+
+ * engine/jitc_array.c: Rename GetArrayBase to _ILJitSArrayGetBase and
+ GetArrayLength to _ILJitSArrayGetLength. Pass the jit function instead
of
+ the coder to the two functions.
+
+ * engine/jitc_pinvoke.c: Use the methods in jitc_array.c to get the base
+ or length of a simple array. Use the offsetof macro to get the actual
+ offset of the length in the array header instead of 0 when setting the
+ new array length.
+
2008-01-05 Radek Polak <address@hidden>
* support/socket.c: Implemented IrDA device discovery. Fixed checking
for
Index: engine/jitc_array.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/jitc_array.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- engine/jitc_array.c 18 Feb 2007 08:31:17 -0000 1.9
+++ engine/jitc_array.c 6 Jan 2008 21:40:06 -0000 1.10
@@ -64,7 +64,19 @@
}
/*
- * Create an Object array with the given size.
+ * Get the base pointer to the array data of a simple array.
+ */
+static ILJitValue _ILJitSArrayGetBase(ILJitFunction jitFunction,
+
ILJitValue array);
+
+/*
+ * Get the array length of a simple array.
+ */
+static ILJitValue _ILJitSArrayGetLength(ILJitFunction jitFunction,
+
ILJitValue array);
+
+/*
+ * Create a simple Object array with the given size.
*/
static ILJitValue _ILJitSObjectArrayCreate(ILJitFunction jitFunction,
ILExecThread *_thread,
@@ -615,21 +627,23 @@
}
/*
- * Get the base pointer to the array data.
+ * Get the base pointer to the array data of a simple array.
*/
-static ILJitValue GetArrayBase(ILJITCoder *coder, ILJitValue array)
+static ILJitValue _ILJitSArrayGetBase(ILJitFunction jitFunction,
+
ILJitValue array)
{
- return jit_insn_add_relative(coder->jitFunction, array,
sizeof(System_Array));
+ return jit_insn_add_relative(jitFunction, array, sizeof(System_Array));
}
/*
- * Get the array length.
+ * Get the array length of a simple array.
*/
-static ILJitValue GetArrayLength(ILJITCoder *coder, ILJitValue array)
+static ILJitValue _ILJitSArrayGetLength(ILJitFunction jitFunction,
+
ILJitValue array)
{
ILJitValue len;
- len = jit_insn_load_relative(coder->jitFunction,
+ len = jit_insn_load_relative(jitFunction,
array,
offsetof(SArrayHeader, length),
_IL_JIT_TYPE_INT32);
@@ -667,9 +681,11 @@
_ILJitStackPop(coder, index);
_ILJitStackPop(coder, array);
_ILJitStackItemCheckNull(coder, array);
- length = GetArrayLength(coder, _ILJitStackItemValue(array));
+ length = _ILJitSArrayGetLength(coder->jitFunction,
+
_ILJitStackItemValue(array));
JITC_START_CHECK_ARRAY_INDEX(coder, length, _ILJitStackItemValue(index))
- arrayBase = GetArrayBase(coder, _ILJitStackItemValue(array));
+ arrayBase = _ILJitSArrayGetBase(coder->jitFunction,
+
_ILJitStackItemValue(array));
value = jit_insn_load_elem(coder->jitFunction,
arrayBase,
_ILJitStackItemValue(index),
@@ -696,9 +712,11 @@
_ILJitStackPop(coder, array);
valueType = jit_value_get_type(_ILJitStackItemValue(value));
_ILJitStackItemCheckNull(coder, array);
- length = GetArrayLength(coder, _ILJitStackItemValue(array));
+ length = _ILJitSArrayGetLength(coder->jitFunction,
+
_ILJitStackItemValue(array));
ValidateArrayIndex(coder, length, _ILJitStackItemValue(index));
- arrayBase = GetArrayBase(coder, _ILJitStackItemValue(array));
+ arrayBase = _ILJitSArrayGetBase(coder->jitFunction,
+
_ILJitStackItemValue(array));
/* Convert the value to the array type when needed. */
if(valueType != type)
@@ -779,9 +797,11 @@
_ILJitStackPop(jitCoder, array);
_ILJitStackItemCheckNull(jitCoder, array);
- len = GetArrayLength(jitCoder,
_ILJitStackItemValue(array));
+ len = _ILJitSArrayGetLength(jitCoder->jitFunction,
+
_ILJitStackItemValue(array));
ValidateArrayIndex(jitCoder, len,
_ILJitStackItemValue(index));
- arrayBase = GetArrayBase(jitCoder,
_ILJitStackItemValue(array));
+ arrayBase = _ILJitSArrayGetBase(jitCoder->jitFunction,
+
_ILJitStackItemValue(array));
ILJitType type = _ILJitGetReturnType(elemType,
jitCoder->process);
@@ -956,7 +976,8 @@
_ILJitStackPop(jitCoder, array);
_ILJitStackItemCheckNull(jitCoder, array);
- length = GetArrayLength(jitCoder, _ILJitStackItemValue(array));
+ length = _ILJitSArrayGetLength(jitCoder->jitFunction,
+
_ILJitStackItemValue(array));
_ILJitStackPushValue(jitCoder, length);
}
Index: engine/jitc_pinvoke.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/jitc_pinvoke.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- engine/jitc_pinvoke.c 15 Feb 2007 20:47:33 -0000 1.8
+++ engine/jitc_pinvoke.c 6 Jan 2008 21:40:06 -0000 1.9
@@ -1192,9 +1192,8 @@
jit_insn_store(function, newArray, srcArray);
if(addressKind==MARSHAL_FIRST_LEVEL_VALUE)
{
- jit_insn_store(function, newArray,
jit_insn_add_relative(function,
-
newArray,
-
(jit_nint)(sizeof(ILUInt32))));
+ jit_insn_store(function, newArray,
+
_ILJitSArrayGetBase(function, newArray));
}
jit_insn_label(function, &endLoop);
if(addressKind==MARSHAL_ITEM_OF_STRUCTURE ||
addressKind==MARSHAL_ITEM_OF_ARRAY)
@@ -1202,7 +1201,8 @@
return newArray;
}
// The size of a simple array can be known only on run-time.
- arraySize = jit_insn_load_relative(function, srcArray, 0,
_IL_JIT_TYPE_UINT32);
+ arraySize = _ILJitSArrayGetLength(function, srcArray);
+
thread = ILExecThreadCurrent();
srcElemSize = jit_value_create_nint_constant(function,
_IL_JIT_TYPE_INT32,
@@ -1221,9 +1221,7 @@
jit_value_create_nint_constant
(function, _IL_JIT_TYPE_UINT32, 0)),
&endLoop);
- srcElemAddress = jit_insn_add_relative(function,
- srcArray,
-
(jit_nint)(sizeof(ILUInt32)));
+ srcElemAddress = _ILJitSArrayGetBase(function, srcArray);
newElemAddress = jit_value_create(function, jit_type_int);
jit_insn_store(function, newElemAddress, newArray);
counter = jit_insn_dup(function, arraySize);
@@ -1921,7 +1919,8 @@
return;
}
// The size of a simple array can be known only on
run-time.
- arraySize = jit_insn_load_relative(function,
outAddressValue, 0, _IL_JIT_TYPE_UINT32);
+ arraySize = _ILJitSArrayGetLength(function,
outAddressValue);
+
thread = ILExecThreadCurrent();
srcElemSize =
jit_value_create_nint_constant(function,
_IL_JIT_TYPE_INT32,
@@ -1929,7 +1928,7 @@
newElemSize =
jit_value_create_nint_constant(function,
_IL_JIT_TYPE_INT32,
(jit_nint)(_ILSizeOfTypeLocked(_ILExecThreadProcess(thread), elemType)));
- newArray = jit_insn_add_relative(function,
outAddressValue, (jit_nint)(sizeof(ILUInt32)));
+ newArray = _ILJitSArrayGetBase(function,
outAddressValue);
jit_insn_branch_if(function,
jit_insn_eq(function, arraySize,
jit_value_create_nint_constant
@@ -2795,7 +2794,8 @@
jit_insn_branch_if_not(function,
jit_insn_to_bool(function, srcArray),
&endLoop);
// The size of a simple array can be known only on
run-time.
- arraySize = jit_insn_load_relative(function,
srcArray, 0, _IL_JIT_TYPE_UINT32);
+ arraySize = _ILJitSArrayGetLength(function,
srcArray);
+
srcElemSize =
jit_value_create_nint_constant(function,
_IL_JIT_TYPE_INT32,
(jit_nint)(_ILSizeOfTypeLocked(_ILExecThreadProcess(thread),
@@ -2805,14 +2805,17 @@
(jit_nint)(_ILSizeOfTypeLocked(_ILExecThreadProcess(thread),
elemType)));
newArraySize = jit_insn_mul(function, arraySize,
newElemSize);
- newArraySize = jit_insn_add_relative(function,
newArraySize, (jit_nint)(sizeof(ILUInt32)));
+ newArraySize = jit_insn_add_relative(function,
newArraySize,
+
(jit_nint)_IL_JIT_SARRAY_HEADERSIZE);
args[0] = newArraySize;
newArray = jit_insn_call_native(function,
"_ILGCAllocAtomic",
ILGCAllocAtomic,
_ILJitSignature_malloc,
args,
1, 0);
- jit_insn_store_relative(function, newArray, 0,
arraySize);
- newArray = jit_insn_add_relative(function,
newArray, (jit_nint)(sizeof(ILUInt32)));
+ jit_insn_store_relative(function, newArray,
+
offsetof(SArrayHeader, length),
+
arraySize);
+ newArray = _ILJitSArrayGetBase(function, newArray);
jit_insn_branch_if(function,
jit_insn_eq(function, arraySize,
jit_value_create_nint_constant
@@ -2822,7 +2825,7 @@
srcArray,
jit_value_create_nint_constant(function,
_IL_JIT_TYPE_INT32,
-
(jit_nint)(sizeof(ILUInt32))));
+
(jit_nint)_IL_JIT_SARRAY_HEADERSIZE));
newElemAddress = jit_insn_dup(function, newArray);
counter = jit_insn_dup(function, arraySize);
jit_insn_label(function, &startLoop);
@@ -3583,7 +3586,8 @@
}
// The size of a simple array can be known only on
run-time.
- arraySize = jit_insn_load_relative(function,
srcArray, 0, _IL_JIT_TYPE_UINT32);
+ arraySize = _ILJitSArrayGetLength(function,
srcArray);
+
srcElemSize =
jit_value_create_nint_constant(function,
_IL_JIT_TYPE_INT32,
(jit_nint)(_ILSizeOfTypeLocked(_ILExecThreadProcess(thread), elemType)));
@@ -3597,7 +3601,7 @@
(function, _IL_JIT_TYPE_UINT32, 0)),
&endLoop);
newElemAddress = jit_insn_dup(function,
outAddressValue);
- srcElemAddress = jit_insn_add_relative(function,
srcArray, (jit_nint)(sizeof(ILUInt32)));
+ srcElemAddress = _ILJitSArrayGetBase(function,
srcArray);
counter = jit_insn_dup(function, arraySize);
jit_insn_label(function, &startLoop);
jit_insn_store(function, counter,
jit_insn_sub(function,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ChangeLog engine/jitc_array.c engine/jitc_...,
Klaus Treichel <=