899 assert(size_in_words >= header_words, "too small");
900 stack->overflow_check(size_in_words, CHECK_NULL);
901
902 stack->push(0); // next_frame, filled in later
903 intptr_t *fp = stack->sp();
904 assert(fp - stack->sp() == next_frame_off, "should be");
905
906 stack->push(INTERPRETER_FRAME);
907 assert(fp - stack->sp() == frame_type_off, "should be");
908
909 interpreterState istate =
910 (interpreterState) stack->alloc(sizeof(BytecodeInterpreter));
911 assert(fp - stack->sp() == istate_off, "should be");
912 istate->set_self_link(NULL); // mark invalid
913
914 stack->alloc((size_in_words - header_words) * wordSize);
915
916 return (InterpreterFrame *) fp;
917 }
918
919 int AbstractInterpreter::layout_activation(Method* method,
920 int tempcount,
921 int popframe_extra_args,
922 int moncount,
923 int caller_actual_parameters,
924 int callee_param_count,
925 int callee_locals,
926 frame* caller,
927 frame* interpreter_frame,
928 bool is_top_frame,
929 bool is_bottom_frame) {
930 assert(popframe_extra_args == 0, "what to do?");
931 assert(!is_top_frame || (!callee_locals && !callee_param_count),
932 "top frame should have no caller");
933
934 // This code must exactly match what InterpreterFrame::build
935 // does (the full InterpreterFrame::build, that is, not the
936 // one that creates empty frames for the deoptimizer).
937 //
938 // If interpreter_frame is not NULL then it will be filled in.
939 // It's size is determined by a previous call to this method,
940 // so it should be correct.
941 //
942 // Note that tempcount is the current size of the expression
943 // stack. For top most frames we will allocate a full sized
944 // expression stack and not the trimmed version that non-top
945 // frames have.
946
947 int header_words = InterpreterFrame::header_words;
948 int monitor_words = moncount * frame::interpreter_frame_monitor_size();
949 int stack_words = is_top_frame ? method->max_stack() : tempcount;
950 int callee_extra_locals = callee_locals - callee_param_count;
951
952 if (interpreter_frame) {
953 intptr_t *locals = interpreter_frame->fp() + method->max_locals();
954 interpreterState istate = interpreter_frame->get_interpreterState();
955 intptr_t *monitor_base = (intptr_t*) istate;
956 intptr_t *stack_base = monitor_base - monitor_words;
957 intptr_t *stack = stack_base - tempcount - 1;
958
959 BytecodeInterpreter::layout_interpreterState(istate,
960 caller,
961 NULL,
962 method,
963 locals,
964 stack,
965 stack_base,
966 monitor_base,
967 NULL,
968 is_top_frame);
969 }
970 return header_words + monitor_words + stack_words + callee_extra_locals;
971 }
972
973 void BytecodeInterpreter::layout_interpreterState(interpreterState istate,
974 frame* caller,
975 frame* current,
976 Method* method,
977 intptr_t* locals,
978 intptr_t* stack,
979 intptr_t* stack_base,
980 intptr_t* monitor_base,
981 intptr_t* frame_bottom,
982 bool is_top_frame) {
983 istate->set_locals(locals);
984 istate->set_method(method);
985 istate->set_self_link(istate);
986 istate->set_prev_link(NULL);
987 // thread will be set by a hacky repurposing of frame::patch_pc()
988 // bcp will be set by vframeArrayElement::unpack_on_stack()
989 istate->set_constants(method->constants()->cache());
990 istate->set_msg(BytecodeInterpreter::method_resume);
|
899 assert(size_in_words >= header_words, "too small");
900 stack->overflow_check(size_in_words, CHECK_NULL);
901
902 stack->push(0); // next_frame, filled in later
903 intptr_t *fp = stack->sp();
904 assert(fp - stack->sp() == next_frame_off, "should be");
905
906 stack->push(INTERPRETER_FRAME);
907 assert(fp - stack->sp() == frame_type_off, "should be");
908
909 interpreterState istate =
910 (interpreterState) stack->alloc(sizeof(BytecodeInterpreter));
911 assert(fp - stack->sp() == istate_off, "should be");
912 istate->set_self_link(NULL); // mark invalid
913
914 stack->alloc((size_in_words - header_words) * wordSize);
915
916 return (InterpreterFrame *) fp;
917 }
918
919 int AbstractInterpreter::size_activation(int max_stack,
920 int tempcount,
921 int popframe_extra_args,
922 int moncount,
923 int callee_param_count,
924 int callee_locals,
925 bool is_top_frame) {
926 int header_words = InterpreterFrame::header_words;
927 int monitor_words = moncount * frame::interpreter_frame_monitor_size();
928 int stack_words = is_top_frame ? max_stack : tempcount;
929 int callee_extra_locals = callee_locals - callee_param_count;
930
931 return header_words + monitor_words + stack_words + callee_extra_locals;
932 }
933
934 void AbstractInterpreter::layout_activation(Method* method,
935 int tempcount,
936 int popframe_extra_args,
937 int moncount,
938 int caller_actual_parameters,
939 int callee_param_count,
940 int callee_locals,
941 frame* caller,
942 frame* interpreter_frame,
943 bool is_top_frame,
944 bool is_bottom_frame) {
945 assert(popframe_extra_args == 0, "what to do?");
946 assert(!is_top_frame || (!callee_locals && !callee_param_count),
947 "top frame should have no caller");
948
949 // This code must exactly match what InterpreterFrame::build
950 // does (the full InterpreterFrame::build, that is, not the
951 // one that creates empty frames for the deoptimizer).
952 //
953 // interpreter_frame will be filled in. It's size is determined by
954 // a previous call to the size_activation() method,
955 //
956 // Note that tempcount is the current size of the expression
957 // stack. For top most frames we will allocate a full sized
958 // expression stack and not the trimmed version that non-top
959 // frames have.
960
961 int monitor_words = moncount * frame::interpreter_frame_monitor_size();
962 intptr_t *locals = interpreter_frame->fp() + method->max_locals();
963 interpreterState istate = interpreter_frame->get_interpreterState();
964 intptr_t *monitor_base = (intptr_t*) istate;
965 intptr_t *stack_base = monitor_base - monitor_words;
966 intptr_t *stack = stack_base - tempcount - 1;
967
968 BytecodeInterpreter::layout_interpreterState(istate,
969 caller,
970 NULL,
971 method,
972 locals,
973 stack,
974 stack_base,
975 monitor_base,
976 NULL,
977 is_top_frame);
978 }
979
980 void BytecodeInterpreter::layout_interpreterState(interpreterState istate,
981 frame* caller,
982 frame* current,
983 Method* method,
984 intptr_t* locals,
985 intptr_t* stack,
986 intptr_t* stack_base,
987 intptr_t* monitor_base,
988 intptr_t* frame_bottom,
989 bool is_top_frame) {
990 istate->set_locals(locals);
991 istate->set_method(method);
992 istate->set_self_link(istate);
993 istate->set_prev_link(NULL);
994 // thread will be set by a hacky repurposing of frame::patch_pc()
995 // bcp will be set by vframeArrayElement::unpack_on_stack()
996 istate->set_constants(method->constants()->cache());
997 istate->set_msg(BytecodeInterpreter::method_resume);
|