Mercurial > hg > graal-compiler
diff src/share/vm/c1/c1_Instruction.hpp @ 6266:1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
6984705: JSR 292 method handle creation should not go through JNI
Summary: remove assembly code for JDK 7 chained method handles
Reviewed-by: jrose, twisti, kvn, mhaupt
Contributed-by: John Rose <john.r.rose@oracle.com>, Christian Thalinger <christian.thalinger@oracle.com>, Michael Haupt <michael.haupt@oracle.com>
author | twisti |
---|---|
date | Tue, 24 Jul 2012 10:51:00 -0700 |
parents | c8289830e172 |
children | da91efe96a93 |
line wrap: on
line diff
--- a/src/share/vm/c1/c1_Instruction.hpp Mon Jul 23 13:04:59 2012 -0700 +++ b/src/share/vm/c1/c1_Instruction.hpp Tue Jul 24 10:51:00 2012 -0700 @@ -66,6 +66,7 @@ class IfOp; class Convert; class NullCheck; +class TypeCast; class OsrEntry; class ExceptionObject; class StateSplit; @@ -174,6 +175,7 @@ virtual void do_IfOp (IfOp* x) = 0; virtual void do_Convert (Convert* x) = 0; virtual void do_NullCheck (NullCheck* x) = 0; + virtual void do_TypeCast (TypeCast* x) = 0; virtual void do_Invoke (Invoke* x) = 0; virtual void do_NewInstance (NewInstance* x) = 0; virtual void do_NewTypeArray (NewTypeArray* x) = 0; @@ -302,7 +304,8 @@ void update_exception_state(ValueStack* state); - protected: + //protected: + public: void set_type(ValueType* type) { assert(type != NULL, "type must exist"); _type = type; @@ -485,6 +488,7 @@ virtual TypeCheck* as_TypeCheck() { return NULL; } virtual CheckCast* as_CheckCast() { return NULL; } virtual InstanceOf* as_InstanceOf() { return NULL; } + virtual TypeCast* as_TypeCast() { return NULL; } virtual AccessMonitor* as_AccessMonitor() { return NULL; } virtual MonitorEnter* as_MonitorEnter() { return NULL; } virtual MonitorExit* as_MonitorExit() { return NULL; } @@ -638,8 +642,8 @@ // accessors int java_index() const { return _java_index; } - ciType* declared_type() const { return _declared_type; } - ciType* exact_type() const; + virtual ciType* declared_type() const { return _declared_type; } + virtual ciType* exact_type() const; // generic virtual void input_values_do(ValueVisitor* f) { /* no values */ } @@ -650,13 +654,13 @@ public: // creation Constant(ValueType* type): - Instruction(type, NULL, true) + Instruction(type, NULL, /*type_is_constant*/ true) { assert(type->is_constant(), "must be a constant"); } Constant(ValueType* type, ValueStack* state_before): - Instruction(type, state_before, true) + Instruction(type, state_before, /*type_is_constant*/ true) { assert(state_before != NULL, "only used for constants which need patching"); assert(type->is_constant(), "must be a constant"); @@ -670,6 +674,7 @@ virtual intx hash() const; virtual bool is_equal(Value v) const; + virtual ciType* exact_type() const; enum CompareResult { not_comparable = -1, cond_false, cond_true }; @@ -1103,6 +1108,29 @@ }; +// This node is supposed to cast the type of another node to a more precise +// declared type. +LEAF(TypeCast, Instruction) + private: + ciType* _declared_type; + Value _obj; + + public: + // The type of this node is the same type as the object type (and it might be constant). + TypeCast(ciType* type, Value obj, ValueStack* state_before) + : Instruction(obj->type(), state_before, obj->type()->is_constant()), + _declared_type(type), + _obj(obj) {} + + // accessors + ciType* declared_type() const { return _declared_type; } + Value obj() const { return _obj; } + + // generic + virtual void input_values_do(ValueVisitor* f) { f->visit(&_obj); } +}; + + BASE(StateSplit, Instruction) private: ValueStack* _state; @@ -1166,6 +1194,7 @@ // JSR 292 support bool is_invokedynamic() const { return code() == Bytecodes::_invokedynamic; } + bool is_method_handle_intrinsic() const { return target()->is_method_handle_intrinsic(); } virtual bool needs_exception_state() const { return false; } @@ -2277,14 +2306,16 @@ private: ciMethod* _method; int _bci_of_invoke; + ciMethod* _callee; // the method that is called at the given bci Value _recv; ciKlass* _known_holder; public: - ProfileCall(ciMethod* method, int bci, Value recv, ciKlass* known_holder) + ProfileCall(ciMethod* method, int bci, ciMethod* callee, Value recv, ciKlass* known_holder) : Instruction(voidType) , _method(method) , _bci_of_invoke(bci) + , _callee(callee) , _recv(recv) , _known_holder(known_holder) { @@ -2294,6 +2325,7 @@ ciMethod* method() { return _method; } int bci_of_invoke() { return _bci_of_invoke; } + ciMethod* callee() { return _callee; } Value recv() { return _recv; } ciKlass* known_holder() { return _known_holder; }