378 static void set_memory_serialize_page(address page);
379
380 static address get_memory_serialize_page() {
381 return (address)_mem_serialize_page;
382 }
383
384 static inline void write_memory_serialize_page(JavaThread *thread) {
385 uintptr_t page_offset = ((uintptr_t)thread >>
386 get_serialize_page_shift_count()) &
387 get_serialize_page_mask();
388 *(volatile int32_t *)((uintptr_t)_mem_serialize_page+page_offset) = 1;
389 }
390
391 static bool is_memory_serialize_page(JavaThread *thread, address addr) {
392 if (UseMembar) return false;
393 // Previously this function calculated the exact address of this
394 // thread's serialize page, and checked if the faulting address
395 // was equal. However, some platforms mask off faulting addresses
396 // to the page size, so now we just check that the address is
397 // within the page. This makes the thread argument unnecessary,
398 // but we retain the NULL check to preserve existing behaviour.
399 if (thread == NULL) return false;
400 address page = (address) _mem_serialize_page;
401 return addr >= page && addr < (page + os::vm_page_size());
402 }
403
404 static void block_on_serialize_page_trap();
405
406 // threads
407
408 enum ThreadType {
409 vm_thread,
410 cgc_thread, // Concurrent GC thread
411 pgc_thread, // Parallel GC thread
412 java_thread,
413 compiler_thread,
414 watcher_thread,
415 os_thread
416 };
417
418 static bool create_thread(Thread* thread,
523 // Symbol lookup, find nearest function name; basically it implements
524 // dladdr() for all platforms. Name of the nearest function is copied
525 // to buf. Distance from its base address is optionally returned as offset.
526 // If function name is not found, buf[0] is set to '\0' and offset is
527 // set to -1 (if offset is non-NULL).
528 static bool dll_address_to_function_name(address addr, char* buf,
529 int buflen, int* offset);
530
531 // Locate DLL/DSO. On success, full path of the library is copied to
532 // buf, and offset is optionally set to be the distance between addr
533 // and the library's base address. On failure, buf[0] is set to '\0'
534 // and offset is set to -1 (if offset is non-NULL).
535 static bool dll_address_to_library_name(address addr, char* buf,
536 int buflen, int* offset);
537
538 // Find out whether the pc is in the static code for jvm.dll/libjvm.so.
539 static bool address_is_in_vm(address addr);
540
541 // Loads .dll/.so and
542 // in case of error it checks if .dll/.so was built for the
543 // same architecture as Hotspot is running on
544 static void* dll_load(const char *name, char *ebuf, int ebuflen);
545
546 // lookup symbol in a shared library
547 static void* dll_lookup(void* handle, const char* name);
548
549 // Unload library
550 static void dll_unload(void *lib);
551
552 // Return the handle of this process
553 static void* get_default_process_handle();
554
555 // Check for static linked agent library
556 static bool find_builtin_agent(AgentLibrary *agent_lib, const char *syms[],
557 size_t syms_len);
558
559 // Find agent entry point
560 static void *find_agent_function(AgentLibrary *agent_lib, bool check_lib,
561 const char *syms[], size_t syms_len);
562
563 // Print out system information; they are called by fatal error handler.
|
378 static void set_memory_serialize_page(address page);
379
380 static address get_memory_serialize_page() {
381 return (address)_mem_serialize_page;
382 }
383
384 static inline void write_memory_serialize_page(JavaThread *thread) {
385 uintptr_t page_offset = ((uintptr_t)thread >>
386 get_serialize_page_shift_count()) &
387 get_serialize_page_mask();
388 *(volatile int32_t *)((uintptr_t)_mem_serialize_page+page_offset) = 1;
389 }
390
391 static bool is_memory_serialize_page(JavaThread *thread, address addr) {
392 if (UseMembar) return false;
393 // Previously this function calculated the exact address of this
394 // thread's serialize page, and checked if the faulting address
395 // was equal. However, some platforms mask off faulting addresses
396 // to the page size, so now we just check that the address is
397 // within the page. This makes the thread argument unnecessary,
398 // but we retain the NULL check to preserve existing behavior.
399 if (thread == NULL) return false;
400 address page = (address) _mem_serialize_page;
401 return addr >= page && addr < (page + os::vm_page_size());
402 }
403
404 static void block_on_serialize_page_trap();
405
406 // threads
407
408 enum ThreadType {
409 vm_thread,
410 cgc_thread, // Concurrent GC thread
411 pgc_thread, // Parallel GC thread
412 java_thread,
413 compiler_thread,
414 watcher_thread,
415 os_thread
416 };
417
418 static bool create_thread(Thread* thread,
523 // Symbol lookup, find nearest function name; basically it implements
524 // dladdr() for all platforms. Name of the nearest function is copied
525 // to buf. Distance from its base address is optionally returned as offset.
526 // If function name is not found, buf[0] is set to '\0' and offset is
527 // set to -1 (if offset is non-NULL).
528 static bool dll_address_to_function_name(address addr, char* buf,
529 int buflen, int* offset);
530
531 // Locate DLL/DSO. On success, full path of the library is copied to
532 // buf, and offset is optionally set to be the distance between addr
533 // and the library's base address. On failure, buf[0] is set to '\0'
534 // and offset is set to -1 (if offset is non-NULL).
535 static bool dll_address_to_library_name(address addr, char* buf,
536 int buflen, int* offset);
537
538 // Find out whether the pc is in the static code for jvm.dll/libjvm.so.
539 static bool address_is_in_vm(address addr);
540
541 // Loads .dll/.so and
542 // in case of error it checks if .dll/.so was built for the
543 // same architecture as HotSpot is running on
544 static void* dll_load(const char *name, char *ebuf, int ebuflen);
545
546 // lookup symbol in a shared library
547 static void* dll_lookup(void* handle, const char* name);
548
549 // Unload library
550 static void dll_unload(void *lib);
551
552 // Return the handle of this process
553 static void* get_default_process_handle();
554
555 // Check for static linked agent library
556 static bool find_builtin_agent(AgentLibrary *agent_lib, const char *syms[],
557 size_t syms_len);
558
559 // Find agent entry point
560 static void *find_agent_function(AgentLibrary *agent_lib, bool check_lib,
561 const char *syms[], size_t syms_len);
562
563 // Print out system information; they are called by fatal error handler.
|