コード例 #1
0
void InterpreterStubs::generate_interpreter_throw_exceptions() {
  Segment seg(this, code_segment, "Interpreter exception throwers");

  bind_global("interpreter_throw_ArrayIndexOutOfBoundsException");
  interpreter_call_vm("array_index_out_of_bounds_exception", T_ILLEGAL);

  bind_global("interpreter_throw_NullPointerException_tos_cached");
  push(tos);
  bind_global("interpreter_throw_NullPointerException");
  interpreter_call_vm("null_pointer_exception", T_ILLEGAL);

  bind_global("interpreter_throw_IncompatibleClassChangeError");
  interpreter_call_vm("incompatible_class_change_error", T_ILLEGAL);
}
コード例 #2
0
void InterpreterStubs::generate_interpreter_timer_tick() {
  comment_section("Interpreter call timer_tick");
  entry("interpreter_timer_tick");
  interpreter_call_vm(Constant("timer_tick"), T_VOID);
  dispatch_next();
  entry_end(); // interpreter_timer_tick

#if ENABLE_PAGE_PROTECTION
  stop_code_segment();
  start_data_segment();
  if (GenerateGNUCode || GenerateInlineAsm) {
    align(PROTECTED_PAGE_SIZE);
    define_array_begin("unsigned char", "_protected_page");
    for (int i = 0; i < PROTECTED_PAGE_SIZE; i++) {
      define_byte_element(Constant(0));
    }
    define_array_end();
  } else {
    // MASM doesn't allow 4096-byte alignment,
    // so surround the protected area with 4K padding.
    // This will certainly add 8K of static footprint,
    // but who cares about the size of win32_i386 binary!
    define_byte(Constant(0), PROTECTED_PAGE_SIZE);
    define_long(Constant(0), PROTECTED_PAGE_SIZE / BytesPerWord,
                "_protected_page");
    define_byte(Constant(0), PROTECTED_PAGE_SIZE);
  }
  stop_data_segment();
  start_code_segment();
#endif
}
コード例 #3
0
void InterpreterStubs::generate_interpreter_rethrow_exception() {
  comment_section("Interpreter rethrow exception");
  comment("Register eax holds the exception; Interpreter state is not in registers");

  entry("interpreter_rethrow_exception");
  comment("Restore bytecode and locals pointers");
  movl(esi, Address(ebp, Constant(JavaFrame::bcp_store_offset())));
  movl(edi, Address(ebp, Constant(JavaFrame::locals_pointer_offset())));

  comment("Mark the bytecode pointer as being inside an exception");
  addl(esi, Constant(JavaFrame::exception_frame_flag));

  comment("Clear the expression stack");
  movl(esp, Address(ebp, Constant(JavaFrame::stack_bottom_pointer_offset())));
  
  comment("Push the exception on the expression stack");
  push_obj(eax);

  comment("Get exception handler bci for exception");
  interpreter_call_vm(Constant("exception_handler_bci_for_exception"), T_INT);
  
  comment("Check if we got a bci - otherwise unwind the activation");
  cmpl(eax, Constant(-1));
  jcc(equal, Constant("interpreter_unwind_activation"));
#if ENABLE_JAVA_DEBUGGER
  Label skip;
  cmpb(Address(Constant("_debugger_active")), Constant(0));
  jcc(equal, Constant(skip));
  movl(edx, eax);
  interpreter_call_vm(Constant("handle_caught_exception"), T_VOID);
  comment("Re-get exception handler bci for exception");
  interpreter_call_vm(Constant("exception_handler_bci_for_exception"), T_INT);
  bind(skip);
#endif
  comment("Convert the bytecode index into a bytecode pointer");
  movl(ecx, Address(ebp, Constant(JavaFrame::method_offset())));
  leal(esi, Address(ecx, eax, times_1, Constant(Method::base_offset())));

  // Dispatch to the exception handler.
  dispatch_next();

  entry_end(); // interpreter_rethrow_exception
}
コード例 #4
0
void InterpreterStubs::generate_interpreter_timer_tick() {
  Segment seg(this, code_segment, "Interpreter call timer_tick");
  bind("interpreter_timer_tick");
  restore_stack_state_from(tos_interpreter_basic);
  set_stack_state_to(tos_on_stack);
  interpreter_call_vm("timer_tick", T_VOID);
  prefetch(0);
  restore_stack_state_from(tos_on_stack);
  set_stack_state_to(tos_interpreter_basic);
  dispatch(tos_interpreter_basic);
}
コード例 #5
0
void InterpreterStubs::generate_interpreter_throw_exceptions() {
  comment_section("Interpreter exception throwers");

  entry("interpreter_throw_ArrayIndexOutOfBoundsException", 0);
  interpreter_call_vm(Constant("array_index_out_of_bounds_exception"), T_VOID);
  entry_end(); // interpreter_throw_ArrayIndexOutOfBoundsException

  entry("interpreter_throw_NullPointerException", 0);
  interpreter_call_vm(Constant("null_pointer_exception"), T_VOID);
  entry_end(); // interpreter_throw_NullPointerException

  entry("interpreter_throw_IllegalMonitorStateException", 0);
  interpreter_call_vm(Constant("illegal_monitor_state_exception"), T_VOID);
  entry_end(); // interpreter_throw_IllegalMonitorStateException

  entry("interpreter_throw_ArithmeticException", 0);
  interpreter_call_vm(Constant("arithmetic_exception"), T_VOID);
  entry_end(); // interpreter_throw_ArithmeticException

  entry("interpreter_throw_IncompatibleClassChangeError", 0);
  interpreter_call_vm(Constant("incompatible_class_change_error"), T_VOID);
  entry_end(); // interpreter_throw_IncompatibleClassChangeError

  if (GenerateDebugAssembly) {
    entry("interpreter_throw_InternalStackTagException", 0);
    interpreter_call_vm(Constant("internal_stack_tag_exception"), T_VOID);
    entry_end(); // interpreter_throw_InternalStackTagException
  }
}
コード例 #6
0
void InterpreterStubs::generate_interpreter_rethrow_exception_init() {
  comment_section("Interpreter rethrow exception init");
  comment("Register eax holds the exception; Interpreter state is not in registers");
  entry("interpreter_rethrow_exception_init");
#if ENABLE_JAVA_DEBUGGER
  Label skip;
  cmpb(Address(Constant("_debugger_active")), Constant(0));
  jcc(equal, Constant(skip));
  comment("push the exception object so we don't nuke it");
  push_obj(eax);
  comment("call debugger code to store relevant info about where exception happened");
  interpreter_call_vm(Constant("handle_exception_info"), T_VOID);
  pop_obj(eax, edx);
  bind(skip);
#endif
  if (GenerateInlineAsm)
      jmp(Constant("interpreter_rethrow_exception_init"));
  else
      comment("fall through to rethrow_exception"); // IMPL_NOTE: FALLTHROUGH

  entry_end(); // interpreter_rethrow_exception_init
}