# HG changeset patch # User Andrew Haley # Date 1231781361 0 # Node ID e34ba0ba2281d40e26fd7ce0a5ee992a22e568f4 # Parent bce8d56dfa033cb23e2a8a8271ba4199044e6c73 2009-01-12 Andrew Haley * ports/hotspot/src/share/vm/shark/sharkBlock.cpp (SharkBlock::do_ldc): Add logic for ldc(Class). diff -r bce8d56dfa03 -r e34ba0ba2281 ChangeLog --- a/ChangeLog Sun Jan 11 18:56:44 2009 +0100 +++ b/ChangeLog Mon Jan 12 17:29:21 2009 +0000 @@ -1,3 +1,8 @@ +2009-01-12 Andrew Haley + + * ports/hotspot/src/share/vm/shark/sharkBlock.cpp (SharkBlock::do_ldc): + Add logic for ldc(Class). + 2009-01-11 Mark Wielaard * Makefile.am: Escape single quotes in empty bootclasspath. diff -r bce8d56dfa03 -r e34ba0ba2281 ports/hotspot/src/share/vm/shark/sharkBlock.cpp --- a/ports/hotspot/src/share/vm/shark/sharkBlock.cpp Sun Jan 11 18:56:44 2009 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkBlock.cpp Mon Jan 12 17:29:21 2009 +0000 @@ -1236,10 +1236,11 @@ SharkConstantPool constants(this); BasicBlock *resolved = function()->CreateBlock("resolved"); + BasicBlock *resolved_class = function()->CreateBlock("resolved_class"); BasicBlock *unresolved = function()->CreateBlock("unresolved"); BasicBlock *unknown = function()->CreateBlock("unknown"); BasicBlock *done = function()->CreateBlock("done"); - + SwitchInst *switchinst = builder()->CreateSwitch( constants.tag_at(iter()->get_constant_index()), unknown, 5); @@ -1247,7 +1248,7 @@ switchinst->addCase( LLVMValue::jbyte_constant(JVM_CONSTANT_String), resolved); switchinst->addCase( - LLVMValue::jbyte_constant(JVM_CONSTANT_Class), resolved); + LLVMValue::jbyte_constant(JVM_CONSTANT_Class), resolved_class); switchinst->addCase( LLVMValue::jbyte_constant(JVM_CONSTANT_UnresolvedString), unresolved); switchinst->addCase( @@ -1260,6 +1261,26 @@ Value *resolved_value = constants.object_at(iter()->get_constant_index()); builder()->CreateBr(done); + builder()->SetInsertPoint(resolved_class); + Value *resolved_class_value + = constants.object_at(iter()->get_constant_index()); + resolved_class_value + = builder()->CreatePtrToInt(resolved_class_value, + SharkType::intptr_type()); + resolved_class_value + = (builder()->CreateAdd + (resolved_class_value, + (LLVMValue::intptr_constant + (klassOopDesc::klass_part_offset_in_bytes() + + Klass::java_mirror_offset_in_bytes())))); + resolved_class_value + // FIXME: We need a memory barrier before this load. + = (builder()->CreateLoad + (builder()->CreateIntToPtr + (resolved_class_value, + PointerType::getUnqual(SharkType::jobject_type())))); + builder()->CreateBr(done); + builder()->SetInsertPoint(unresolved); builder()->CreateUnimplemented(__FILE__, __LINE__); Value *unresolved_value = LLVMValue::null(); @@ -1272,6 +1293,7 @@ builder()->SetInsertPoint(done); PHINode *phi = builder()->CreatePHI(SharkType::jobject_type(), "constant"); phi->addIncoming(resolved_value, resolved); + phi->addIncoming(resolved_class_value, resolved_class); phi->addIncoming(unresolved_value, unresolved); value = SharkValue::create_jobject(phi); }