< prev index next >

src/share/vm/opto/valuetypenode.cpp

Print this page
rev 10493 : keep
rev 10496 : more
rev 10497 : embedded vt
rev 10504 : value type calling convention

@@ -27,11 +27,11 @@
 #include "opto/graphKit.hpp"
 #include "opto/rootnode.hpp"
 #include "opto/valuetypenode.hpp"
 #include "opto/phaseX.hpp"
 
-Node* ValueTypeNode::make(PhaseGVN& gvn, ciValueKlass* klass) {
+ValueTypeNode* ValueTypeNode::make(PhaseGVN& gvn, ciValueKlass* klass) {
   // Create a new ValueTypeNode with uninitialized values and NULL oop
   const TypeValueType* type = TypeValueType::make(klass);
   return new ValueTypeNode(type, gvn.zerocon(T_VALUETYPE));
 }
 

@@ -299,10 +299,48 @@
       }
     }
   }
 }
 
+uint ValueTypeNode::set_arguments_for_java_call(CallJavaNode* call, int base_input, const GraphKit& kit, ciValueKlass* base_vk, int base_offset) {
+  ciValueKlass* vk = get_value_klass();
+  if (base_vk == NULL) {
+    base_vk = vk;
+  }
+  uint edges = 0;
+  for (uint i = 0; i < field_count(); i++) {
+    ciType* field_type = get_field_type(i);
+    int offset = base_offset + get_field_offset(i) - (base_offset > 0 ? vk->get_first_field_offset() : 0);
+    Node* arg = get_field_value(i);
+    if (field_type->is_valuetype()) {
+      ciValueKlass* embedded_vk = field_type->as_value_klass();
+      edges += arg->as_ValueType()->set_arguments_for_java_call(call, base_input, kit, base_vk, offset);
+    } else {
+      int j = 0; int extra = 0;
+      for (; j < base_vk->nof_nonstatic_fields(); j++) {
+        ciField* f = base_vk->nonstatic_field_at(j);
+        if (offset == f->offset()) {
+          assert(f->type() == field_type, "");
+          break;
+        }
+        BasicType bt = f->type()->basic_type();
+        if (bt == T_LONG || bt == T_DOUBLE) {
+          extra++;
+        }
+      }
+      call->init_req(base_input + j + extra, arg);
+      edges++;
+      BasicType bt = field_type->basic_type();
+      if (bt == T_LONG || bt == T_DOUBLE) {
+        call->init_req(base_input + j + extra + 1, kit.top());
+        edges++;
+      }
+    }
+  }
+  return edges;
+}
+
 Node* ValueTypeNode::Ideal(PhaseGVN* phase, bool can_reshape) {
   // No optimizations for now
   return NULL;
 }
 
< prev index next >