Mercurial > hg > truffle
annotate src/share/vm/graal/graalJavaAccess.cpp @ 5318:b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
author | Christian Wimmer <Christian.Wimmer@Oracle.com> |
---|---|
date | Fri, 27 Apr 2012 12:56:39 -0700 |
parents | 319860ae697a |
children | 511612d1b5c1 |
rev | line source |
---|---|
2516
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
1 /* |
4181
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
3706
diff
changeset
|
2 * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. |
2516
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
4 * |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
7 * published by the Free Software Foundation. |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
8 * |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
13 * accompanied this code). |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
14 * |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
18 * |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
21 * questions. |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
22 */ |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
23 |
2045
9c96c873c42b
Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1435
diff
changeset
|
24 #include "precompiled.hpp" |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
25 #include "graal/graalJavaAccess.hpp" |
2663
d7c0775d7e72
added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents:
2516
diff
changeset
|
26 #include "runtime/jniHandles.hpp" |
d7c0775d7e72
added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents:
2516
diff
changeset
|
27 #include "classfile/symbolTable.hpp" |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
28 // This function is similar to javaClasses.cpp, it computes the field offset of a (static or instance) field. |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
29 // It looks up the name and signature symbols without creating new ones, all the symbols of these classes need to be already loaded. |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
30 |
3706
a59727158259
hide HotSpotMethodResolvedImpl.javaMirror field in debuggers
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
31 void compute_offset(int &dest_offset, klassOop klass_oop, const char* name, const char* signature, bool static_field) { |
2215
999f8086cc4f
More changes to make it compile and work on win64.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2182
diff
changeset
|
32 Symbol* name_symbol = SymbolTable::probe(name, (int)strlen(name)); |
999f8086cc4f
More changes to make it compile and work on win64.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2182
diff
changeset
|
33 Symbol* signature_symbol = SymbolTable::probe(signature, (int)strlen(signature)); |
4181
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
3706
diff
changeset
|
34 #ifndef PRODUCT |
1435
20a3896518ac
Initial adjustments to make C1X4HotSpot compile and run with latest Maxine version.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
35 if (name_symbol == NULL) { |
20a3896518ac
Initial adjustments to make C1X4HotSpot compile and run with latest Maxine version.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
36 tty->print_cr("symbol with name %s was not found in symbol table (klass=%s)", name, klass_oop->klass_part()->name()->as_C_string()); |
20a3896518ac
Initial adjustments to make C1X4HotSpot compile and run with latest Maxine version.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
37 } |
20a3896518ac
Initial adjustments to make C1X4HotSpot compile and run with latest Maxine version.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
38 #endif |
4181
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
3706
diff
changeset
|
39 guarantee(name_symbol != NULL, "symbol not found - class layout changed?"); |
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
3706
diff
changeset
|
40 guarantee(signature_symbol != NULL, "symbol not found - class layout changed?"); |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
41 |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
42 instanceKlass* ik = instanceKlass::cast(klass_oop); |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
43 fieldDescriptor fd; |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
44 if (!ik->find_field(name_symbol, signature_symbol, &fd)) { |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
45 ResourceMark rm; |
2045
9c96c873c42b
Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1435
diff
changeset
|
46 tty->print_cr("Invalid layout of %s at %s", name_symbol->as_C_string(), ik->external_name()); |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
47 fatal("Invalid layout of preloaded class"); |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
48 } |
4181
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
3706
diff
changeset
|
49 guarantee(fd.is_static() == static_field, "static/instance mismatch"); |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
50 dest_offset = fd.offset(); |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
51 } |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
52 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
53 // This piece of macro magic creates the contents of the graal_compute_offsets method that initializes the field indices of all the access classes. |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
54 |
2282
0309d394eb5f
Added support for non-null oop values in scope objects (allocating global handle).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2215
diff
changeset
|
55 #define START_CLASS(name) { klassOop k = SystemDictionary::name##_klass(); assert(k != NULL, "Could not find class " #name ""); |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
56 |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
57 #define END_CLASS } |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
58 |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
59 #define FIELD(klass, name, signature, static_field) compute_offset(klass::_##name##_offset, k, #name, signature, static_field); |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
60 #define CHAR_FIELD(klass, name) FIELD(klass, name, "C", false) |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
61 #define INT_FIELD(klass, name) FIELD(klass, name, "I", false) |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
62 #define BOOLEAN_FIELD(klass, name) FIELD(klass, name, "Z", false) |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
63 #define LONG_FIELD(klass, name) FIELD(klass, name, "J", false) |
2926
0e3ec0a4eda4
RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents:
2891
diff
changeset
|
64 #define FLOAT_FIELD(klass, name) FIELD(klass, name, "F", false) |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
65 #define OOP_FIELD(klass, name, signature) FIELD(klass, name, signature, false) |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
66 #define STATIC_OOP_FIELD(klass, name, signature) FIELD(klass, name, signature, true) |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
67 |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
68 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
69 void graal_compute_offsets() { |
2926
0e3ec0a4eda4
RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents:
2891
diff
changeset
|
70 COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, FLOAT_FIELD, OOP_FIELD, STATIC_OOP_FIELD) |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
71 } |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
72 |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
73 #define EMPTY0 |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
74 #define EMPTY1(x) |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
75 #define EMPTY2(x,y) |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
76 #define FIELD2(klass, name) int klass::_##name##_offset = 0; |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
77 #define FIELD3(klass, name, sig) FIELD2(klass, name) |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
78 |
2926
0e3ec0a4eda4
RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents:
2891
diff
changeset
|
79 COMPILER_CLASSES_DO(EMPTY1, EMPTY0, FIELD2, FIELD2, FIELD2, FIELD2, FIELD2, FIELD3, FIELD3) |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
80 |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
81 |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
82 |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
83 |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
84 |