43 #include "mutex_aix.inline.hpp"
44 #include "oops/oop.inline.hpp"
45 #include "os_share_aix.hpp"
46 #include "porting_aix.hpp"
47 #include "prims/jniFastGetField.hpp"
48 #include "prims/jvm.h"
49 #include "prims/jvm_misc.hpp"
50 #include "runtime/arguments.hpp"
51 #include "runtime/extendedPC.hpp"
52 #include "runtime/globals.hpp"
53 #include "runtime/interfaceSupport.hpp"
54 #include "runtime/java.hpp"
55 #include "runtime/javaCalls.hpp"
56 #include "runtime/mutexLocker.hpp"
57 #include "runtime/objectMonitor.hpp"
58 #include "runtime/osThread.hpp"
59 #include "runtime/perfMemory.hpp"
60 #include "runtime/sharedRuntime.hpp"
61 #include "runtime/statSampler.hpp"
62 #include "runtime/stubRoutines.hpp"
63 #include "runtime/threadCritical.hpp"
64 #include "runtime/thread.inline.hpp"
65 #include "runtime/timer.hpp"
66 #include "services/attachListener.hpp"
67 #include "services/runtimeService.hpp"
68 #include "utilities/decoder.hpp"
69 #include "utilities/defaultStream.hpp"
70 #include "utilities/events.hpp"
71 #include "utilities/growableArray.hpp"
72 #include "utilities/vmError.hpp"
73 #ifdef TARGET_ARCH_ppc
74 # include "assembler_ppc.inline.hpp"
75 # include "nativeInst_ppc.hpp"
76 #endif
77 #ifdef COMPILER1
78 #include "c1/c1_Runtime1.hpp"
79 #endif
80 #ifdef COMPILER2
81 #include "opto/runtime.hpp"
82 #endif
83
84 // put OS-includes here (sorted alphabetically)
85 #include <errno.h>
86 #include <fcntl.h>
87 #include <inttypes.h>
88 #include <poll.h>
89 #include <procinfo.h>
90 #include <pthread.h>
91 #include <pwd.h>
92 #include <semaphore.h>
93 #include <signal.h>
94 #include <stdint.h>
95 #include <stdio.h>
96 #include <string.h>
97 #include <unistd.h>
98 #include <sys/ioctl.h>
99 #include <sys/ipc.h>
100 #include <sys/mman.h>
101 #include <sys/resource.h>
102 #include <sys/select.h>
361
362 // Retrieve information about multipage size support. Will initialize
363 // Aix::_page_size, Aix::_stack_page_size, Aix::_can_use_64K_pages,
364 // Aix::_can_use_16M_pages.
365 // Must be called before calling os::large_page_init().
366 void os::Aix::query_multipage_support() {
367
368 guarantee(_page_size == -1 &&
369 _stack_page_size == -1 &&
370 _can_use_64K_pages == -1 &&
371 _can_use_16M_pages == -1 &&
372 g_multipage_error == -1,
373 "do not call twice");
374
375 _page_size = ::sysconf(_SC_PAGESIZE);
376
377 // This really would surprise me.
378 assert(_page_size == SIZE_4K, "surprise!");
379
380
381 // query default data page size (default page size for C-Heap, pthread stacks and .bss).
382 // Default data page size is influenced either by linker options (-bdatapsize)
383 // or by environment variable LDR_CNTRL (suboption DATAPSIZE). If none is given,
384 // default should be 4K.
385 size_t data_page_size = SIZE_4K;
386 {
387 void* p = ::malloc(SIZE_16M);
388 data_page_size = os::Aix::query_pagesize(p);
389 ::free(p);
390 }
391
392 // query default shm page size (LDR_CNTRL SHMPSIZE)
393 {
394 const int shmid = ::shmget(IPC_PRIVATE, 1, IPC_CREAT | S_IRUSR | S_IWUSR);
395 guarantee(shmid != -1, "shmget failed");
396 void* p = ::shmat(shmid, NULL, 0);
397 ::shmctl(shmid, IPC_RMID, NULL);
398 guarantee(p != (void*) -1, "shmat failed");
399 _shm_default_page_size = os::Aix::query_pagesize(p);
400 ::shmdt(p);
401 }
402
403 // before querying the stack page size, make sure we are not running as primordial
404 // thread (because primordial thread's stack may have different page size than
405 // pthread thread stacks). Running a VM on the primordial thread won't work for a
406 // number of reasons so we may just as well guarantee it here
407 guarantee(!os::Aix::is_primordial_thread(), "Must not be called for primordial thread");
494 guarantee(_page_size != -1 &&
495 _stack_page_size != -1 &&
496 _can_use_64K_pages != -1 &&
497 _can_use_16M_pages != -1, "Page sizes not properly initialized");
498
499 if (_can_use_64K_pages) {
500 g_multipage_error = 0;
501 }
502
503 if (Verbose) {
504 fprintf(stderr, "Data page size (C-Heap, bss, etc): %s\n", describe_pagesize(data_page_size));
505 fprintf(stderr, "Thread stack page size (pthread): %s\n", describe_pagesize(_stack_page_size));
506 fprintf(stderr, "Default shared memory page size: %s\n", describe_pagesize(_shm_default_page_size));
507 fprintf(stderr, "Can use 64K pages dynamically with shared meory: %s\n", (_can_use_64K_pages ? "yes" :"no"));
508 fprintf(stderr, "Can use 16M pages dynamically with shared memory: %s\n", (_can_use_16M_pages ? "yes" :"no"));
509 fprintf(stderr, "Multipage error details: %d\n", g_multipage_error);
510 }
511
512 } // end os::Aix::query_multipage_support()
513
514
515 // The code for this method was initially derived from the version in os_linux.cpp
516 void os::init_system_properties_values() {
517 // The next few definitions allow the code to be verbatim:
518 #define malloc(n) (char*)NEW_C_HEAP_ARRAY(char, (n), mtInternal)
519 #define DEFAULT_LIBPATH "/usr/lib:/lib"
520 #define EXTENSIONS_DIR "/lib/ext"
521 #define ENDORSED_DIR "/lib/endorsed"
522
523 // sysclasspath, java_home, dll_dir
524 char *home_path;
525 char *dll_path;
526 char *pslash;
527 char buf[MAXPATHLEN];
528 os::jvm_path(buf, sizeof(buf));
529
530 // Found the full path to libjvm.so.
531 // Now cut the path to <java_home>/jre if we can.
532 *(strrchr(buf, '/')) = '\0'; // get rid of /libjvm.so
533 pslash = strrchr(buf, '/');
534 if (pslash != NULL) {
535 *pslash = '\0'; // get rid of /{client|server|hotspot}
536 }
537
538 dll_path = malloc(strlen(buf) + 1);
539 strcpy(dll_path, buf);
540 Arguments::set_dll_dir(dll_path);
541
542 if (pslash != NULL) {
543 pslash = strrchr(buf, '/');
544 if (pslash != NULL) {
545 *pslash = '\0'; // get rid of /<arch>
546 pslash = strrchr(buf, '/');
547 if (pslash != NULL) {
548 *pslash = '\0'; // get rid of /lib
549 }
550 }
551 }
552
553 home_path = malloc(strlen(buf) + 1);
554 strcpy(home_path, buf);
555 Arguments::set_java_home(home_path);
556
557 if (!set_boot_path('/', ':')) return;
558
559 // Where to look for native libraries
560
561 // On Aix we get the user setting of LIBPATH
562 // Eventually, all the library path setting will be done here.
563 char *ld_library_path;
564
565 // Construct the invariant part of ld_library_path.
566 ld_library_path = (char *) malloc(sizeof(DEFAULT_LIBPATH));
567 sprintf(ld_library_path, DEFAULT_LIBPATH);
568
569 // Get the user setting of LIBPATH, and prepended it.
570 char *v = ::getenv("LIBPATH");
571 if (v == NULL) {
572 v = "";
573 }
574
575 char *t = ld_library_path;
576 // That's +1 for the colon and +1 for the trailing '\0'
577 ld_library_path = (char *) malloc(strlen(v) + 1 + strlen(t) + 1);
578 sprintf(ld_library_path, "%s:%s", v, t);
579
580 Arguments::set_library_path(ld_library_path);
581
582 // Extensions directories
583 char* cbuf = malloc(strlen(Arguments::get_java_home()) + sizeof(EXTENSIONS_DIR));
584 sprintf(cbuf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
585 Arguments::set_ext_dirs(cbuf);
586
587 // Endorsed standards default directory.
588 cbuf = malloc(strlen(Arguments::get_java_home()) + sizeof(ENDORSED_DIR));
589 sprintf(cbuf, "%s" ENDORSED_DIR, Arguments::get_java_home());
590 Arguments::set_endorsed_dirs(cbuf);
591
592 #undef malloc
593 #undef DEFAULT_LIBPATH
594 #undef EXTENSIONS_DIR
595 #undef ENDORSED_DIR
596 }
597
598 ////////////////////////////////////////////////////////////////////////////////
599 // breakpoint support
600
601 void os::breakpoint() {
602 BREAKPOINT;
603 }
604
605 extern "C" void breakpoint() {
606 // use debugger to set breakpoint here
607 }
608
609 ////////////////////////////////////////////////////////////////////////////////
610 // signal support
611
612 debug_only(static bool signal_sets_initialized = false);
|
43 #include "mutex_aix.inline.hpp"
44 #include "oops/oop.inline.hpp"
45 #include "os_share_aix.hpp"
46 #include "porting_aix.hpp"
47 #include "prims/jniFastGetField.hpp"
48 #include "prims/jvm.h"
49 #include "prims/jvm_misc.hpp"
50 #include "runtime/arguments.hpp"
51 #include "runtime/extendedPC.hpp"
52 #include "runtime/globals.hpp"
53 #include "runtime/interfaceSupport.hpp"
54 #include "runtime/java.hpp"
55 #include "runtime/javaCalls.hpp"
56 #include "runtime/mutexLocker.hpp"
57 #include "runtime/objectMonitor.hpp"
58 #include "runtime/osThread.hpp"
59 #include "runtime/perfMemory.hpp"
60 #include "runtime/sharedRuntime.hpp"
61 #include "runtime/statSampler.hpp"
62 #include "runtime/stubRoutines.hpp"
63 #include "runtime/thread.inline.hpp"
64 #include "runtime/threadCritical.hpp"
65 #include "runtime/timer.hpp"
66 #include "services/attachListener.hpp"
67 #include "services/runtimeService.hpp"
68 #include "utilities/decoder.hpp"
69 #include "utilities/defaultStream.hpp"
70 #include "utilities/events.hpp"
71 #include "utilities/growableArray.hpp"
72 #include "utilities/vmError.hpp"
73
74 // put OS-includes here (sorted alphabetically)
75 #include <errno.h>
76 #include <fcntl.h>
77 #include <inttypes.h>
78 #include <poll.h>
79 #include <procinfo.h>
80 #include <pthread.h>
81 #include <pwd.h>
82 #include <semaphore.h>
83 #include <signal.h>
84 #include <stdint.h>
85 #include <stdio.h>
86 #include <string.h>
87 #include <unistd.h>
88 #include <sys/ioctl.h>
89 #include <sys/ipc.h>
90 #include <sys/mman.h>
91 #include <sys/resource.h>
92 #include <sys/select.h>
351
352 // Retrieve information about multipage size support. Will initialize
353 // Aix::_page_size, Aix::_stack_page_size, Aix::_can_use_64K_pages,
354 // Aix::_can_use_16M_pages.
355 // Must be called before calling os::large_page_init().
356 void os::Aix::query_multipage_support() {
357
358 guarantee(_page_size == -1 &&
359 _stack_page_size == -1 &&
360 _can_use_64K_pages == -1 &&
361 _can_use_16M_pages == -1 &&
362 g_multipage_error == -1,
363 "do not call twice");
364
365 _page_size = ::sysconf(_SC_PAGESIZE);
366
367 // This really would surprise me.
368 assert(_page_size == SIZE_4K, "surprise!");
369
370
371 // Query default data page size (default page size for C-Heap, pthread stacks and .bss).
372 // Default data page size is influenced either by linker options (-bdatapsize)
373 // or by environment variable LDR_CNTRL (suboption DATAPSIZE). If none is given,
374 // default should be 4K.
375 size_t data_page_size = SIZE_4K;
376 {
377 void* p = ::malloc(SIZE_16M);
378 guarantee(p != NULL, "malloc failed");
379 data_page_size = os::Aix::query_pagesize(p);
380 ::free(p);
381 }
382
383 // query default shm page size (LDR_CNTRL SHMPSIZE)
384 {
385 const int shmid = ::shmget(IPC_PRIVATE, 1, IPC_CREAT | S_IRUSR | S_IWUSR);
386 guarantee(shmid != -1, "shmget failed");
387 void* p = ::shmat(shmid, NULL, 0);
388 ::shmctl(shmid, IPC_RMID, NULL);
389 guarantee(p != (void*) -1, "shmat failed");
390 _shm_default_page_size = os::Aix::query_pagesize(p);
391 ::shmdt(p);
392 }
393
394 // before querying the stack page size, make sure we are not running as primordial
395 // thread (because primordial thread's stack may have different page size than
396 // pthread thread stacks). Running a VM on the primordial thread won't work for a
397 // number of reasons so we may just as well guarantee it here
398 guarantee(!os::Aix::is_primordial_thread(), "Must not be called for primordial thread");
485 guarantee(_page_size != -1 &&
486 _stack_page_size != -1 &&
487 _can_use_64K_pages != -1 &&
488 _can_use_16M_pages != -1, "Page sizes not properly initialized");
489
490 if (_can_use_64K_pages) {
491 g_multipage_error = 0;
492 }
493
494 if (Verbose) {
495 fprintf(stderr, "Data page size (C-Heap, bss, etc): %s\n", describe_pagesize(data_page_size));
496 fprintf(stderr, "Thread stack page size (pthread): %s\n", describe_pagesize(_stack_page_size));
497 fprintf(stderr, "Default shared memory page size: %s\n", describe_pagesize(_shm_default_page_size));
498 fprintf(stderr, "Can use 64K pages dynamically with shared meory: %s\n", (_can_use_64K_pages ? "yes" :"no"));
499 fprintf(stderr, "Can use 16M pages dynamically with shared memory: %s\n", (_can_use_16M_pages ? "yes" :"no"));
500 fprintf(stderr, "Multipage error details: %d\n", g_multipage_error);
501 }
502
503 } // end os::Aix::query_multipage_support()
504
505 // The code for this method was initially derived from the version in os_linux.cpp.
506 void os::init_system_properties_values() {
507
508 #define DEFAULT_LIBPATH "/usr/lib:/lib"
509 #define EXTENSIONS_DIR "/lib/ext"
510 #define ENDORSED_DIR "/lib/endorsed"
511
512 // sysclasspath, java_home, dll_dir
513 {
514 char *pslash;
515 char buf[MAXPATHLEN];
516 os::jvm_path(buf, sizeof(buf));
517
518 // Found the full path to libjvm.so.
519 // Now cut the path to <java_home>/jre if we can.
520 *(strrchr(buf, '/')) = '\0'; // Get rid of /libjvm.so.
521 pslash = strrchr(buf, '/');
522 if (pslash != NULL) {
523 *pslash = '\0'; // Get rid of /{client|server|hotspot}.
524 }
525 Arguments::set_dll_dir(buf);
526
527 if (pslash != NULL) {
528 pslash = strrchr(buf, '/');
529 if (pslash != NULL) {
530 *pslash = '\0'; // Get rid of /<arch>.
531 pslash = strrchr(buf, '/');
532 if (pslash != NULL) {
533 *pslash = '\0'; // Get rid of /lib.
534 }
535 }
536 }
537 Arguments::set_java_home(buf);
538
539 if (!set_boot_path('/', ':')) {
540 return;
541 }
542 }
543
544 // Where to look for native libraries.
545
546 // On Aix we get the user setting of LIBPATH.
547 // Eventually, all the library path setting will be done here.
548 // Get the user setting of LIBPATH.
549 char *v = ::getenv("LIBPATH");
550 if (v == NULL) {
551 v = "";
552 }
553
554 // Concatenate user and invariant part of ld_library_path.
555 // That's +1 for the colon and +1 for the trailing '\0'.
556 char *ld_library_path = (char *)NEW_C_HEAP_ARRAY(char, strlen(v) + 1 + sizeof(DEFAULT_LIBPATH) + 1, mtInternal);
557 sprintf(ld_library_path, "%s:%s", v, DEFAULT_LIBPATH);
558 Arguments::set_library_path(ld_library_path);
559 FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
560
561 // Buffer that fits both sprintfs.
562 // Note that the space for the colon and the trailing null are provided
563 // by the nulls included by the sizeof operator (so actually one byte more
564 // than necessary is allocated).
565 char buf[MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(ENDORSED_DIR)];
566
567 // Extensions directories.
568 sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
569 Arguments::set_ext_dirs(buf);
570
571 // Endorsed standards default directory.
572 sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
573 Arguments::set_endorsed_dirs(buf);
574
575 #undef DEFAULT_LIBPATH
576 #undef EXTENSIONS_DIR
577 #undef ENDORSED_DIR
578 }
579
580 ////////////////////////////////////////////////////////////////////////////////
581 // breakpoint support
582
583 void os::breakpoint() {
584 BREAKPOINT;
585 }
586
587 extern "C" void breakpoint() {
588 // use debugger to set breakpoint here
589 }
590
591 ////////////////////////////////////////////////////////////////////////////////
592 // signal support
593
594 debug_only(static bool signal_sets_initialized = false);
|