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