annotate src/share/vm/graal/graalRuntime.hpp @ 19920:7366593c0610

Make the native initialization path for Graal more robust
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Mon, 16 Mar 2015 17:37:32 -0700
parents 9c2396ef02db
children 923c37b10fb4 1ab7802d35c9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5526
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
23
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5526
diff changeset
24 #ifndef SHARE_VM_GRAAL_GRAAL_RUNTIME_HPP
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5526
diff changeset
25 #define SHARE_VM_GRAAL_GRAAL_RUNTIME_HPP
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5526
diff changeset
26
7125
1baf7f1e3f23 decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
27 #include "interpreter/interpreter.hpp"
1baf7f1e3f23 decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
28 #include "memory/allocation.hpp"
1baf7f1e3f23 decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
29 #include "runtime/deoptimization.hpp"
1baf7f1e3f23 decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
30
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
31 class GraalRuntime: public CHeapObj<mtCompiler> {
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
32 private:
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
33
16006
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
34 static jobject _HotSpotGraalRuntime_instance;
16683
4d0d1dc5db00 introduce extra field to record when HotSpotGraalRuntime has been initialized to avoid spurious errors during VM shutdown for short lived applications
Doug Simon <doug.simon@oracle.com>
parents: 16628
diff changeset
35 static bool _HotSpotGraalRuntime_initialized;
16628
d3fec84757ed improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents: 16623
diff changeset
36 static const char* _generated_sources_sha1;
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
37
18303
ab47ef2f2207 disable blocking compilation requests once GraalRuntime::shutdown has been called
Doug Simon <doug.simon@oracle.com>
parents: 18227
diff changeset
38 static bool _shutdown_called;
ab47ef2f2207 disable blocking compilation requests once GraalRuntime::shutdown has been called
Doug Simon <doug.simon@oracle.com>
parents: 18227
diff changeset
39
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
40 /**
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
41 * Reads the OptionValue object from a specified static field.
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
42 *
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
43 * @throws LinkageError if the field could not be resolved
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
44 */
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
45 static Handle get_OptionValue(const char* declaringClass, const char* fieldName, const char* fieldSig, TRAPS);
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
46
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
47 /**
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
48 * Parses the string form of a numeric, float or double option into a jlong (using raw bits for floats/doubles).
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
49 *
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
50 * @param spec 'i', 'f' or 'd' (see HotSpotOptions.setOption())
16270
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
51 * @param name option name
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
52 * @param name_len length of option name
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
53 * @param value string value to parse
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
54 * @throws InternalError if value could not be parsed according to spec
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
55 */
16876
9d4c73b0646e graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16870
diff changeset
56 static jlong parse_primitive_option_value(char spec, const char* name, size_t name_len, const char* value, TRAPS);
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
57
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
58 /**
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
59 * Loads default option value overrides from a <jre_home>/lib/graal.options if it exists. Each
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
60 * line in this file must have the format of a Graal command line option without the
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
61 * leading "-G:" prefix. These option values are set prior to processing of any Graal
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
62 * options present on the command line.
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
63 */
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
64 static void parse_graal_options_file(KlassHandle hotSpotOptionsClass, TRAPS);
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
65
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
66 /**
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
67 * Parses a given argument and sets the denoted Graal option.
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
68 *
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
69 * @throws InternalError if there was a problem parsing or setting the option
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
70 */
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
71 static void parse_argument(KlassHandle hotSpotOptionsClass, char* arg, TRAPS);
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
72
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
73 /**
16870
11b22ccafccd Correctly parse string option values that start with + or -.
Roland Schatz <roland.schatz@oracle.com>
parents: 16683
diff changeset
74 * Searches for a Boolean Graal option denoted by a given name and sets it value.
11b22ccafccd Correctly parse string option values that start with + or -.
Roland Schatz <roland.schatz@oracle.com>
parents: 16683
diff changeset
75 *
11b22ccafccd Correctly parse string option values that start with + or -.
Roland Schatz <roland.schatz@oracle.com>
parents: 16683
diff changeset
76 * The definition of this method is in graalRuntime.inline.hpp
11b22ccafccd Correctly parse string option values that start with + or -.
Roland Schatz <roland.schatz@oracle.com>
parents: 16683
diff changeset
77 * which is generated by com.oracle.graal.hotspot.sourcegen.GenGraalRuntimeInlineHpp.
11b22ccafccd Correctly parse string option values that start with + or -.
Roland Schatz <roland.schatz@oracle.com>
parents: 16683
diff changeset
78 *
11b22ccafccd Correctly parse string option values that start with + or -.
Roland Schatz <roland.schatz@oracle.com>
parents: 16683
diff changeset
79 * @param hotSpotOptionsClass the HotSpotOptions klass or NULL if only checking for valid option
11b22ccafccd Correctly parse string option values that start with + or -.
Roland Schatz <roland.schatz@oracle.com>
parents: 16683
diff changeset
80 * @param name option name
11b22ccafccd Correctly parse string option values that start with + or -.
Roland Schatz <roland.schatz@oracle.com>
parents: 16683
diff changeset
81 * @param name_len length of option name
11b22ccafccd Correctly parse string option values that start with + or -.
Roland Schatz <roland.schatz@oracle.com>
parents: 16683
diff changeset
82 * @param value '+' to set the option, '-' to reset the option
11b22ccafccd Correctly parse string option values that start with + or -.
Roland Schatz <roland.schatz@oracle.com>
parents: 16683
diff changeset
83 * @returns true if the option was found
11b22ccafccd Correctly parse string option values that start with + or -.
Roland Schatz <roland.schatz@oracle.com>
parents: 16683
diff changeset
84 * @throws InternalError if there was a problem setting the option's value
11b22ccafccd Correctly parse string option values that start with + or -.
Roland Schatz <roland.schatz@oracle.com>
parents: 16683
diff changeset
85 */
16876
9d4c73b0646e graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16870
diff changeset
86 static bool set_option_bool(KlassHandle hotSpotOptionsClass, char* name, size_t name_len, char value, TRAPS);
16870
11b22ccafccd Correctly parse string option values that start with + or -.
Roland Schatz <roland.schatz@oracle.com>
parents: 16683
diff changeset
87
11b22ccafccd Correctly parse string option values that start with + or -.
Roland Schatz <roland.schatz@oracle.com>
parents: 16683
diff changeset
88 /**
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
89 * Searches for a Graal option denoted by a given name and sets it value.
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
90 *
15941
b35b1dc75ec0 added comments to explain the origin of generated sources
Doug Simon <doug.simon@oracle.com>
parents: 15916
diff changeset
91 * The definition of this method is in graalRuntime.inline.hpp
b35b1dc75ec0 added comments to explain the origin of generated sources
Doug Simon <doug.simon@oracle.com>
parents: 15916
diff changeset
92 * which is generated by com.oracle.graal.hotspot.sourcegen.GenGraalRuntimeInlineHpp.
b35b1dc75ec0 added comments to explain the origin of generated sources
Doug Simon <doug.simon@oracle.com>
parents: 15916
diff changeset
93 *
16270
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
94 * @param hotSpotOptionsClass the HotSpotOptions klass or NULL if only checking for valid option
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
95 * @param name option name
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
96 * @param name_len length of option name
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
97 * @returns true if the option was found
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
98 * @throws InternalError if there was a problem setting the option's value
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
99 */
16876
9d4c73b0646e graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16870
diff changeset
100 static bool set_option(KlassHandle hotSpotOptionsClass, char* name, size_t name_len, const char* value, TRAPS);
16270
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
101
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
102 /**
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
103 * Raises an InternalError for an option that expects a value but was specified without a "=<value>" prefix.
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
104 */
16876
9d4c73b0646e graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16870
diff changeset
105 static void check_required_value(const char* name, size_t name_len, const char* value, TRAPS);
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
106
15916
6aa352b260f4 removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents: 15870
diff changeset
107 /**
16006
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
108 * Java call to HotSpotOptions.setOption(String name, OptionValue<?> option, char spec, String stringValue, long primitiveValue)
16270
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
109 *
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
110 * @param name option name
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
111 * @param name_len length of option name
16006
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
112 */
16876
9d4c73b0646e graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16870
diff changeset
113 static void set_option_helper(KlassHandle hotSpotOptionsClass, char* name, size_t name_len, Handle option, jchar spec, Handle stringValue, jlong primitiveValue);
16006
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
114
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
115 /**
15941
b35b1dc75ec0 added comments to explain the origin of generated sources
Doug Simon <doug.simon@oracle.com>
parents: 15916
diff changeset
116 * Instantiates a service object, calls its default constructor and returns it.
15916
6aa352b260f4 removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents: 15870
diff changeset
117 *
6aa352b260f4 removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents: 15870
diff changeset
118 * @param name the name of a class implementing com.oracle.graal.api.runtime.Service
6aa352b260f4 removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents: 15870
diff changeset
119 */
6aa352b260f4 removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents: 15870
diff changeset
120 static Handle create_Service(const char* name, TRAPS);
6aa352b260f4 removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents: 15870
diff changeset
121
16628
d3fec84757ed improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents: 16623
diff changeset
122 /**
d3fec84757ed improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents: 16623
diff changeset
123 * Checks that _generated_sources_sha1 equals GeneratedSourcesSha1.value.
d3fec84757ed improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents: 16623
diff changeset
124 */
d3fec84757ed improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents: 16623
diff changeset
125 static void check_generated_sources_sha1(TRAPS);
d3fec84757ed improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents: 16623
diff changeset
126
7125
1baf7f1e3f23 decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
127 public:
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
128
18614
c307546c7b0a made initialization of the Graal class loader and well known Graal classes lazy
Doug Simon <doug.simon@oracle.com>
parents: 18303
diff changeset
129 /**
c307546c7b0a made initialization of the Graal class loader and well known Graal classes lazy
Doug Simon <doug.simon@oracle.com>
parents: 18303
diff changeset
130 * Ensures that the Graal class loader is initialized and the well known Graal classes are loaded.
c307546c7b0a made initialization of the Graal class loader and well known Graal classes lazy
Doug Simon <doug.simon@oracle.com>
parents: 18303
diff changeset
131 */
c307546c7b0a made initialization of the Graal class loader and well known Graal classes lazy
Doug Simon <doug.simon@oracle.com>
parents: 18303
diff changeset
132 static void ensure_graal_class_loader_is_initialized();
c307546c7b0a made initialization of the Graal class loader and well known Graal classes lazy
Doug Simon <doug.simon@oracle.com>
parents: 18303
diff changeset
133
15603
b7fb36e57da8 made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents: 15589
diff changeset
134 static void initialize_natives(JNIEnv *env, jclass c2vmClass);
15916
6aa352b260f4 removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents: 15870
diff changeset
135
16683
4d0d1dc5db00 introduce extra field to record when HotSpotGraalRuntime has been initialized to avoid spurious errors during VM shutdown for short lived applications
Doug Simon <doug.simon@oracle.com>
parents: 16628
diff changeset
136 static bool is_HotSpotGraalRuntime_initialized() { return _HotSpotGraalRuntime_initialized; }
16006
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
137
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
138 /**
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
139 * Gets the singleton HotSpotGraalRuntime instance, initializing it if necessary
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
140 */
19920
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
141 static Handle get_HotSpotGraalRuntime() {
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
142 initialize_Graal();
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
143 return Handle(JNIHandles::resolve_non_null(_HotSpotGraalRuntime_instance));
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
144 }
16006
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
145
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
146 static jobject get_HotSpotGraalRuntime_jobject() {
19920
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
147 initialize_Graal();
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
148 assert(_HotSpotGraalRuntime_initialized, "must be");
16006
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
149 return _HotSpotGraalRuntime_instance;
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
150 }
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
151
19920
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
152 static Handle callInitializer(const char* className, const char* methodName, const char* returnType);
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
153
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
154 /**
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
155 * Trigger initialization of HotSpotGraalRuntime through Graal.runtime()
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
156 */
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
157 static void initialize_Graal();
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
158
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
159 /**
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
160 * Explicitly initialize HotSpotGraalRuntime itself
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
161 */
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
162 static void initialize_HotSpotGraalRuntime();
7366593c0610 Make the native initialization path for Graal more robust
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19009
diff changeset
163
16006
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
164 static void shutdown();
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
165
18303
ab47ef2f2207 disable blocking compilation requests once GraalRuntime::shutdown has been called
Doug Simon <doug.simon@oracle.com>
parents: 18227
diff changeset
166 static bool shutdown_called() {
ab47ef2f2207 disable blocking compilation requests once GraalRuntime::shutdown has been called
Doug Simon <doug.simon@oracle.com>
parents: 18227
diff changeset
167 return _shutdown_called;
ab47ef2f2207 disable blocking compilation requests once GraalRuntime::shutdown has been called
Doug Simon <doug.simon@oracle.com>
parents: 18227
diff changeset
168 }
ab47ef2f2207 disable blocking compilation requests once GraalRuntime::shutdown has been called
Doug Simon <doug.simon@oracle.com>
parents: 18227
diff changeset
169
15941
b35b1dc75ec0 added comments to explain the origin of generated sources
Doug Simon <doug.simon@oracle.com>
parents: 15916
diff changeset
170 /**
b35b1dc75ec0 added comments to explain the origin of generated sources
Doug Simon <doug.simon@oracle.com>
parents: 15916
diff changeset
171 * Given an interface representing a Graal service (i.e. sub-interface of
b35b1dc75ec0 added comments to explain the origin of generated sources
Doug Simon <doug.simon@oracle.com>
parents: 15916
diff changeset
172 * com.oracle.graal.api.runtime.Service), gets an array of objects, one per
b35b1dc75ec0 added comments to explain the origin of generated sources
Doug Simon <doug.simon@oracle.com>
parents: 15916
diff changeset
173 * known implementation of the service.
b35b1dc75ec0 added comments to explain the origin of generated sources
Doug Simon <doug.simon@oracle.com>
parents: 15916
diff changeset
174 *
b35b1dc75ec0 added comments to explain the origin of generated sources
Doug Simon <doug.simon@oracle.com>
parents: 15916
diff changeset
175 * The definition of this method is in graalRuntime.inline.hpp
b35b1dc75ec0 added comments to explain the origin of generated sources
Doug Simon <doug.simon@oracle.com>
parents: 15916
diff changeset
176 * which is generated by com.oracle.graal.hotspot.sourcegen.GenGraalRuntimeInlineHpp.
b35b1dc75ec0 added comments to explain the origin of generated sources
Doug Simon <doug.simon@oracle.com>
parents: 15916
diff changeset
177 */
15916
6aa352b260f4 removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents: 15870
diff changeset
178 static Handle get_service_impls(KlassHandle serviceKlass, TRAPS);
6aa352b260f4 removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents: 15870
diff changeset
179
16006
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
180 /**
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
181 * Aborts the VM due to an unexpected exception.
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
182 */
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
183 static void abort_on_pending_exception(Handle exception, const char* message, bool dump_core = false);
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
184
16273
d6ffc6164830 handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents: 16270
diff changeset
185 /**
d6ffc6164830 handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents: 16270
diff changeset
186 * Calls Throwable.printStackTrace() on a given exception.
d6ffc6164830 handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents: 16270
diff changeset
187 */
d6ffc6164830 handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents: 16270
diff changeset
188 static void call_printStackTrace(Handle exception, Thread* thread);
d6ffc6164830 handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents: 16270
diff changeset
189
16428
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
190 #define CHECK_ABORT THREAD); \
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
191 if (HAS_PENDING_EXCEPTION) { \
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
192 char buf[256]; \
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
193 jio_snprintf(buf, 256, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
194 GraalRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
195 return; \
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
196 } \
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
197 (void)(0
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
198
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
199 #define CHECK_ABORT_(result) THREAD); \
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
200 if (HAS_PENDING_EXCEPTION) { \
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
201 char buf[256]; \
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
202 jio_snprintf(buf, 256, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
203 GraalRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
204 return result; \
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
205 } \
78ddecd6255f added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents: 16395
diff changeset
206 (void)(0
16006
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
207
16395
ad431bf0de07 added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents: 16273
diff changeset
208 /**
ad431bf0de07 added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents: 16273
diff changeset
209 * Same as SystemDictionary::resolve_or_null but uses the Graal loader.
ad431bf0de07 added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents: 16273
diff changeset
210 */
ad431bf0de07 added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents: 16273
diff changeset
211 static Klass* resolve_or_null(Symbol* name, TRAPS);
ad431bf0de07 added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents: 16273
diff changeset
212
ad431bf0de07 added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents: 16273
diff changeset
213 /**
ad431bf0de07 added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents: 16273
diff changeset
214 * Same as SystemDictionary::resolve_or_fail but uses the Graal loader.
ad431bf0de07 added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents: 16273
diff changeset
215 */
ad431bf0de07 added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents: 16273
diff changeset
216 static Klass* resolve_or_fail(Symbol* name, TRAPS);
ad431bf0de07 added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents: 16273
diff changeset
217
ad431bf0de07 added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents: 16273
diff changeset
218 /**
ad431bf0de07 added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents: 16273
diff changeset
219 * Loads a given Graal class and aborts the VM if it fails.
ad431bf0de07 added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents: 16273
diff changeset
220 */
16006
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
221 static Klass* load_required_class(Symbol* name);
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15941
diff changeset
222
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
223 static BufferBlob* initialize_buffer_blob();
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
224
16270
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
225 /**
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
226 * Checks that all Graal specific VM options presented by the launcher are recognized
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
227 * and formatted correctly. To set relevant Java fields from the option, parse_arguments()
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
228 * must be called. This method makes no Java calls apart from creating exception objects
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
229 * if there is an errors in the Graal options.
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
230 */
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
231 static jint check_arguments(TRAPS);
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
232
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
233 /**
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
234 * Parses the Graal specific VM options that were presented by the launcher and sets
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
235 * the relevants Java fields.
d56a09df1a1f implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
236 */
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
237 static bool parse_arguments(KlassHandle hotSpotOptionsClass, TRAPS);
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
238
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
239 static BasicType kindToBasicType(jchar ch);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
240
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
241 // The following routines are all called from compiled Graal code
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
242
9352
d4684b468e93 made NewInstanceStub a RuntimeStub that directly calls the C runtime (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9338
diff changeset
243 static void new_instance(JavaThread* thread, Klass* klass);
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: 9232
diff changeset
244 static void new_array(JavaThread* thread, Klass* klass, jint length);
9355
4e260c2ced0e removed new_multi_array assembler stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9354
diff changeset
245 static void new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims);
12423
370b5f07f9e2 The runtime entries need to use oopDesc* rather than oop in their signature
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10953
diff changeset
246 static void dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length);
13578
d8143c431d63 Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12435
diff changeset
247 static void dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror);
12423
370b5f07f9e2 The runtime entries need to use oopDesc* rather than oop in their signature
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10953
diff changeset
248 static jboolean thread_is_interrupted(JavaThread* thread, oopDesc* obj, jboolean clear_interrupted);
9471
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9463
diff changeset
249 static void vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3);
12423
370b5f07f9e2 The runtime entries need to use oopDesc* rather than oop in their signature
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10953
diff changeset
250 static jint identity_hash_code(JavaThread* thread, oopDesc* obj);
9471
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9463
diff changeset
251 static address exception_handler_for_pc(JavaThread* thread);
9590
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9581
diff changeset
252 static void monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock);
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9581
diff changeset
253 static void monitorexit (JavaThread* thread, oopDesc* obj, BasicLock* lock);
9591
0381c7937e7a replaced create_null_pointer_exception assembler stub with compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9590
diff changeset
254 static void create_null_exception(JavaThread* thread);
9592
efb8c1918ea5 replaced create_out_of_bounds_exception assembler stub with compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9591
diff changeset
255 static void create_out_of_bounds_exception(JavaThread* thread, jint index);
14731
0cb5c4d276d4 use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents: 13578
diff changeset
256 static void vm_error(JavaThread* thread, jlong where, jlong format, jlong value);
12423
370b5f07f9e2 The runtime entries need to use oopDesc* rather than oop in their signature
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10953
diff changeset
257 static oopDesc* load_and_clear_exception(JavaThread* thread);
370b5f07f9e2 The runtime entries need to use oopDesc* rather than oop in their signature
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10953
diff changeset
258 static void log_printf(JavaThread* thread, oopDesc* format, jlong v1, jlong v2, jlong v3);
9592
efb8c1918ea5 replaced create_out_of_bounds_exception assembler stub with compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9591
diff changeset
259 static void log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline);
9593
a3b4bcc22313 replaced log_* assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9592
diff changeset
260 // Note: Must be kept in sync with constants in com.oracle.graal.replacements.Log
a3b4bcc22313 replaced log_* assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9592
diff changeset
261 enum {
a3b4bcc22313 replaced log_* assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9592
diff changeset
262 LOG_OBJECT_NEWLINE = 0x01,
a3b4bcc22313 replaced log_* assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9592
diff changeset
263 LOG_OBJECT_STRING = 0x02,
a3b4bcc22313 replaced log_* assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9592
diff changeset
264 LOG_OBJECT_ADDRESS = 0x04
a3b4bcc22313 replaced log_* assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9592
diff changeset
265 };
12423
370b5f07f9e2 The runtime entries need to use oopDesc* rather than oop in their signature
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10953
diff changeset
266 static void log_object(JavaThread* thread, oopDesc* msg, jint flags);
10434
8b22524df53b Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10072
diff changeset
267 static void write_barrier_pre(JavaThread* thread, oopDesc* obj);
8b22524df53b Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10072
diff changeset
268 static void write_barrier_post(JavaThread* thread, void* card);
10953
97e282186b5b Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10770
diff changeset
269 static jboolean validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child);
12433
808348377021 Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10953
diff changeset
270 static void new_store_pre_barrier(JavaThread* thread);
18227
bcb1e5c232d8 Test deoptimization inside ForeignCallNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17033
diff changeset
271
bcb1e5c232d8 Test deoptimization inside ForeignCallNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17033
diff changeset
272 // Test only function
bcb1e5c232d8 Test deoptimization inside ForeignCallNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17033
diff changeset
273 static int test_deoptimize_call_int(JavaThread* thread, int value);
7125
1baf7f1e3f23 decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
274 };
1baf7f1e3f23 decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
275
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
276 // Tracing macros
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
277
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
278 #define IF_TRACE_graal_1 if (!(TraceGraal >= 1)) ; else
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
279 #define IF_TRACE_graal_2 if (!(TraceGraal >= 2)) ; else
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
280 #define IF_TRACE_graal_3 if (!(TraceGraal >= 3)) ; else
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
281 #define IF_TRACE_graal_4 if (!(TraceGraal >= 4)) ; else
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
282 #define IF_TRACE_graal_5 if (!(TraceGraal >= 5)) ; else
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
283
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
284 // using commas and else to keep one-instruction semantics
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
285
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
286 #define TRACE_graal_1 if (!(TraceGraal >= 1 && (tty->print("TraceGraal-1: "), true))) ; else tty->print_cr
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
287 #define TRACE_graal_2 if (!(TraceGraal >= 2 && (tty->print(" TraceGraal-2: "), true))) ; else tty->print_cr
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
288 #define TRACE_graal_3 if (!(TraceGraal >= 3 && (tty->print(" TraceGraal-3: "), true))) ; else tty->print_cr
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
289 #define TRACE_graal_4 if (!(TraceGraal >= 4 && (tty->print(" TraceGraal-4: "), true))) ; else tty->print_cr
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
290 #define TRACE_graal_5 if (!(TraceGraal >= 5 && (tty->print(" TraceGraal-5: "), true))) ; else tty->print_cr
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 14731
diff changeset
291
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5526
diff changeset
292 #endif // SHARE_VM_GRAAL_GRAAL_RUNTIME_HPP