Mercurial > hg > graal-compiler
annotate src/gpu/hsail/vm/hsailJavaCallArguments.hpp @ 14868:3efd4d8ace0b
Merge
author | Erik Eckstein <erik.eckstein@oracle.com> |
---|---|
date | Fri, 28 Mar 2014 09:05:22 +0100 |
parents | 3e9a960f0da1 |
children | 06eedda53e14 |
rev | line source |
---|---|
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 * |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 */ |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 #ifndef JAVACALL_ARGUMENTS_HSAIL_HPP |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 #define JAVACALL_ARGUMENTS_HSAIL_HPP |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 #include "hsailArgumentsBase.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 #include "runtime/javaCalls.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 class HSAILJavaCallArguments : public HSAILArgumentsBase { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 public: |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 private: |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 // JavaCall Args to push into |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 JavaCallArguments *_javaArgs; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 int _workitemid; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 public: |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 HSAILJavaCallArguments(JavaCallArguments *javaArgs, int workitemid, Symbol* signature, objArrayOop args, bool is_static) : HSAILArgumentsBase(signature, args, is_static) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 _javaArgs = javaArgs; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 _workitemid = workitemid; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 collectArgs(); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 virtual char *argsBuilderName() {return (char *)"HSAILJavaCallArguments";} |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 virtual void pushObject(void *obj) { _javaArgs->push_oop((oop) obj); } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 virtual void pushBool(jboolean z) { pushInt(z); } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 virtual void pushByte(jbyte b) { pushInt(b); } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 virtual void pushDouble(jdouble d) { _javaArgs->push_double(d); } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 virtual void pushFloat(jfloat f) { _javaArgs->push_float(f); } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 virtual void pushInt(jint i) { _javaArgs->push_int(i); } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 virtual void pushLong(jlong j) { _javaArgs->push_long(j); } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 virtual void pushTrailingArgs() { } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 // For javaCall the final int parameter gets replaced with the workitemid |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 // which was passed back in the deopt info |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 virtual void handleFinalIntParameter() { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 if (TraceGPUInteraction) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 tty->print_cr("[HSAIL] HSAILJavaCallArguments, passing workitemid %d as trailing int parameter", _workitemid); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 pushInt(_workitemid); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 // for kernel arguments, final obj parameter should be an object |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 // stream source array (already checked in the base class) so for |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 // a javacall we need to extract the correct obj from it based on |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 // the workitemid |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 virtual void handleFinalObjParameter(void *arg) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 objArrayOop objArrayArg = (objArrayOop) arg; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 oop extractedObj = objArrayArg->obj_at(_workitemid); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 if (TraceGPUInteraction) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 tty->print_cr("[HSAIL] HSAILJavaCallArguments, extracted obj #%d from array, 0x%08x is a %s", |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 _workitemid, (address) extractedObj, |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 (extractedObj == NULL ? "null" : extractedObj->klass()->external_name())); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 pushObject(extractedObj); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 }; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 #endif // JAVACALL_ARGUMENTS_HSAIL_HPP |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 |