< prev index next >

src/hotspot/cpu/x86/abstractInterpreter_x86.cpp

Print this page

 54 
 55   return size;
 56 }
 57 
 58 void AbstractInterpreter::layout_activation(Method* method,
 59                                             int tempcount,
 60                                             int popframe_extra_args,
 61                                             int moncount,
 62                                             int caller_actual_parameters,
 63                                             int callee_param_count,
 64                                             int callee_locals,
 65                                             frame* caller,
 66                                             frame* interpreter_frame,
 67                                             bool is_top_frame,
 68                                             bool is_bottom_frame) {
 69   // The frame interpreter_frame is guaranteed to be the right size,
 70   // as determined by a previous call to the size_activation() method.
 71   // It is also guaranteed to be walkable even though it is in a
 72   // skeletal state
 73 
 74   int max_locals = method->max_locals() * Interpreter::stackElementWords;
 75   int extra_locals = (method->max_locals() - method->size_of_parameters()) *
 76     Interpreter::stackElementWords;
 77 
 78 #ifdef ASSERT
 79   assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable");
 80 #endif
 81 
 82   interpreter_frame->interpreter_frame_set_method(method);
 83   // NOTE the difference in using sender_sp and
 84   // interpreter_frame_sender_sp interpreter_frame_sender_sp is
 85   // the original sp of the caller (the unextended_sp) and
 86   // sender_sp is fp+8/16 (32bit/64bit) XXX
 87   intptr_t* locals = interpreter_frame->sender_sp() + max_locals - 1;
 88 
 89 #ifdef ASSERT
 90   if (caller->is_interpreted_frame()) {





 91     assert(locals < caller->fp() + frame::interpreter_frame_initial_sp_offset, "bad placement");
 92   }
 93 #endif
 94 
 95   interpreter_frame->interpreter_frame_set_locals(locals);
 96   BasicObjectLock* montop = interpreter_frame->interpreter_frame_monitor_begin();
 97   BasicObjectLock* monbot = montop - moncount;
 98   interpreter_frame->interpreter_frame_set_monitor_end(monbot);
 99 
100   // Set last_sp
101   intptr_t*  esp = (intptr_t*) monbot -
102     tempcount*Interpreter::stackElementWords -
103     popframe_extra_args;
104   interpreter_frame->interpreter_frame_set_last_sp(esp);
105 
106   // All frames but the initial (oldest) interpreter frame we fill in have
107   // a value for sender_sp that allows walking the stack but isn't
108   // truly correct. Correct the value here.
109   if (extra_locals != 0 &&
110       interpreter_frame->sender_sp() ==
111       interpreter_frame->interpreter_frame_sender_sp()) {
112     interpreter_frame->set_interpreter_frame_sender_sp(caller->sp() +
113                                                        extra_locals);
114   }
115   *interpreter_frame->interpreter_frame_cache_addr() =
116     method->constants()->cache();
117   *interpreter_frame->interpreter_frame_mirror_addr() =
118     method->method_holder()->java_mirror();
119 }
120 
121 #ifndef _LP64
122 int AbstractInterpreter::BasicType_as_index(BasicType type) {
123   int i = 0;
124   switch (type) {
125     case T_BOOLEAN: i = 0; break;
126     case T_CHAR   : i = 1; break;
127     case T_BYTE   : i = 2; break;
128     case T_SHORT  : i = 3; break;
129     case T_INT    : // fall through
130     case T_LONG   : // fall through
131     case T_VOID   : i = 4; break;
132     case T_FLOAT  : i = 5; break;  // have to treat float and double separately for SSE
133     case T_DOUBLE : i = 6; break;
134     case T_OBJECT : // fall through
135     case T_ARRAY  : i = 7; break;
136     default       : ShouldNotReachHere();
137   }
138   assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, "index out of bounds");

 54 
 55   return size;
 56 }
 57 
 58 void AbstractInterpreter::layout_activation(Method* method,
 59                                             int tempcount,
 60                                             int popframe_extra_args,
 61                                             int moncount,
 62                                             int caller_actual_parameters,
 63                                             int callee_param_count,
 64                                             int callee_locals,
 65                                             frame* caller,
 66                                             frame* interpreter_frame,
 67                                             bool is_top_frame,
 68                                             bool is_bottom_frame) {
 69   // The frame interpreter_frame is guaranteed to be the right size,
 70   // as determined by a previous call to the size_activation() method.
 71   // It is also guaranteed to be walkable even though it is in a
 72   // skeletal state
 73 
 74   const int max_locals = method->max_locals() * Interpreter::stackElementWords;
 75   const int params = method->size_of_parameters() * Interpreter::stackElementWords;
 76   const int extra_locals = max_locals - params;
 77 

 78   assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable");

 79 
 80   interpreter_frame->interpreter_frame_set_method(method);
 81   // NOTE the difference in using sender_sp and
 82   // interpreter_frame_sender_sp interpreter_frame_sender_sp is
 83   // the original sp of the caller (the unextended_sp) and
 84   // sender_sp is fp+8/16 (32bit/64bit) XXX
 85   intptr_t* const locals = interpreter_frame->sender_sp() + max_locals - 1;
 86 
 87 #ifdef ASSERT
 88   if (caller->is_interpreted_frame()) {
 89     if (locals >= caller->fp() + frame::interpreter_frame_initial_sp_offset) {
 90       tty->print("method: "); method->print_on(tty);
 91       tty->print("caller: "); caller->print_on(tty);
 92       tty->print_cr("sender_sp: " INTPTR_FORMAT " locals: " INTPTR_FORMAT " max_locals: %d caller.fp: " INTPTR_FORMAT " caller.initial_sp: " INTPTR_FORMAT, p2i(interpreter_frame->sender_sp()), p2i(locals), max_locals, p2i(caller->fp()), p2i(caller->fp() + frame::interpreter_frame_initial_sp_offset));
 93     }
 94     assert(locals < caller->fp() + frame::interpreter_frame_initial_sp_offset, "bad placement");
 95   }
 96 #endif
 97 
 98   interpreter_frame->interpreter_frame_set_locals(locals);
 99   BasicObjectLock* montop = interpreter_frame->interpreter_frame_monitor_begin();
100   BasicObjectLock* monbot = montop - moncount;
101   interpreter_frame->interpreter_frame_set_monitor_end(monbot);
102 
103   // Set last_sp
104   intptr_t*  esp = (intptr_t*) monbot -
105     tempcount*Interpreter::stackElementWords -
106     popframe_extra_args;
107   interpreter_frame->interpreter_frame_set_last_sp(esp);
108 
109   // All frames but the initial (oldest) interpreter frame we fill in have
110   // a value for sender_sp that allows walking the stack but isn't
111   // truly correct. Correct the value here.
112   if (extra_locals != 0 && interpreter_frame->sender_sp() == interpreter_frame->interpreter_frame_sender_sp()) {
113     interpreter_frame->set_interpreter_frame_sender_sp(caller->sp() + extra_locals);



114   }
115 
116   *interpreter_frame->interpreter_frame_cache_addr()  = method->constants()->cache();
117   *interpreter_frame->interpreter_frame_mirror_addr() = method->method_holder()->java_mirror();

118 }
119 
120 #ifndef _LP64
121 int AbstractInterpreter::BasicType_as_index(BasicType type) {
122   int i = 0;
123   switch (type) {
124     case T_BOOLEAN: i = 0; break;
125     case T_CHAR   : i = 1; break;
126     case T_BYTE   : i = 2; break;
127     case T_SHORT  : i = 3; break;
128     case T_INT    : // fall through
129     case T_LONG   : // fall through
130     case T_VOID   : i = 4; break;
131     case T_FLOAT  : i = 5; break;  // have to treat float and double separately for SSE
132     case T_DOUBLE : i = 6; break;
133     case T_OBJECT : // fall through
134     case T_ARRAY  : i = 7; break;
135     default       : ShouldNotReachHere();
136   }
137   assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, "index out of bounds");
< prev index next >