[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog engine/jitc.c engine/jitc_gen.h ...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog engine/jitc.c engine/jitc_gen.h ... |
Date: |
Thu, 05 Oct 2006 17:20:50 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Klaus Treichel <ktreichel> 06/10/05 17:20:50
Modified files:
. : ChangeLog
engine : jitc.c jitc_gen.h jitc_labels.c jitc_locals.c
jitc_stack.c
Log message:
2006-10-05 Klaus Treichel <address@hidden>
* engine/jitc.c, engine/jitc_gen.h, engine/jitc_labels.c,
engine/jitc_locals.c, engine/jitc_stack.c: Start with some code
reorganization.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3368&r2=1.3369
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc.c?cvsroot=dotgnu-pnet&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc_gen.h?cvsroot=dotgnu-pnet&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc_labels.c?cvsroot=dotgnu-pnet&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc_locals.c?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc_stack.c?cvsroot=dotgnu-pnet&r1=1.5&r2=1.6
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3368
retrieving revision 1.3369
diff -u -b -r1.3368 -r1.3369
--- ChangeLog 5 Oct 2006 07:58:09 -0000 1.3368
+++ ChangeLog 5 Oct 2006 17:20:50 -0000 1.3369
@@ -1,5 +1,9 @@
2006-10-05 Klaus Treichel <address@hidden>
+ * engine/jitc.c, engine/jitc_gen.h, engine/jitc_labels.c,
+ engine/jitc_locals.c, engine/jitc_stack.c: Start with some code
+ reorganization.
+
* engine/jitc_except.c: Add return after throwing an
OutOfMemoryException
in _ILJitThrowSystem. Without this return an other erroneous call to
ILRuntimeExceptionThrowClass was emitted.
Index: engine/jitc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/jitc.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- engine/jitc.c 4 Oct 2006 14:33:33 -0000 1.52
+++ engine/jitc.c 5 Oct 2006 17:20:50 -0000 1.53
@@ -291,71 +291,16 @@
#endif
/*
- * declaration of the different label types.
- */
-#define _IL_JIT_LABEL_NORMAL 1
-#define _IL_JIT_LABEL_STARTCATCH 2
-#define _IL_JIT_LABEL_STARTFINALLY 4
-
-/*
- * Define the structure of a JIT label.
- */
-typedef struct _tagILJITLabel ILJITLabel;
-struct _tagILJITLabel
-{
- ILUInt32 address; /* Address in the IL code */
- jit_label_t label; /* the libjit label */
- ILJITLabel *next; /* Next label block */
- int labelType; /* type of the label. */
- int stackSize; /* No. of elements on
the stack. */
- ILJitValue *jitStack; /* Values on the stack. */
-};
-
-/*
- * Define the structure of a local/argument slot.
- */
-typedef struct _tagILJitLocalSlot ILJitLocalSlot;
-struct _tagILJitLocalSlot
-{
- ILJitValue value; /* the ILJitValue */
- ILUInt32 flags; /* State of the local/arg. */
-};
-
-/*
- * Define the structure for managing the local slots.
- */
-typedef struct _tagILJitLocalSlots ILJitLocalSlots;
-struct _tagILJitLocalSlots
-{
- ILJitLocalSlot *slots; /* Pointer to the slots. */
- int numSlots; /* Number of used
slots. */
- int maxSlots; /* Number of allocated
slots. */
-};
-
-#define _ILJitLocalSlotsInit(s) \
- do { \
- (s).slots = 0; \
- (s).numSlots = 0; \
- (s).maxSlots = 0; \
- } while (0);
-
-#define _ILJitLocalSlotsDestroy(s) \
- do { \
- if((s).slots) \
- { \
- ILFree((s).slots); \
- } \
- (s).slots = 0; \
- (s).numSlots = 0; \
- (s).maxSlots = 0; \
- } while (0);
-
-
-/*
* Forward declaration of the JIT coder's instance block.
*/
typedef struct _tagILJITCoder ILJITCoder;
+#define IL_JITC_DECLARATIONS
+#include "jitc_locals.c"
+#include "jitc_stack.c"
+#include "jitc_labels.c"
+#undef IL_JITC_DECLARATIONS
+
/*
* Prototype for inlining functioncalls.
*
@@ -414,30 +359,11 @@
/* Pool for the method infos. */
ILMemPool methodPool;
- /* Members to manage the evaluation stack. */
- ILJitValue *jitStack;
- int stackSize;
- int stackTop;
-
- /* Members to manage the fixed arguments. */
- ILJitLocalSlots jitParams;
-
- /* Members to manage the local variables. */
- ILJitLocalSlots jitLocals;
-#ifdef _IL_JIT_OPTIMIZE_INIT_LOCALS
- int localsInitialized;
-#endif
-
- /* Handle the labels. */
- ILMemPool labelPool;
- ILJITLabel *labelList;
- int labelOutOfMemory;
- ILMemStack stackStates;
-
- /* Handle the switch table. */
- ILJitValue switchValue;
- int numSwitch;
- int maxSwitch;
+#define IL_JITC_CODER_INSTANCE
+#include "jitc_locals.c"
+#include "jitc_stack.c"
+#include "jitc_labels.c"
+#undef IL_JITC_CODER_INSTANCE
/* The current jitted function. */
ILJitFunction jitFunction;
@@ -459,7 +385,7 @@
};
/*
- * Convert a pointer to an ILCoder to a pointer to the ILJITVoder instance
+ * Convert a pointer to an ILCoder to a pointer to the ILJITCoder instance
*/
#define _ILCoderToILJITCoder(coder) ((ILJITCoder *)coder)
@@ -2326,34 +2252,19 @@
/* Intialize the pool for the method infos. */
ILMemPoolInit(&(coder->methodPool), sizeof(ILJitMethodInfo), 100);
- /* Initialize the stack management. */
- coder->jitStack = 0;
- coder->stackTop = -1;
- coder->stackSize = 0;
-
- /* Initialize the parameter management. */
- _ILJitLocalSlotsInit(coder->jitParams)
-
- /* Initialize the locals management. */
- _ILJitLocalSlotsInit(coder->jitLocals)
-
/* Init the current jitted function. */
coder->jitFunction = 0;
- /* Init the label stuff. */
- ILMemPoolInit(&(coder->labelPool), sizeof(ILJITLabel), 8);
- coder->labelList = 0;
- coder->labelOutOfMemory = 0;
-
- /* Init the switch stuff. */
- coder->switchValue = 0;
- coder->numSwitch = 0;
- coder->maxSwitch = 0;
-
#ifndef IL_JIT_THREAD_IN_SIGNATURE
coder->thread = 0;
#endif
+#define IL_JITC_CODER_INIT
+ #include "jitc_locals.c"
+ #include "jitc_stack.c"
+ #include "jitc_labels.c"
+#undef IL_JITC_CODER_INIT
+
/* Ready to go */
return &(coder->coder);
}
@@ -2544,22 +2455,18 @@
static void JITCoder_Destroy(ILCoder *_coder)
{
ILJITCoder *coder = _ILCoderToILJITCoder(_coder);
- if(coder->jitStack)
- {
- ILFree(coder->jitStack);
- coder->jitStack = 0;
- }
- _ILJitLocalSlotsDestroy(coder->jitLocals)
-
- _ILJitLocalSlotsDestroy(coder->jitParams)
+#define IL_JITC_CODER_DESTROY
+#include "jitc_locals.c"
+#include "jitc_stack.c"
+#include "jitc_labels.c"
+#undef IL_JITC_CODER_DESTROY
if(coder->context)
{
jit_context_destroy(coder->context);
coder->context = 0;
}
- ILMemPoolDestroy(&(coder->labelPool));
ILMemPoolDestroy(&(coder->methodPool));
@@ -3995,9 +3902,12 @@
#endif /* !IL_CONFIG_REDUCE_CODE */
+#define IL_JITC_FUNCTIONS
#include "jitc_diag.c"
#include "jitc_locals.c"
+#include "jitc_stack.c"
#include "jitc_labels.c"
+#undef IL_JITC_FUNCTIONS
/*
* Include the rest of the JIT conversion routines from other files.
Index: engine/jitc_gen.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/jitc_gen.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- engine/jitc_gen.h 29 Dec 2005 15:56:52 -0000 1.1
+++ engine/jitc_gen.h 5 Oct 2006 17:20:50 -0000 1.2
@@ -82,12 +82,6 @@
__temp[7] = arg[7]; \
} while(0)
-#define _JITC_ADJUST(coder, num) \
- do { \
- (coder)->stackTop += (num); \
- } while(0)
-
-#define JITC_ADJUST(coder, num) _JITC_ADJUST((coder), (num))
#define JITC_GET_INT8(arg, value) _JITC_GET_INT8((arg), (value))
#define JITC_GET_INT16(arg, value) _JITC_GET_INT16((arg), (value))
#define JITC_GET_INT32(arg, value) _JITC_GET_INT32((arg), (value))
Index: engine/jitc_labels.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/jitc_labels.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- engine/jitc_labels.c 17 Apr 2006 17:39:44 -0000 1.2
+++ engine/jitc_labels.c 5 Oct 2006 17:20:50 -0000 1.3
@@ -18,6 +18,68 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef IL_JITC_DECLARATIONS
+
+/*
+ * declaration of the different label types.
+ */
+#define _IL_JIT_LABEL_NORMAL 1
+#define _IL_JIT_LABEL_STARTCATCH 2
+#define _IL_JIT_LABEL_STARTFINALLY 4
+
+/*
+ * Define the structure of a JIT label.
+ */
+typedef struct _tagILJITLabel ILJITLabel;
+struct _tagILJITLabel
+{
+ ILUInt32 address; /* Address in the IL code */
+ jit_label_t label; /* the libjit label */
+ ILJITLabel *next; /* Next label block */
+ int labelType; /* type of the label. */
+ int stackSize; /* No. of elements on
the stack. */
+ ILJitValue *jitStack; /* Values on the stack. */
+};
+
+#endif /* IL_JITC_DECLARATIONS */
+
+#ifdef IL_JITC_CODER_INSTANCE
+
+ /* Handle the labels. */
+ ILMemPool labelPool;
+ ILJITLabel *labelList;
+ int labelOutOfMemory;
+ ILMemStack stackStates;
+
+ /* Handle the switch table. */
+ ILJitValue switchValue;
+ int numSwitch;
+ int maxSwitch;
+
+#endif /* IL_JITC_CODER_INSTANCE */
+
+#ifdef IL_JITC_CODER_INIT
+
+ /* Init the label stuff. */
+ ILMemPoolInit(&(coder->labelPool), sizeof(ILJITLabel), 8);
+ coder->labelList = 0;
+ coder->labelOutOfMemory = 0;
+
+ /* Init the switch stuff. */
+ coder->switchValue = 0;
+ coder->numSwitch = 0;
+ coder->maxSwitch = 0;
+
+#endif /* IL_JITC_CODER_INIT */
+
+#ifdef IL_JITC_CODER_DESTROY
+
+ ILMemPoolDestroy(&(coder->labelPool));
+
+#endif /* IL_JITC_CODER_DESTROY */
+
+#ifdef IL_JITC_FUNCTIONS
+
/*
* Save the current jitStack status to the label.
* This is done when the label is referenced the first time.
@@ -196,4 +258,5 @@
return label;
}
+#endif /* IL_JITC_FUNCTIONS */
Index: engine/jitc_locals.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/jitc_locals.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- engine/jitc_locals.c 17 Sep 2006 18:32:31 -0000 1.4
+++ engine/jitc_locals.c 5 Oct 2006 17:20:50 -0000 1.5
@@ -18,11 +18,58 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef IL_JITC_DECLARATIONS
+
+/*
+ * Define the structure of a local/argument slot.
+ */
+typedef struct _tagILJitLocalSlot ILJitLocalSlot;
+struct _tagILJitLocalSlot
+{
+ ILJitValue value; /* the ILJitValue */
+ ILUInt32 flags; /* State of the local/arg. */
+};
+
+/*
+ * Define the structure for managing the local slots.
+ */
+typedef struct _tagILJitLocalSlots ILJitLocalSlots;
+struct _tagILJitLocalSlots
+{
+ ILJitLocalSlot *slots; /* Pointer to the slots. */
+ int numSlots; /* Number of used
slots. */
+ int maxSlots; /* Number of allocated
slots. */
+};
+
+#define _ILJitLocalSlotsInit(s) \
+ do { \
+ (s).slots = 0; \
+ (s).numSlots = 0; \
+ (s).maxSlots = 0; \
+ } while (0);
+
+#define _ILJitLocalSlotsDestroy(s) \
+ do { \
+ if((s).slots) \
+ { \
+ ILFree((s).slots); \
+ } \
+ (s).slots = 0; \
+ (s).numSlots = 0; \
+ (s).maxSlots = 0; \
+ } while (0);
+
/*
* definitions used in the slot's flags
*/
-#define _IL_JIT_VALUE_NULLCHECKED 1
-#define _IL_JIT_VALUE_INITIALIZED 2
+#define _IL_JIT_VALUE_NULLCHECKED 0x00000001
+#define _IL_JIT_VALUE_INITIALIZED 0x00000002
+
+/*
+ * additional flags used on the evaluation stack.
+ */
+#define _IL_JIT_VALUE_COPYOF 0x00000100 /* complete copy of the
local/arg value */
+#define _IL_JIT_VALUE_POINTER_TO 0x00000200 /* pointer to the
local/arg value */
/*
* Allocate enough space for "n" slots.
@@ -84,6 +131,40 @@
*/
#define _ILJitParamValue(coder, n) _ILJitParamGet((coder), (n)).value
+#endif /* IL_JITC_DECLARATIONS */
+
+#ifdef IL_JITC_CODER_INSTANCE
+
+ /* Members to manage the fixed arguments. */
+ ILJitLocalSlots jitParams;
+
+ /* Members to manage the local variables. */
+ ILJitLocalSlots jitLocals;
+#ifdef _IL_JIT_OPTIMIZE_INIT_LOCALS
+ int localsInitialized;
+#endif
+
+#endif /* IL_JITC_CODER_INSTANCE */
+
+#ifdef IL_JITC_CODER_INIT
+
+ /* Initialize the parameter management. */
+ _ILJitLocalSlotsInit(coder->jitParams)
+
+ /* Initialize the locals management. */
+ _ILJitLocalSlotsInit(coder->jitLocals)
+
+#endif /* IL_JITC_CODER_INIT */
+
+#ifdef IL_JITC_CODER_DESTROY
+
+ _ILJitLocalSlotsDestroy(coder->jitLocals)
+
+ _ILJitLocalSlotsDestroy(coder->jitParams)
+
+#endif /* IL_JITC_CODER_DESTROY */
+
+#ifdef IL_JITC_FUNCTIONS
/*
* Get the pointer to a local.
@@ -580,4 +661,5 @@
jit_insn_check_null(coder->jitFunction, address);
}
+#endif /* IL_JITC_FUNCTIONS */
Index: engine/jitc_stack.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/jitc_stack.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- engine/jitc_stack.c 8 Mar 2006 21:03:52 -0000 1.5
+++ engine/jitc_stack.c 5 Oct 2006 17:20:50 -0000 1.6
@@ -18,6 +18,55 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef IL_JITC_DECLARATIONS
+
+typedef struct _tagILJitStackItem ILJitStachItem;
+struct _tagILJitStackItem
+{
+ ILJitValue value;
+};
+
+#endif
+
+#ifdef IL_JITC_CODER_INSTANCE
+
+ /* Members to manage the evaluation stack. */
+ ILJitValue *jitStack;
+ int stackSize;
+ int stackTop;
+
+#endif
+
+#ifdef IL_JITC_CODER_INIT
+
+ /* Initialize the stack management. */
+ coder->jitStack = 0;
+ coder->stackTop = -1;
+ coder->stackSize = 0;
+
+#endif /* IL_JITC_CODER_INIT */
+
+#ifdef IL_JITC_CODER_DESTROY
+
+ if(coder->jitStack)
+ {
+ ILFree(coder->jitStack);
+ coder->jitStack = 0;
+ }
+
+#endif /* IL_JITC_CODER_DESTROY */
+
+#ifdef IL_JITC_FUNCTIONS
+
+#define _JITC_ADJUST(coder, num) \
+ do { \
+ (coder)->stackTop += (num); \
+ } while(0)
+
+#endif
+
+#define JITC_ADJUST(coder, num) _JITC_ADJUST((coder), (num))
+
#ifdef IL_JITC_CODE
/*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ChangeLog engine/jitc.c engine/jitc_gen.h ...,
Klaus Treichel <=