1 /*
2 * Copyright 1999-2006 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
317 }
318 }
319
320
321 void MonitorEnter::state_values_do(void f(Value*)) {
322 StateSplit::state_values_do(f);
323 _lock_stack_before->values_do(f);
324 }
325
326
327 void Intrinsic::state_values_do(void f(Value*)) {
328 StateSplit::state_values_do(f);
329 if (lock_stack() != NULL) lock_stack()->values_do(f);
330 }
331
332
333 // Implementation of Invoke
334
335
336 Invoke::Invoke(Bytecodes::Code code, ValueType* result_type, Value recv, Values* args,
337 int vtable_index, ciMethod* target)
338 : StateSplit(result_type)
339 , _code(code)
340 , _recv(recv)
341 , _args(args)
342 , _vtable_index(vtable_index)
343 , _target(target)
344 {
345 set_flag(TargetIsLoadedFlag, target->is_loaded());
346 set_flag(TargetIsFinalFlag, target_is_loaded() && target->is_final_method());
347 set_flag(TargetIsStrictfpFlag, target_is_loaded() && target->is_strict());
348
349 assert(args != NULL, "args must exist");
350 #ifdef ASSERT
351 values_do(assert_value);
352 #endif // ASSERT
353
354 // provide an initial guess of signature size.
355 _signature = new BasicTypeList(number_of_arguments() + (has_receiver() ? 1 : 0));
356 if (has_receiver()) {
357 _signature->append(as_BasicType(receiver()->type()));
358 }
359 for (int i = 0; i < number_of_arguments(); i++) {
360 ValueType* t = argument_at(i)->type();
361 BasicType bt = as_BasicType(t);
362 _signature->append(bt);
363 }
364 }
365
366
367 // Implementation of Contant
368 intx Constant::hash() const {
369 if (_state == NULL) {
370 switch (type()->tag()) {
371 case intTag:
372 return HASH2(name(), type()->as_IntConstant()->value());
373 case longTag:
374 {
375 jlong temp = type()->as_LongConstant()->value();
376 return HASH3(name(), high(temp), low(temp));
377 }
378 case floatTag:
379 return HASH2(name(), jint_cast(type()->as_FloatConstant()->value()));
380 case doubleTag:
381 {
382 jlong temp = jlong_cast(type()->as_DoubleConstant()->value());
383 return HASH3(name(), high(temp), low(temp));
384 }
385 case objectTag:
386 assert(type()->as_ObjectType()->is_loaded(), "can't handle unloaded values");
|
1 /*
2 * Copyright 1999-2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
317 }
318 }
319
320
321 void MonitorEnter::state_values_do(void f(Value*)) {
322 StateSplit::state_values_do(f);
323 _lock_stack_before->values_do(f);
324 }
325
326
327 void Intrinsic::state_values_do(void f(Value*)) {
328 StateSplit::state_values_do(f);
329 if (lock_stack() != NULL) lock_stack()->values_do(f);
330 }
331
332
333 // Implementation of Invoke
334
335
336 Invoke::Invoke(Bytecodes::Code code, ValueType* result_type, Value recv, Values* args,
337 int vtable_index, ciMethod* target, ValueStack* state_before)
338 : StateSplit(result_type)
339 , _code(code)
340 , _recv(recv)
341 , _args(args)
342 , _vtable_index(vtable_index)
343 , _target(target)
344 , _state_before(state_before)
345 {
346 set_flag(TargetIsLoadedFlag, target->is_loaded());
347 set_flag(TargetIsFinalFlag, target_is_loaded() && target->is_final_method());
348 set_flag(TargetIsStrictfpFlag, target_is_loaded() && target->is_strict());
349
350 assert(args != NULL, "args must exist");
351 #ifdef ASSERT
352 values_do(assert_value);
353 #endif // ASSERT
354
355 // provide an initial guess of signature size.
356 _signature = new BasicTypeList(number_of_arguments() + (has_receiver() ? 1 : 0));
357 if (has_receiver()) {
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);
362 }
363 for (int i = 0; i < number_of_arguments(); i++) {
364 ValueType* t = argument_at(i)->type();
365 BasicType bt = as_BasicType(t);
366 _signature->append(bt);
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);
375 }
376
377
378 // Implementation of Contant
379 intx Constant::hash() const {
380 if (_state == NULL) {
381 switch (type()->tag()) {
382 case intTag:
383 return HASH2(name(), type()->as_IntConstant()->value());
384 case longTag:
385 {
386 jlong temp = type()->as_LongConstant()->value();
387 return HASH3(name(), high(temp), low(temp));
388 }
389 case floatTag:
390 return HASH2(name(), jint_cast(type()->as_FloatConstant()->value()));
391 case doubleTag:
392 {
393 jlong temp = jlong_cast(type()->as_DoubleConstant()->value());
394 return HASH3(name(), high(temp), low(temp));
395 }
396 case objectTag:
397 assert(type()->as_ObjectType()->is_loaded(), "can't handle unloaded values");
|