src/share/vm/c1/c1_LIR.cpp

changeset 4037
da91efe96a93
parent 3787
6759698e3140
child 4051
8a02ca5e5576
     1.1 --- a/src/share/vm/c1/c1_LIR.cpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/share/vm/c1/c1_LIR.cpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -85,14 +85,17 @@
    1.11  LIR_Opr LIR_OprFact::value_type(ValueType* type) {
    1.12    ValueTag tag = type->tag();
    1.13    switch (tag) {
    1.14 -  case objectTag : {
    1.15 +  case metaDataTag : {
    1.16      ClassConstant* c = type->as_ClassConstant();
    1.17      if (c != NULL && !c->value()->is_loaded()) {
    1.18 -      return LIR_OprFact::oopConst(NULL);
    1.19 +      return LIR_OprFact::metadataConst(NULL);
    1.20      } else {
    1.21 +      return LIR_OprFact::metadataConst(c->value()->constant_encoding());
    1.22 +    }
    1.23 +  }
    1.24 +  case objectTag : {
    1.25        return LIR_OprFact::oopConst(type->as_ObjectType()->encoding());
    1.26      }
    1.27 -  }
    1.28    case addressTag: return LIR_OprFact::addressConst(type->as_AddressConstant()->value());
    1.29    case intTag    : return LIR_OprFact::intConst(type->as_IntConstant()->value());
    1.30    case floatTag  : return LIR_OprFact::floatConst(type->as_FloatConstant()->value());
    1.31 @@ -148,12 +151,12 @@
    1.32  #ifdef _LP64
    1.33    assert(base()->is_cpu_register(), "wrong base operand");
    1.34    assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand");
    1.35 -  assert(base()->type() == T_OBJECT || base()->type() == T_LONG,
    1.36 +  assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA,
    1.37           "wrong type for addresses");
    1.38  #else
    1.39    assert(base()->is_single_cpu(), "wrong base operand");
    1.40    assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand");
    1.41 -  assert(base()->type() == T_OBJECT || base()->type() == T_INT,
    1.42 +  assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA,
    1.43           "wrong type for addresses");
    1.44  #endif
    1.45  }
    1.46 @@ -176,6 +179,7 @@
    1.47      case T_LONG:
    1.48      case T_OBJECT:
    1.49      case T_ADDRESS:
    1.50 +    case T_METADATA:
    1.51      case T_VOID:
    1.52        return ::type2char(t);
    1.53  
    1.54 @@ -219,6 +223,7 @@
    1.55      case T_INT:
    1.56      case T_ADDRESS:
    1.57      case T_OBJECT:
    1.58 +    case T_METADATA:
    1.59      case T_ARRAY:
    1.60        assert((kind_field() == cpu_register || kind_field() == stack_value) &&
    1.61               size_field() == single_size, "must match");
    1.62 @@ -1164,6 +1169,9 @@
    1.63    append(new LIR_Op1(lir_move, LIR_OprFact::oopConst(o),  reg, T_OBJECT, lir_patch_normal, info));
    1.64  }
    1.65  
    1.66 +void LIR_List::klass2reg_patch(Metadata* o, LIR_Opr reg, CodeEmitInfo* info) {
    1.67 +  append(new LIR_Op1(lir_move, LIR_OprFact::metadataConst(o), reg, T_METADATA, lir_patch_normal, info));
    1.68 +}
    1.69  
    1.70  void LIR_List::load(LIR_Address* addr, LIR_Opr src, CodeEmitInfo* info, LIR_PatchCode patch_code) {
    1.71    append(new LIR_Op1(
    1.72 @@ -1543,6 +1551,7 @@
    1.73      case T_FLOAT:  out->print("flt:%f",   as_jfloat());         break;
    1.74      case T_DOUBLE: out->print("dbl:%f",   as_jdouble());        break;
    1.75      case T_OBJECT: out->print("obj:0x%x", as_jobject());        break;
    1.76 +    case T_METADATA: out->print("metadata:0x%x", as_metadata());break;
    1.77      default:       out->print("%3d:0x%x",type(), as_jdouble()); break;
    1.78    }
    1.79  }

mercurial