comparison src/gpu/hsail/vm/hsailKernelArguments.cpp @ 12783:89fbf495e589

HSAIL: fix some assert logic in the argument-gathering code that shows up in non-product builds Contributed-by: Tom Deneau <tom.deneau@amd.com> Summary: * computes parameter_count based on signature and uses that and parameter_index (set by the SignatureIterator) to tell if we are on the last parameter, which requires special handling whether it is an int or an object. * if signature says last parameter is an Object, checks that the real passed in parameter is an Object Array, but for non last-parameters, lets objects go thru. * if signature says last parameter is an int, nothing is pushed (no change to this logic)
author Doug Simon <doug.simon@oracle.com>
date Wed, 20 Nov 2013 01:11:10 +0100
parents f1a55428a8d7
children 51584f76462d
comparison
equal deleted inserted replaced
12782:92b7ec34ddfa 12783:89fbf495e589
91 } 91 }
92 92
93 void HSAILKernelArguments::do_int() { 93 void HSAILKernelArguments::do_int() {
94 // The last int is the iteration variable in an IntStream, but we don't pass it 94 // The last int is the iteration variable in an IntStream, but we don't pass it
95 // since we use the HSAIL workitemid in place of that int value 95 // since we use the HSAIL workitemid in place of that int value
96 if (_index == _length) { 96 if (_parameter_index == _parameter_count - 1) {
97 if (TraceGPUInteraction) { 97 if (TraceGPUInteraction) {
98 tty->print_cr("[HSAIL] HSAILKernelArguments::not pushing trailing int"); 98 tty->print_cr("[HSAIL] HSAILKernelArguments::not pushing trailing int");
99 } 99 }
100 return; 100 return;
101 } 101 }
134 assert(pushed == true, "arg push failed"); 134 assert(pushed == true, "arg push failed");
135 } 135 }
136 136
137 void HSAILKernelArguments::do_object() { 137 void HSAILKernelArguments::do_object() {
138 if (TraceGPUInteraction) { 138 if (TraceGPUInteraction) {
139 tty->print_cr("[HSAIL] HSAILKernelArguments::do_object."); 139 tty->print_cr("[HSAIL] HSAILKernelArguments::do_object, _parameter_index=%d", _parameter_index);
140 } 140 }
141 if (_index == _length) { 141 oop arg = _args->obj_at(_index++);
142 // last arg in object stream lambda is the object stream source array 142
143 // check if this is last arg in signature
144 // an object as last parameter requires an object stream source array to be passed
145 if (_parameter_index == _parameter_count - 1) {
143 if (TraceGPUInteraction) { 146 if (TraceGPUInteraction) {
144 tty->print_cr("[HSAIL] HSAILKernelArguments::trailing object ref should be object source array ref"); 147 tty->print_cr("[HSAIL] HSAILKernelArguments::trailing object ref should be object source array ref");
145 } 148 }
149 assert(arg->is_objArray(), "arg type mismatch");
146 } 150 }
147 151
148 oop arg = _args->obj_at(_index++);
149 assert(arg->is_array(), "arg type mismatch");
150 if (TraceGPUInteraction) { 152 if (TraceGPUInteraction) {
151 tty->print_cr("[HSAIL] HSAILKernelArguments::do_object, 0x%08x is a %s", (address) arg, arg->klass()->external_name()); 153 tty->print_cr("[HSAIL] HSAILKernelArguments::do_object, 0x%08x is a %s", (address) arg, arg->klass()->external_name());
152 } 154 }
153 155
154 bool pushed = gpu::Hsail::_okra_push_object(_kernel, arg); 156 bool pushed = gpu::Hsail::_okra_push_object(_kernel, arg);
155 assert(pushed == true, "arg push failed"); 157 assert(pushed == true, "arg push failed");
156 } 158 }
157 159
158 void HSAILKernelArguments::do_object(int begin, int end) { 160 void HSAILKernelArguments::do_object(int begin, int end) {
159 if (TraceGPUInteraction) { 161 if (TraceGPUInteraction) {
160 tty->print_cr("[HSAIL] HSAILKernelArguments::do_object(int begin, int end)."); 162 tty->print_cr("[HSAIL] HSAILKernelArguments::do_object(int begin, int end), begin=%d, end=%d.", begin, end);
161 } 163 }
162 164 do_object();
163 if ((!_is_static && (_index >=(_length-1))) || (_is_static && (_index >=(_length)))) {
164 // last arg in object stream lambda is the object stream source array
165 if (TraceGPUInteraction) {
166 tty->print_cr("[HSAIL] HSAILKernelArguments::trailing object ref should be object source array ref");
167 }
168 }
169
170 oop arg = _args->obj_at(_index++);
171 assert(arg->is_array(), "arg type mismatch");
172 if (TraceGPUInteraction) {
173 tty->print_cr("[HSAIL] HSAILKernelArguments::do_object(int, int), 0x%08x is a %s", (address) arg, arg->klass()->external_name());
174 }
175
176 bool pushed = gpu::Hsail::_okra_push_object(_kernel, arg);
177 assert(pushed == true, "arg push failed");
178 } 165 }
179 166
180 void HSAILKernelArguments::do_void() { 167 void HSAILKernelArguments::do_void() {
181 return; 168 return;
182 } 169 }