Mercurial > hg > truffle
comparison src/share/vm/graal/graalCompilerToVM.cpp @ 13306:dfb780080923
moved most CompilerToVM.getLocalVariableTable to Java
author | twisti |
---|---|
date | Thu, 12 Dec 2013 14:56:52 -0800 |
parents | a63d65b682a8 |
children | 5a4293f24642 |
comparison
equal
deleted
inserted
replaced
13305:a63d65b682a8 | 13306:dfb780080923 |
---|---|
782 } | 782 } |
783 | 783 |
784 return result; | 784 return result; |
785 C2V_END | 785 C2V_END |
786 | 786 |
787 C2V_VMENTRY(jobject, getLocalVariableTable, (JNIEnv *, jobject, jobject hotspot_method)) | 787 C2V_VMENTRY(jlong, getLocalVariableTableStart, (JNIEnv *, jobject, jobject hotspot_method)) |
788 ResourceMark rm; | 788 ResourceMark rm; |
789 | |
790 Method* method = getMethodFromHotSpotMethod(JNIHandles::resolve(hotspot_method)); | 789 Method* method = getMethodFromHotSpotMethod(JNIHandles::resolve(hotspot_method)); |
791 if (!method->has_localvariable_table()) { | 790 if (!method->has_localvariable_table()) { |
792 return NULL; | 791 return 0; |
793 } | 792 } |
794 int localvariable_table_length = method->localvariable_table_length(); | 793 return (jlong) (address) method->localvariable_table_start(); |
795 | 794 C2V_END |
796 objArrayHandle local_array = oopFactory::new_objArray(SystemDictionary::LocalImpl_klass(), localvariable_table_length, CHECK_NULL); | 795 |
797 LocalVariableTableElement* table = method->localvariable_table_start(); | 796 C2V_VMENTRY(jint, getLocalVariableTableLength, (JNIEnv *, jobject, jobject hotspot_method)) |
798 for (int i = 0; i < localvariable_table_length; i++) { | 797 ResourceMark rm; |
799 u2 start_bci = table[i].start_bci; | 798 Method* method = getMethodFromHotSpotMethod(JNIHandles::resolve(hotspot_method)); |
800 u4 end_bci = (u4)(start_bci + table[i].length); | 799 return method->localvariable_table_length(); |
801 u2 nameCPIdx = table[i].name_cp_index; | 800 C2V_END |
802 u2 typeCPIdx = table[i].descriptor_cp_index; | |
803 u2 slot = table[i].slot; | |
804 | |
805 char* name = method->constants()->symbol_at(nameCPIdx)->as_C_string(); | |
806 Handle nameHandle = java_lang_String::create_from_str(name, CHECK_NULL); | |
807 | |
808 char* typeInfo = method->constants()->symbol_at(typeCPIdx)->as_C_string(); | |
809 Handle typeHandle = java_lang_String::create_from_str(typeInfo, CHECK_NULL); | |
810 | |
811 Handle holderHandle = GraalCompiler::createHotSpotResolvedObjectType(method, CHECK_0); | |
812 Handle local = VMToCompiler::createLocal(nameHandle, typeHandle, (int) start_bci, (int) end_bci, (int) slot, holderHandle, Thread::current()); | |
813 local_array->obj_at_put(i, local()); | |
814 } | |
815 | |
816 return JNIHandles::make_local(local_array()); | |
817 C2V_END | |
818 | |
819 | 801 |
820 C2V_VMENTRY(void, reprofile, (JNIEnv *env, jobject, jlong metaspace_method)) | 802 C2V_VMENTRY(void, reprofile, (JNIEnv *env, jobject, jlong metaspace_method)) |
821 Method* method = asMethod(metaspace_method); | 803 Method* method = asMethod(metaspace_method); |
822 MethodCounters* mcs = method->method_counters(); | 804 MethodCounters* mcs = method->method_counters(); |
823 if (mcs != NULL) { | 805 if (mcs != NULL) { |
880 #define FIELD "Lcom/oracle/graal/api/meta/JavaField;" | 862 #define FIELD "Lcom/oracle/graal/api/meta/JavaField;" |
881 #define SIGNATURE "Lcom/oracle/graal/api/meta/Signature;" | 863 #define SIGNATURE "Lcom/oracle/graal/api/meta/Signature;" |
882 #define CONSTANT_POOL "Lcom/oracle/graal/api/meta/ConstantPool;" | 864 #define CONSTANT_POOL "Lcom/oracle/graal/api/meta/ConstantPool;" |
883 #define CONSTANT "Lcom/oracle/graal/api/meta/Constant;" | 865 #define CONSTANT "Lcom/oracle/graal/api/meta/Constant;" |
884 #define KIND "Lcom/oracle/graal/api/meta/Kind;" | 866 #define KIND "Lcom/oracle/graal/api/meta/Kind;" |
885 #define LOCAL "Lcom/oracle/graal/api/meta/Local;" | |
886 #define RUNTIME_CALL "Lcom/oracle/graal/api/code/RuntimeCall;" | 867 #define RUNTIME_CALL "Lcom/oracle/graal/api/code/RuntimeCall;" |
887 #define REFLECT_METHOD "Ljava/lang/reflect/Method;" | 868 #define REFLECT_METHOD "Ljava/lang/reflect/Method;" |
888 #define REFLECT_CONSTRUCTOR "Ljava/lang/reflect/Constructor;" | 869 #define REFLECT_CONSTRUCTOR "Ljava/lang/reflect/Constructor;" |
889 #define STRING "Ljava/lang/String;" | 870 #define STRING "Ljava/lang/String;" |
890 #define OBJECT "Ljava/lang/Object;" | 871 #define OBJECT "Ljava/lang/Object;" |
930 {CC"resetCompilationStatistics", CC"()V", FN_PTR(resetCompilationStatistics)}, | 911 {CC"resetCompilationStatistics", CC"()V", FN_PTR(resetCompilationStatistics)}, |
931 {CC"disassembleCodeBlob", CC"(J)"STRING, FN_PTR(disassembleCodeBlob)}, | 912 {CC"disassembleCodeBlob", CC"(J)"STRING, FN_PTR(disassembleCodeBlob)}, |
932 {CC"executeCompiledMethodVarargs", CC"(["OBJECT HS_INSTALLED_CODE")"OBJECT, FN_PTR(executeCompiledMethodVarargs)}, | 913 {CC"executeCompiledMethodVarargs", CC"(["OBJECT HS_INSTALLED_CODE")"OBJECT, FN_PTR(executeCompiledMethodVarargs)}, |
933 {CC"getDeoptedLeafGraphIds", CC"()[J", FN_PTR(getDeoptedLeafGraphIds)}, | 914 {CC"getDeoptedLeafGraphIds", CC"()[J", FN_PTR(getDeoptedLeafGraphIds)}, |
934 {CC"getLineNumberTable", CC"("HS_RESOLVED_METHOD")[J", FN_PTR(getLineNumberTable)}, | 915 {CC"getLineNumberTable", CC"("HS_RESOLVED_METHOD")[J", FN_PTR(getLineNumberTable)}, |
935 {CC"getLocalVariableTable", CC"("HS_RESOLVED_METHOD")["LOCAL, FN_PTR(getLocalVariableTable)}, | 916 {CC"getLocalVariableTableStart", CC"("HS_RESOLVED_METHOD")J", FN_PTR(getLocalVariableTableStart)}, |
917 {CC"getLocalVariableTableLength", CC"("HS_RESOLVED_METHOD")I", FN_PTR(getLocalVariableTableLength)}, | |
936 {CC"reprofile", CC"("METASPACE_METHOD")V", FN_PTR(reprofile)}, | 918 {CC"reprofile", CC"("METASPACE_METHOD")V", FN_PTR(reprofile)}, |
937 {CC"invalidateInstalledCode", CC"("HS_INSTALLED_CODE")V", FN_PTR(invalidateInstalledCode)}, | 919 {CC"invalidateInstalledCode", CC"("HS_INSTALLED_CODE")V", FN_PTR(invalidateInstalledCode)}, |
938 {CC"readUnsafeUncompressedPointer", CC"("OBJECT"J)"OBJECT, FN_PTR(readUnsafeUncompressedPointer)}, | 920 {CC"readUnsafeUncompressedPointer", CC"("OBJECT"J)"OBJECT, FN_PTR(readUnsafeUncompressedPointer)}, |
939 {CC"readUnsafeKlassPointer", CC"("OBJECT")J", FN_PTR(readUnsafeKlassPointer)}, | 921 {CC"readUnsafeKlassPointer", CC"("OBJECT")J", FN_PTR(readUnsafeKlassPointer)}, |
940 {CC"collectCounters", CC"()[J", FN_PTR(collectCounters)}, | 922 {CC"collectCounters", CC"()[J", FN_PTR(collectCounters)}, |