1 /* |
1 /* |
2 * Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 1999-2010 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
332 |
332 |
333 // Implementation of Invoke |
333 // Implementation of Invoke |
334 |
334 |
335 |
335 |
336 Invoke::Invoke(Bytecodes::Code code, ValueType* result_type, Value recv, Values* args, |
336 Invoke::Invoke(Bytecodes::Code code, ValueType* result_type, Value recv, Values* args, |
337 int vtable_index, ciMethod* target) |
337 int vtable_index, ciMethod* target, ValueStack* state_before) |
338 : StateSplit(result_type) |
338 : StateSplit(result_type) |
339 , _code(code) |
339 , _code(code) |
340 , _recv(recv) |
340 , _recv(recv) |
341 , _args(args) |
341 , _args(args) |
342 , _vtable_index(vtable_index) |
342 , _vtable_index(vtable_index) |
343 , _target(target) |
343 , _target(target) |
|
344 , _state_before(state_before) |
344 { |
345 { |
345 set_flag(TargetIsLoadedFlag, target->is_loaded()); |
346 set_flag(TargetIsLoadedFlag, target->is_loaded()); |
346 set_flag(TargetIsFinalFlag, target_is_loaded() && target->is_final_method()); |
347 set_flag(TargetIsFinalFlag, target_is_loaded() && target->is_final_method()); |
347 set_flag(TargetIsStrictfpFlag, target_is_loaded() && target->is_strict()); |
348 set_flag(TargetIsStrictfpFlag, target_is_loaded() && target->is_strict()); |
348 |
349 |
353 |
354 |
354 // provide an initial guess of signature size. |
355 // provide an initial guess of signature size. |
355 _signature = new BasicTypeList(number_of_arguments() + (has_receiver() ? 1 : 0)); |
356 _signature = new BasicTypeList(number_of_arguments() + (has_receiver() ? 1 : 0)); |
356 if (has_receiver()) { |
357 if (has_receiver()) { |
357 _signature->append(as_BasicType(receiver()->type())); |
358 _signature->append(as_BasicType(receiver()->type())); |
|
359 } else if (is_invokedynamic()) { |
|
360 // Add the synthetic MethodHandle argument to the signature. |
|
361 _signature->append(T_OBJECT); |
358 } |
362 } |
359 for (int i = 0; i < number_of_arguments(); i++) { |
363 for (int i = 0; i < number_of_arguments(); i++) { |
360 ValueType* t = argument_at(i)->type(); |
364 ValueType* t = argument_at(i)->type(); |
361 BasicType bt = as_BasicType(t); |
365 BasicType bt = as_BasicType(t); |
362 _signature->append(bt); |
366 _signature->append(bt); |
363 } |
367 } |
|
368 } |
|
369 |
|
370 |
|
371 void Invoke::state_values_do(void f(Value*)) { |
|
372 StateSplit::state_values_do(f); |
|
373 if (state_before() != NULL) state_before()->values_do(f); |
|
374 if (state() != NULL) state()->values_do(f); |
364 } |
375 } |
365 |
376 |
366 |
377 |
367 // Implementation of Contant |
378 // Implementation of Contant |
368 intx Constant::hash() const { |
379 intx Constant::hash() const { |