annotate src/os/aix/vm/porting_aix.hpp @ 21947:9f70fc90169d

Truffle: remove expensive assertion
author Andreas Woess <andreas.woess@oracle.com>
date Wed, 17 Jun 2015 04:09:30 +0200
parents 666e6ce3976c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14415
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
1 /*
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
2 * Copyright 2012, 2013 SAP AG. All rights reserved.
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
4 *
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
7 * published by the Free Software Foundation.
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
8 *
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
13 * accompanied this code).
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
14 *
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
18 *
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
21 * questions.
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
22 *
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
23 */
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
24
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
25 #include <stddef.h>
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
26
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
27 // Header file to contain porting-relevant code which does not have a
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
28 // home anywhere else and which can not go into os_<platform>.h because
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
29 // that header is included inside the os class definition, hence all
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
30 // its content is part of the os class.
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
31
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
32 // Aix' own version of dladdr().
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
33 // This function tries to mimick dladdr(3) on Linux
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
34 // (see http://linux.die.net/man/3/dladdr)
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
35 // dladdr(3) is not POSIX but a GNU extension, and is not available on AIX.
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
36 //
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
37 // Differences between AIX dladdr and Linux dladdr:
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
38 //
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
39 // 1) Dl_info.dli_fbase: can never work, is disabled.
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
40 // A loaded image on AIX is divided in multiple segments, at least two
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
41 // (text and data) but potentially also far more. This is because the loader may
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
42 // load each member into an own segment, as for instance happens with the libC.a
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
43 // 2) Dl_info.dli_sname: This only works for code symbols (functions); for data, a
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
44 // zero-length string is returned ("").
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
45 // 3) Dl_info.dli_saddr: For code, this will return the entry point of the function,
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
46 // not the function descriptor.
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
47
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
48 typedef struct {
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
49 const char *dli_fname; // file path of loaded library
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
50 // void *dli_fbase;
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
51 const char *dli_sname; // symbol name; "" if not known
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
52 void *dli_saddr; // address of *entry* of function; not function descriptor;
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
53 } Dl_info;
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
54
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
55 // Note: we export this to use it inside J2se too
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
56 #ifdef __cplusplus
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
57 extern "C"
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
58 #endif
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
59 int dladdr(void *addr, Dl_info *info);
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
60
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
61
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
62 // The semantics in this file are thus that codeptr_t is a *real code ptr*.
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
63 // This means that any function taking codeptr_t as arguments will assume
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
64 // a real codeptr and won't handle function descriptors (eg getFuncName),
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
65 // whereas functions taking address as args will deal with function
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
66 // descriptors (eg os::dll_address_to_library_name).
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
67 typedef unsigned int* codeptr_t;
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
68
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
69 // helper function - given a program counter, tries to locate the traceback table and
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
70 // returns info from it (like, most importantly, function name, displacement of the
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
71 // pc inside the function, and the traceback table itself.
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
72 #ifdef __cplusplus
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
73 extern "C"
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
74 #endif
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
75 int getFuncName(
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
76 codeptr_t pc, // [in] program counter
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
77 char* p_name, size_t namelen, // [out] optional: user provided buffer for the function name
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
78 int* p_displacement, // [out] optional: displacement
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
79 const struct tbtable** p_tb, // [out] optional: ptr to traceback table to get further information
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
80 char* p_errmsg, size_t errmsglen // [out] optional: user provided buffer for error messages
666e6ce3976c 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
81 );