changeset 3538:e4616e3d207b

support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 10 Aug 2011 18:19:09 +0200
parents c4f88f4ede54
children 6e806c373405
files src/cpu/x86/vm/c1_Runtime1_x86.cpp src/share/vm/c1/c1_Runtime1.hpp src/share/vm/graal/graalCodeInstaller.cpp src/share/vm/graal/graalJavaAccess.hpp
diffstat 4 files changed, 49 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Wed Aug 10 02:13:41 2011 +0200
+++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Wed Aug 10 18:19:09 2011 +0200
@@ -1052,6 +1052,12 @@
   thread->set_vm_result(Exceptions::new_exception(thread, vmSymbols::java_lang_NullPointerException(), NULL)());
 JRT_END
 
+JRT_ENTRY(void, graal_create_out_of_bounds_exception(JavaThread* thread, jint index))
+  char message[jintAsStringSize];
+  sprintf(message, "%d", index);
+  thread->set_vm_result(Exceptions::new_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message)());
+JRT_END
+
 
 
 
@@ -1915,6 +1921,28 @@
       break;
     }
 
+    case graal_create_null_pointer_exception_id: {
+		__ enter();
+		oop_maps = new OopMapSet();
+		OopMap* oop_map = save_live_registers(sasm, 0);
+		int call_offset = __ call_RT(rax, noreg, (address)graal_create_null_exception, 0);
+		oop_maps->add_gc_map(call_offset, oop_map);
+		__ leave();
+		__ ret(0);
+      break;
+    }
+
+    case graal_create_out_of_bounds_exception_id: {
+		__ enter();
+		oop_maps = new OopMapSet();
+		OopMap* oop_map = save_live_registers(sasm, 0);
+		int call_offset = __ call_RT(rax, noreg, (address)graal_create_out_of_bounds_exception, c_rarg0);
+		oop_maps->add_gc_map(call_offset, oop_map);
+		__ leave();
+		__ ret(0);
+      break;
+    }
+
     case graal_handle_exception_id: {
       StubFrame f(sasm, "graal_handle_exception", dont_gc_arguments);
       oop_maps = new OopMapSet();
--- a/src/share/vm/c1/c1_Runtime1.hpp	Wed Aug 10 02:13:41 2011 +0200
+++ b/src/share/vm/c1/c1_Runtime1.hpp	Wed Aug 10 18:19:09 2011 +0200
@@ -70,14 +70,16 @@
   stub(g1_post_barrier_slow)         \
   stub(fpu2long_stub)                \
   stub(counter_overflow)             \
-  stub(graal_unwind_exception_call)    \
-  stub(graal_handle_exception)         \
-  stub(graal_slow_subtype_check)       \
-  stub(graal_arithmetic_frem)          \
-  stub(graal_arithmetic_drem)          \
-  stub(graal_monitorenter)             \
-  stub(graal_monitorexit)              \
-  stub(graal_verify_pointer)           \
+  stub(graal_unwind_exception_call)  \
+  stub(graal_handle_exception)       \
+  stub(graal_slow_subtype_check)     \
+  stub(graal_arithmetic_frem)        \
+  stub(graal_arithmetic_drem)        \
+  stub(graal_monitorenter)           \
+  stub(graal_monitorexit)            \
+  stub(graal_verify_pointer)         \
+  stub(graal_create_null_pointer_exception) \
+  stub(graal_create_out_of_bounds_exception) \
   last_entry(number_of_ids)
 
 #define DECLARE_STUB_ID(x)       x ## _id ,
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Wed Aug 10 02:13:41 2011 +0200
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Wed Aug 10 18:19:09 2011 +0200
@@ -594,6 +594,14 @@
       call->set_destination(Runtime1::entry_for(Runtime1::graal_handle_exception_id));
       _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand);
       TRACE_graal_3("CiRuntimeCall::HandleException()");
+    } else if (runtime_call == CiRuntimeCall::CreateNullPointerException()) {
+      call->set_destination(Runtime1::entry_for(Runtime1::graal_create_null_pointer_exception_id));
+      _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand);
+      TRACE_graal_3("CiRuntimeCall::CreateNullPointerException()");
+    } else if (runtime_call == CiRuntimeCall::CreateOutOfBoundsException()) {
+      call->set_destination(Runtime1::entry_for(Runtime1::graal_create_out_of_bounds_exception_id));
+      _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand);
+      TRACE_graal_3("CiRuntimeCall::CreateOutOfBoundsException()");
     } else if (runtime_call == CiRuntimeCall::JavaTimeMillis()) {
       call->set_destination((address)os::javaTimeMillis);
       _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand);
@@ -658,6 +666,7 @@
       }
       case MARK_INVOKESTATIC: {
         assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic");
+
         call->set_destination(SharedRuntime::get_resolve_static_call_stub());
         _instructions->relocate(call->instruction_address(), relocInfo::static_call_type, Assembler::call32_operand);
         break;
--- a/src/share/vm/graal/graalJavaAccess.hpp	Wed Aug 10 02:13:41 2011 +0200
+++ b/src/share/vm/graal/graalJavaAccess.hpp	Wed Aug 10 18:19:09 2011 +0200
@@ -177,6 +177,8 @@
     static_oop_field(CiRuntimeCall, UnwindException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \
     static_oop_field(CiRuntimeCall, RegisterFinalizer, "Lcom/sun/cri/ci/CiRuntimeCall;"); \
     static_oop_field(CiRuntimeCall, HandleException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \
+    static_oop_field(CiRuntimeCall, CreateNullPointerException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \
+    static_oop_field(CiRuntimeCall, CreateOutOfBoundsException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \
     static_oop_field(CiRuntimeCall, OSRMigrationEnd, "Lcom/sun/cri/ci/CiRuntimeCall;"); \
     static_oop_field(CiRuntimeCall, JavaTimeMillis, "Lcom/sun/cri/ci/CiRuntimeCall;");  \
     static_oop_field(CiRuntimeCall, JavaTimeNanos, "Lcom/sun/cri/ci/CiRuntimeCall;");   \