462 enum YieldResult {
463 YIELD_SWITCHED = 1, // caller descheduled, other ready threads exist & ran
464 YIELD_NONEREADY = 0, // No other runnable/ready threads.
465 // platform-specific yield return immediately
466 YIELD_UNKNOWN = -1 // Unknown: platform doesn't support _SWITCHED or _NONEREADY
467 // YIELD_SWITCHED and YIELD_NONREADY imply the platform supports a "strong"
468 // yield that can be used in lieu of blocking.
469 } ;
470 static YieldResult NakedYield () ;
471 static void yield_all(int attempts = 0); // Yields to all other threads including lower priority
472 static void loop_breaker(int attempts); // called from within tight loops to possibly influence time-sharing
473 static OSReturn set_priority(Thread* thread, ThreadPriority priority);
474 static OSReturn get_priority(const Thread* const thread, ThreadPriority& priority);
475
476 static void interrupt(Thread* thread);
477 static bool is_interrupted(Thread* thread, bool clear_interrupted);
478
479 static int pd_self_suspend_thread(Thread* thread);
480
481 static ExtendedPC fetch_frame_from_context(void* ucVoid, intptr_t** sp, intptr_t** fp);
482 static frame fetch_frame_from_context(void* ucVoid);
483
484 static ExtendedPC get_thread_pc(Thread *thread);
485 static void breakpoint();
486
487 static address current_stack_pointer();
488 static address current_stack_base();
489 static size_t current_stack_size();
490
491 static void verify_stack_alignment() PRODUCT_RETURN;
492
493 static int message_box(const char* title, const char* message);
494 static char* do_you_want_to_debug(const char* message);
495
496 // run cmd in a separate process and return its exit code; or -1 on failures
497 static int fork_and_exec(char *cmd);
498
499 // os::exit() is merged with vm_exit()
500 // static void exit(int num);
501
502 // Terminate the VM, but don't exit the process
603 static int get_last_error();
604
605 // Determines whether the calling process is being debugged by a user-mode debugger.
606 static bool is_debugger_attached();
607
608 // wait for a key press if PauseAtExit is set
609 static void wait_for_keypress_at_exit(void);
610
611 // The following two functions are used by fatal error handler to trace
612 // native (C) frames. They are not part of frame.hpp/frame.cpp because
613 // frame.hpp/cpp assume thread is JavaThread, and also because different
614 // OS/compiler may have different convention or provide different API to
615 // walk C frames.
616 //
617 // We don't attempt to become a debugger, so we only follow frames if that
618 // does not require a lookup in the unwind table, which is part of the binary
619 // file but may be unsafe to read after a fatal error. So on x86, we can
620 // only walk stack if %ebp is used as frame pointer; on ia64, it's not
621 // possible to walk C stack without having the unwind table.
622 static bool is_first_C_frame(frame *fr);
623 static frame get_sender_for_C_frame(frame *fr);
624
625 // return current frame. pc() and sp() are set to NULL on failure.
626 static frame current_frame();
627
628 static void print_hex_dump(outputStream* st, address start, address end, int unitsize);
629
630 // returns a string to describe the exception/signal;
631 // returns NULL if exception_code is not an OS exception/signal.
632 static const char* exception_name(int exception_code, char* buf, size_t buflen);
633
634 // Returns native Java library, loads if necessary
635 static void* native_java_library();
636
637 // Fills in path to jvm.dll/libjvm.so (used by the Disassembler)
638 static void jvm_path(char *buf, jint buflen);
639
640 // Returns true if we are running in a headless jre.
641 static bool is_headless_jre();
642
643 // JNI names
|
462 enum YieldResult {
463 YIELD_SWITCHED = 1, // caller descheduled, other ready threads exist & ran
464 YIELD_NONEREADY = 0, // No other runnable/ready threads.
465 // platform-specific yield return immediately
466 YIELD_UNKNOWN = -1 // Unknown: platform doesn't support _SWITCHED or _NONEREADY
467 // YIELD_SWITCHED and YIELD_NONREADY imply the platform supports a "strong"
468 // yield that can be used in lieu of blocking.
469 } ;
470 static YieldResult NakedYield () ;
471 static void yield_all(int attempts = 0); // Yields to all other threads including lower priority
472 static void loop_breaker(int attempts); // called from within tight loops to possibly influence time-sharing
473 static OSReturn set_priority(Thread* thread, ThreadPriority priority);
474 static OSReturn get_priority(const Thread* const thread, ThreadPriority& priority);
475
476 static void interrupt(Thread* thread);
477 static bool is_interrupted(Thread* thread, bool clear_interrupted);
478
479 static int pd_self_suspend_thread(Thread* thread);
480
481 static ExtendedPC fetch_frame_from_context(void* ucVoid, intptr_t** sp, intptr_t** fp);
482 static frame fetch_frame_from_context(Thread* thread, void* ucVoid);
483
484 static ExtendedPC get_thread_pc(Thread *thread);
485 static void breakpoint();
486
487 static address current_stack_pointer();
488 static address current_stack_base();
489 static size_t current_stack_size();
490
491 static void verify_stack_alignment() PRODUCT_RETURN;
492
493 static int message_box(const char* title, const char* message);
494 static char* do_you_want_to_debug(const char* message);
495
496 // run cmd in a separate process and return its exit code; or -1 on failures
497 static int fork_and_exec(char *cmd);
498
499 // os::exit() is merged with vm_exit()
500 // static void exit(int num);
501
502 // Terminate the VM, but don't exit the process
603 static int get_last_error();
604
605 // Determines whether the calling process is being debugged by a user-mode debugger.
606 static bool is_debugger_attached();
607
608 // wait for a key press if PauseAtExit is set
609 static void wait_for_keypress_at_exit(void);
610
611 // The following two functions are used by fatal error handler to trace
612 // native (C) frames. They are not part of frame.hpp/frame.cpp because
613 // frame.hpp/cpp assume thread is JavaThread, and also because different
614 // OS/compiler may have different convention or provide different API to
615 // walk C frames.
616 //
617 // We don't attempt to become a debugger, so we only follow frames if that
618 // does not require a lookup in the unwind table, which is part of the binary
619 // file but may be unsafe to read after a fatal error. So on x86, we can
620 // only walk stack if %ebp is used as frame pointer; on ia64, it's not
621 // possible to walk C stack without having the unwind table.
622 static bool is_first_C_frame(frame *fr);
623 static frame get_sender_for_C_frame(Thread* thread, frame *fr);
624
625 // return current frame. pc() and sp() are set to NULL on failure.
626 static frame current_frame();
627
628 static void print_hex_dump(outputStream* st, address start, address end, int unitsize);
629
630 // returns a string to describe the exception/signal;
631 // returns NULL if exception_code is not an OS exception/signal.
632 static const char* exception_name(int exception_code, char* buf, size_t buflen);
633
634 // Returns native Java library, loads if necessary
635 static void* native_java_library();
636
637 // Fills in path to jvm.dll/libjvm.so (used by the Disassembler)
638 static void jvm_path(char *buf, jint buflen);
639
640 // Returns true if we are running in a headless jre.
641 static bool is_headless_jre();
642
643 // JNI names
|