12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25
26 #ifndef OS_AIX_VM_MISC_AIX_HPP
27 #define OS_AIX_VM_MISC_AIX_HPP
28
29 // misc_aix.hpp, misc_aix.cpp: convenience functions needed for the OpenJDK AIX
30 // port.
31 #include "utilities/globalDefinitions.hpp"
32
33 #include <pthread.h>
34
35 // Trace if verbose to tty.
36 #define trcVerbose(fmt, ...) { \
37 if (Verbose) { \
38 fprintf(stderr, fmt, ##__VA_ARGS__); \
39 fputc('\n', stderr); fflush(stderr); \
40 } \
41 }
42 #define ERRBYE(s) { trcVerbose(s); return -1; }
43 #define trc(fmt, ...)
44
45 #define assert0(b) assert((b), "")
46 #define guarantee0(b) guarantee((b), "")
47 template <class T1, class T2> bool is_aligned_to(T1 what, T2 alignment) {
48 return (((uintx)(what)) & (((uintx)(alignment)) - 1)) == 0 ? true : false;
49 }
50
51 // CritSect: simple critical section implementation using pthread mutexes.
77 };
78
79 class AutoCritSect {
80 CritSect* const _pcsobj;
81 public:
82 AutoCritSect(CritSect* pcsobj)
83 : _pcsobj(pcsobj)
84 {
85 _pcsobj->enter();
86 }
87 ~AutoCritSect() {
88 _pcsobj->leave();
89 }
90 };
91
92 // Returns true if pointer can be dereferenced without triggering a segment
93 // violation. Returns false if pointer is invalid.
94 // Note: Depends on stub routines; prior to stub routine generation, will
95 // always return true. Use CanUseSafeFetch32 to handle this case.
96 bool is_readable_pointer(const void* p);
97
98 }
99
100 #endif // OS_AIX_VM_MISC_AIX_HPP
101
|
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25
26 #ifndef OS_AIX_VM_MISC_AIX_HPP
27 #define OS_AIX_VM_MISC_AIX_HPP
28
29 // misc_aix.hpp, misc_aix.cpp: convenience functions needed for the OpenJDK AIX
30 // port.
31 #include "utilities/globalDefinitions.hpp"
32 #include "runtime/globals.hpp"
33 #include "utilities/debug.hpp"
34
35 #include <pthread.h>
36
37 // Trace if verbose to tty.
38 #define trcVerbose(fmt, ...) { \
39 if (Verbose) { \
40 fprintf(stderr, fmt, ##__VA_ARGS__); \
41 fputc('\n', stderr); fflush(stderr); \
42 } \
43 }
44 #define ERRBYE(s) { trcVerbose(s); return -1; }
45 #define trc(fmt, ...)
46
47 #define assert0(b) assert((b), "")
48 #define guarantee0(b) guarantee((b), "")
49 template <class T1, class T2> bool is_aligned_to(T1 what, T2 alignment) {
50 return (((uintx)(what)) & (((uintx)(alignment)) - 1)) == 0 ? true : false;
51 }
52
53 // CritSect: simple critical section implementation using pthread mutexes.
79 };
80
81 class AutoCritSect {
82 CritSect* const _pcsobj;
83 public:
84 AutoCritSect(CritSect* pcsobj)
85 : _pcsobj(pcsobj)
86 {
87 _pcsobj->enter();
88 }
89 ~AutoCritSect() {
90 _pcsobj->leave();
91 }
92 };
93
94 // Returns true if pointer can be dereferenced without triggering a segment
95 // violation. Returns false if pointer is invalid.
96 // Note: Depends on stub routines; prior to stub routine generation, will
97 // always return true. Use CanUseSafeFetch32 to handle this case.
98 bool is_readable_pointer(const void* p);
99
100 const char* describe_errno(int err_no);
101
102 void sleep_ms(int milliseconds);
103
104 }
105
106 #endif // OS_AIX_VM_MISC_AIX_HPP
107
|