00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 # include "incls/_precompiled.incl"
00025
00026 #ifdef DELTA_COMPILER
00027
00028 # include "incls/_nameDesc.cpp.incl"
00029
00030 void LocationNameDesc::print() {
00031 std->print("@%s (%d)", location().name(), offset);
00032 }
00033
00034 void ValueNameDesc::print() {
00035 std->print("=");
00036 value()->print_value();
00037 std->print(" (%d)", offset);
00038 }
00039
00040 void BlockValueNameDesc::print() {
00041 std->print("[=");
00042 block_method()->print_value();
00043 std->print("]");
00044 std->print(" (%d)", offset);
00045 }
00046
00047 void MemoizedBlockNameDesc::print() {
00048 std->print("[@%s =", location().name());
00049 block_method()->print_value();
00050 std->print("]");
00051 std->print(" (%d)", offset);
00052 }
00053
00054 void IllegalNameDesc::print() {
00055 std->print("###illegal###");
00056 std->print(" (%d)", offset);
00057 }
00058
00059 bool LocationNameDesc::equal(NameDesc* other) const {
00060 if (other->isLocation()) {
00061 return location() == ((LocationNameDesc*) other)->location();
00062 }
00063 return false;
00064 }
00065
00066 bool ValueNameDesc::equal(NameDesc* other) const {
00067 if (other->isValue()) {
00068 return value() == ((ValueNameDesc*) other)->value();
00069 }
00070 return false;
00071 }
00072
00073 bool BlockValueNameDesc::equal(NameDesc* other) const {
00074 if (other->isBlockValue()) {
00075 return block_method() == ((BlockValueNameDesc*) other)->block_method()
00076 && parent_scope()->s_equivalent(((BlockValueNameDesc*) other)->parent_scope());
00077 }
00078 return false;
00079 }
00080
00081 bool MemoizedBlockNameDesc::equal(NameDesc* other) const {
00082 if (other->isMemoizedBlock()) {
00083 return location() == ((MemoizedBlockNameDesc*) other)->location()
00084 && block_method() == ((MemoizedBlockNameDesc*) other)->block_method()
00085 && parent_scope()->s_equivalent(((MemoizedBlockNameDesc*) other)->parent_scope());
00086 }
00087 return false;
00088 }
00089
00090 bool IllegalNameDesc::equal(NameDesc* other) const {
00091 return other->isIllegal();
00092 }
00093
00094 extern "C" oop allocateBlock(smiOop nofArgs);
00095
00096 oop BlockValueNameDesc::value(const frame* fr) const {
00097
00098 if (MaterializeEliminatedBlocks || StackChunkBuilder::is_deoptimizing()) {
00099 blockClosureOop blk = blockClosureOop(
00100 allocateBlock(as_smiOop(block_method()->number_of_arguments())));
00101 blk->set_method(block_method());
00102
00103 compiledVFrame* vf = compiledVFrame::new_vframe(fr, parent_scope(), 0);
00104 blk->set_lexical_scope(vf->canonical_context());
00105 return blk;
00106 } else {
00107 ResourceMark rm;
00108 stringStream st(50);
00109 st.print("eliminated [] in ");
00110 block_method()->home()->selector()->print_symbol_on(&st);
00111 return oopFactory::new_symbol(st.as_string());
00112 }
00113 }
00114
00115 oop MemoizedBlockNameDesc::value(const frame* fr) const {
00116
00117 compiledVFrame* vf = fr
00118 ? compiledVFrame::new_vframe(fr, parent_scope(), 0)
00119 : NULL;
00120
00121 oop stored_value = compiledVFrame::resolve_location(location(), vf);
00122 if (stored_value != uncreatedBlockValue()) {
00123 return stored_value;
00124 }
00125
00126
00127 if (MaterializeEliminatedBlocks || StackChunkBuilder::is_deoptimizing()) {
00128 blockClosureOop blk = blockClosureOop(
00129 allocateBlock(as_smiOop(block_method()->number_of_arguments())));
00130 blk->set_method(block_method());
00131
00132 blk->set_lexical_scope(vf->canonical_context());
00133 return blk;
00134 } else {
00135 ResourceMark rm;
00136 stringStream st(50);
00137 st.print("memoized [] in ");
00138 block_method()->home()->selector()->print_symbol_on(&st);
00139 return oopFactory::new_symbol(st.as_string());
00140 }
00141 }
00142
00143 #endif