10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/assembler.hpp"
28 #include "interpreter/bytecodeHistogram.hpp"
29 #include "interpreter/cppInterpreter.hpp"
30 #include "interpreter/interpreter.hpp"
31 #include "interpreter/interpreterGenerator.hpp"
32 #include "interpreter/interpreterRuntime.hpp"
33 #include "oops/arrayOop.hpp"
34 #include "oops/methodData.hpp"
35 #include "oops/method.hpp"
36 #include "oops/oop.inline.hpp"
37 #include "prims/jvmtiExport.hpp"
38 #include "prims/jvmtiThreadState.hpp"
39 #include "runtime/arguments.hpp"
40 #include "runtime/atomic.inline.hpp"
41 #include "runtime/deoptimization.hpp"
42 #include "runtime/frame.inline.hpp"
43 #include "runtime/interfaceSupport.hpp"
44 #include "runtime/orderAccess.inline.hpp"
45 #include "runtime/sharedRuntime.hpp"
46 #include "runtime/stubRoutines.hpp"
47 #include "runtime/synchronizer.hpp"
48 #include "runtime/timer.hpp"
49 #include "runtime/vframeArray.hpp"
50 #include "stack_zero.inline.hpp"
51 #include "utilities/debug.hpp"
771 BasicType CppInterpreter::result_type_of(Method* method) {
772 BasicType t;
773 switch (method->result_index()) {
774 case 0 : t = T_BOOLEAN; break;
775 case 1 : t = T_CHAR; break;
776 case 2 : t = T_BYTE; break;
777 case 3 : t = T_SHORT; break;
778 case 4 : t = T_INT; break;
779 case 5 : t = T_LONG; break;
780 case 6 : t = T_VOID; break;
781 case 7 : t = T_FLOAT; break;
782 case 8 : t = T_DOUBLE; break;
783 case 9 : t = T_OBJECT; break;
784 default: ShouldNotReachHere();
785 }
786 assert(AbstractInterpreter::BasicType_as_index(t) == method->result_index(),
787 "out of step with AbstractInterpreter::BasicType_as_index");
788 return t;
789 }
790
791 address InterpreterGenerator::generate_empty_entry() {
792 if (!UseFastEmptyMethods)
793 return NULL;
794
795 return generate_entry((address) CppInterpreter::empty_entry);
796 }
797
798 address InterpreterGenerator::generate_accessor_entry() {
799 if (!UseFastAccessorMethods)
800 return NULL;
801
802 return generate_entry((address) CppInterpreter::accessor_entry);
803 }
804
805 address InterpreterGenerator::generate_Reference_get_entry(void) {
806 #if INCLUDE_ALL_GCS
807 if (UseG1GC) {
808 // We need to generate have a routine that generates code to:
809 // * load the value in the referent field
810 // * passes that value to the pre-barrier.
811 //
812 // In the case of G1 this will record the value of the
813 // referent in an SATB buffer if marking is active.
814 // This will cause concurrent marking to mark the referent
815 // field as live.
816 Unimplemented();
817 }
818 #endif // INCLUDE_ALL_GCS
819
820 // If G1 is not enabled then attempt to go through the normal entry point
821 // Reference.get could be instrumented by jvmti
822 return NULL;
823 }
824
825 address InterpreterGenerator::generate_native_entry(bool synchronized) {
826 return generate_entry((address) CppInterpreter::native_entry);
827 }
828
829 address InterpreterGenerator::generate_normal_entry(bool synchronized) {
830 return generate_entry((address) CppInterpreter::normal_entry);
831 }
832
833
834 InterpreterGenerator::InterpreterGenerator(StubQueue* code)
835 : CppInterpreterGenerator(code) {
836 generate_all();
837 }
838
839 // Deoptimization helpers
840
841 InterpreterFrame *InterpreterFrame::build(int size, TRAPS) {
842 ZeroStack *stack = ((JavaThread *) THREAD)->zero_stack();
843
844 int size_in_words = size >> LogBytesPerWord;
845 assert(size_in_words * wordSize == size, "unaligned");
846 assert(size_in_words >= header_words, "too small");
847 stack->overflow_check(size_in_words, CHECK_NULL);
848
849 stack->push(0); // next_frame, filled in later
850 intptr_t *fp = stack->sp();
851 assert(fp - stack->sp() == next_frame_off, "should be");
852
853 stack->push(INTERPRETER_FRAME);
854 assert(fp - stack->sp() == frame_type_off, "should be");
855
856 interpreterState istate =
857 (interpreterState) stack->alloc(sizeof(BytecodeInterpreter));
858 assert(fp - stack->sp() == istate_off, "should be");
963 address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
964 ShouldNotCallThis();
965 return NULL;
966 }
967
968 address CppInterpreter::deopt_entry(TosState state, int length) {
969 return NULL;
970 }
971
972 // Helper for (runtime) stack overflow checks
973
974 int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
975 return 0;
976 }
977
978 // Helper for figuring out if frames are interpreter frames
979
980 bool CppInterpreter::contains(address pc) {
981 return false; // make frame::print_value_on work
982 }
983
984 // Result handlers and convertors
985
986 address CppInterpreterGenerator::generate_result_handler_for(
987 BasicType type) {
988 assembler()->advance(1);
989 return ShouldNotCallThisStub();
990 }
991
992 address CppInterpreterGenerator::generate_tosca_to_stack_converter(
993 BasicType type) {
994 assembler()->advance(1);
995 return ShouldNotCallThisStub();
996 }
997
998 address CppInterpreterGenerator::generate_stack_to_stack_converter(
999 BasicType type) {
1000 assembler()->advance(1);
1001 return ShouldNotCallThisStub();
1002 }
1003
1004 address CppInterpreterGenerator::generate_stack_to_native_abi_converter(
1005 BasicType type) {
1006 assembler()->advance(1);
1007 return ShouldNotCallThisStub();
1008 }
1009
1010 #endif // CC_INTERP
|
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/assembler.hpp"
28 #include "interpreter/bytecodeHistogram.hpp"
29 #include "interpreter/cppInterpreter.hpp"
30 #include "interpreter/cppInterpreterGenerator.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "interpreter/interpreterRuntime.hpp"
33 #include "oops/arrayOop.hpp"
34 #include "oops/methodData.hpp"
35 #include "oops/method.hpp"
36 #include "oops/oop.inline.hpp"
37 #include "prims/jvmtiExport.hpp"
38 #include "prims/jvmtiThreadState.hpp"
39 #include "runtime/arguments.hpp"
40 #include "runtime/atomic.inline.hpp"
41 #include "runtime/deoptimization.hpp"
42 #include "runtime/frame.inline.hpp"
43 #include "runtime/interfaceSupport.hpp"
44 #include "runtime/orderAccess.inline.hpp"
45 #include "runtime/sharedRuntime.hpp"
46 #include "runtime/stubRoutines.hpp"
47 #include "runtime/synchronizer.hpp"
48 #include "runtime/timer.hpp"
49 #include "runtime/vframeArray.hpp"
50 #include "stack_zero.inline.hpp"
51 #include "utilities/debug.hpp"
771 BasicType CppInterpreter::result_type_of(Method* method) {
772 BasicType t;
773 switch (method->result_index()) {
774 case 0 : t = T_BOOLEAN; break;
775 case 1 : t = T_CHAR; break;
776 case 2 : t = T_BYTE; break;
777 case 3 : t = T_SHORT; break;
778 case 4 : t = T_INT; break;
779 case 5 : t = T_LONG; break;
780 case 6 : t = T_VOID; break;
781 case 7 : t = T_FLOAT; break;
782 case 8 : t = T_DOUBLE; break;
783 case 9 : t = T_OBJECT; break;
784 default: ShouldNotReachHere();
785 }
786 assert(AbstractInterpreter::BasicType_as_index(t) == method->result_index(),
787 "out of step with AbstractInterpreter::BasicType_as_index");
788 return t;
789 }
790
791 address CppInterpreterGenerator::generate_empty_entry() {
792 if (!UseFastEmptyMethods)
793 return NULL;
794
795 return generate_entry((address) CppInterpreter::empty_entry);
796 }
797
798 address CppInterpreterGenerator::generate_accessor_entry() {
799 if (!UseFastAccessorMethods)
800 return NULL;
801
802 return generate_entry((address) CppInterpreter::accessor_entry);
803 }
804
805 address CppInterpreterGenerator::generate_Reference_get_entry(void) {
806 #if INCLUDE_ALL_GCS
807 if (UseG1GC) {
808 // We need to generate have a routine that generates code to:
809 // * load the value in the referent field
810 // * passes that value to the pre-barrier.
811 //
812 // In the case of G1 this will record the value of the
813 // referent in an SATB buffer if marking is active.
814 // This will cause concurrent marking to mark the referent
815 // field as live.
816 Unimplemented();
817 }
818 #endif // INCLUDE_ALL_GCS
819
820 // If G1 is not enabled then attempt to go through the normal entry point
821 // Reference.get could be instrumented by jvmti
822 return NULL;
823 }
824
825 address CppInterpreterGenerator::generate_native_entry(bool synchronized) {
826 return generate_entry((address) CppInterpreter::native_entry);
827 }
828
829 address CppInterpreterGenerator::generate_normal_entry(bool synchronized) {
830 return generate_entry((address) CppInterpreter::normal_entry);
831 }
832
833
834 // Deoptimization helpers
835
836 InterpreterFrame *InterpreterFrame::build(int size, TRAPS) {
837 ZeroStack *stack = ((JavaThread *) THREAD)->zero_stack();
838
839 int size_in_words = size >> LogBytesPerWord;
840 assert(size_in_words * wordSize == size, "unaligned");
841 assert(size_in_words >= header_words, "too small");
842 stack->overflow_check(size_in_words, CHECK_NULL);
843
844 stack->push(0); // next_frame, filled in later
845 intptr_t *fp = stack->sp();
846 assert(fp - stack->sp() == next_frame_off, "should be");
847
848 stack->push(INTERPRETER_FRAME);
849 assert(fp - stack->sp() == frame_type_off, "should be");
850
851 interpreterState istate =
852 (interpreterState) stack->alloc(sizeof(BytecodeInterpreter));
853 assert(fp - stack->sp() == istate_off, "should be");
958 address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
959 ShouldNotCallThis();
960 return NULL;
961 }
962
963 address CppInterpreter::deopt_entry(TosState state, int length) {
964 return NULL;
965 }
966
967 // Helper for (runtime) stack overflow checks
968
969 int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
970 return 0;
971 }
972
973 // Helper for figuring out if frames are interpreter frames
974
975 bool CppInterpreter::contains(address pc) {
976 return false; // make frame::print_value_on work
977 }
978 #endif // CC_INTERP
|