annotate src/share/vm/graal/graalJavaAccess.cpp @ 15264:29e3ba750c9e

graalCodeInstaller translate BytecodeFrame::BEFORE_BCI into SynchronizationEntryBCI
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 22 Apr 2014 15:12:38 +0200
parents 2c940b1a48d8
children 467ffc7f01cb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 5553
diff changeset
31 void compute_offset(int &dest_offset, Klass* klass, 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));
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
34 if (name_symbol == NULL || signature_symbol == NULL) {
9661
c6f3c1e48f54 better error message
Doug Simon <doug.simon@oracle.com>
parents: 9338
diff changeset
35 guarantee(false, err_msg("symbol with name %s and signature %s was not found in symbol table (klass=%s)", name, signature, klass->name()->as_C_string()));
5553
511612d1b5c1 Fix renamings in C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4181
diff changeset
36 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
37
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 5553
diff changeset
38 InstanceKlass* ik = InstanceKlass::cast(klass);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
39 fieldDescriptor fd;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
40 if (!ik->find_field(name_symbol, signature_symbol, &fd)) {
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
41 ResourceMark rm;
9669
ed6202820ecf renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9661
diff changeset
42 fatal(err_msg("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
43 }
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
44 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
45 dest_offset = fd.offset();
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
46 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
47
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
48 // 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
49
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 5553
diff changeset
50 #define START_CLASS(name) { Klass* 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
51
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
52 #define END_CLASS }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
53
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
54 #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
55 #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
56 #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
57 #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
58 #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
59 #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
60 #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
61 #define STATIC_OOP_FIELD(klass, name, signature) FIELD(klass, name, signature, true)
15264
29e3ba750c9e graalCodeInstaller translate BytecodeFrame::BEFORE_BCI into SynchronizationEntryBCI
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15161
diff changeset
62 #define STATIC_INT_FIELD(klass, name) FIELD(klass, name, "I", true)
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
63
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
64
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
65 void graal_compute_offsets() {
15264
29e3ba750c9e graalCodeInstaller translate BytecodeFrame::BEFORE_BCI into SynchronizationEntryBCI
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15161
diff changeset
66 COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, FLOAT_FIELD, OOP_FIELD, STATIC_OOP_FIELD, STATIC_INT_FIELD)
15161
2c940b1a48d8 Convert InstalledCode from an interface into an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10475
diff changeset
67 guarantee(InstalledCode::_address_offset == sizeof(oopDesc), "codeBlob must be first field!");
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
68 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
69
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
70 #define EMPTY0
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
71 #define EMPTY1(x)
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
72 #define EMPTY2(x,y)
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
73 #define FIELD2(klass, name) int klass::_##name##_offset = 0;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
74 #define FIELD3(klass, name, sig) FIELD2(klass, name)
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
75
15264
29e3ba750c9e graalCodeInstaller translate BytecodeFrame::BEFORE_BCI into SynchronizationEntryBCI
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15161
diff changeset
76 COMPILER_CLASSES_DO(EMPTY1, EMPTY0, FIELD2, FIELD2, FIELD2, FIELD2, FIELD2, FIELD3, FIELD3, FIELD2)
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
77
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
78
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
79
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