They are needed to hold temporary results when register can not be used.

Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 include/jit/compilation-unit.h |   20 +++++++++++++++++++-
 jit/compilation-unit.c         |   16 ++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/include/jit/compilation-unit.h b/include/jit/compilation-unit.h
index 4114bce..be76e5f 100644
--- a/include/jit/compilation-unit.h
+++ b/include/jit/compilation-unit.h
@@ -93,11 +93,18 @@ struct compilation_unit {
        struct radix_tree *safepoint_map;
 
        /*
-        * Contains native pointers of exception handlers.  Indices to
+        * Contains native pointers of exception handlers. Indices to
         * this table are the same as for exception table in code
         * attribute.
         */
        void **exception_handlers;
+
+       /*
+        * These point to stack slots for storing temporary results
+        * within one monoburg rule where we can not use a register.
+        */
+       struct stack_slot *scratch_slot_32;
+       struct stack_slot *scratch_slot_64;
 };
 
 struct compilation_unit *compilation_unit_alloc(struct vm_method *);
@@ -109,6 +116,17 @@ struct var_info *get_fixed_var(struct compilation_unit *, 
enum machine_reg);
 struct basic_block *find_bb(struct compilation_unit *, unsigned long);
 unsigned long nr_bblocks(struct compilation_unit *);
 void compute_insn_positions(struct compilation_unit *);
+struct stack_slot *get_scratch_slot(struct compilation_unit *, int);
+
+static inline struct stack_slot *get_scratch_slot_32(struct compilation_unit 
*cu)
+{
+       return get_scratch_slot(cu, 1);
+}
+
+static inline struct stack_slot *get_scratch_slot_64(struct compilation_unit 
*cu)
+{
+       return get_scratch_slot(cu, 2);
+}
 
 #define for_each_variable(var, var_list) for (var = var_list; var != NULL; var 
= var->next)
 
diff --git a/jit/compilation-unit.c b/jit/compilation-unit.c
index 0dd4415..918420c 100644
--- a/jit/compilation-unit.c
+++ b/jit/compilation-unit.c
@@ -267,3 +267,19 @@ void compute_insn_positions(struct compilation_unit *cu)
 
        cu->last_insn = pos;
 }
+
+struct stack_slot *get_scratch_slot(struct compilation_unit *cu, int slot_size)
+{
+       switch (slot_size) {
+       case 1:
+               if (!cu->scratch_slot_32)
+                       cu->scratch_slot_32 = 
get_spill_slot_32(cu->stack_frame);
+               return cu->scratch_slot_32;
+       case 2:
+               if (!cu->scratch_slot_64)
+                       cu->scratch_slot_64 = 
get_spill_slot_64(cu->stack_frame);
+               return cu->scratch_slot_64;
+       default:
+               error("invalid slot size");
+       }
+}
-- 
1.6.3.3


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to