# HG changeset patch # User Thomas Wuerthinger # Date 1295449993 -3600 # Node ID 40bcc41390e4c2a15147635ce6f98f9a1daffbba # Parent 9508a52cbd32857a8d41cadecfdc6f6ac9ed6b48 Added getClass intrinsic implementation. diff -r 9508a52cbd32 -r 40bcc41390e4 c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotVMConfig.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotVMConfig.java Wed Jan 19 15:48:15 2011 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotVMConfig.java Wed Jan 19 16:13:13 2011 +0100 @@ -54,6 +54,7 @@ public long cardtableStartAddress; public int cardtableShift; public long safepointPollingAddress; + public int classMirrorOffset; // runtime stubs public long debugStub; diff -r 9508a52cbd32 -r 40bcc41390e4 c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotXirGenerator.java --- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotXirGenerator.java Wed Jan 19 15:48:15 2011 +0100 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotXirGenerator.java Wed Jan 19 16:13:13 2011 +0100 @@ -733,6 +733,17 @@ } }; + private SimpleTemplates getClassTemplates = new SimpleTemplates() { + @Override + protected XirTemplate create(CiXirAssembler asm, long flags) { + XirOperand result = asm.restart(CiKind.Object); + XirOperand object = asm.createInputParameter("object", CiKind.Object); + asm.pload(CiKind.Object, result, object, asm.i(config.hubOffset), is(NULL_CHECK, flags)); + asm.pload(CiKind.Object, result, result, asm.i(config.classMirrorOffset), false); + return asm.finishTemplate("currentThread"); + } + }; + private SimpleTemplates currentThreadTemplates = new SimpleTemplates() { @Override protected XirTemplate create(CiXirAssembler asm, long flags) { @@ -748,6 +759,11 @@ return new XirSnippet(currentThreadTemplates.get(site)); } + @Override + public XirSnippet genGetClass(XirSite site, XirArgument object) { + return new XirSnippet(getClassTemplates.get(site), object); + } + private KindTemplates arrayCopyTemplates = new KindTemplates() { @Override diff -r 9508a52cbd32 -r 40bcc41390e4 src/share/vm/c1x/c1x_VMEntries.cpp --- a/src/share/vm/c1x/c1x_VMEntries.cpp Wed Jan 19 15:48:15 2011 +0100 +++ b/src/share/vm/c1x/c1x_VMEntries.cpp Wed Jan 19 16:13:13 2011 +0100 @@ -522,6 +522,7 @@ set_int(env, config, "threadExceptionOopOffset", in_bytes(JavaThread::exception_oop_offset())); set_int(env, config, "threadExceptionPcOffset", in_bytes(JavaThread::exception_pc_offset())); set_int(env, config, "threadMultiNewArrayStorage", in_bytes(JavaThread::c1x_multinewarray_storage_offset())); + set_int(env, config, "classMirrorOffset", klassOopDesc::klass_part_offset_in_bytes() + Klass::java_mirror_offset_in_bytes()); set_long(env, config, "debugStub", VmIds::addStub((address)warning)); set_long(env, config, "instanceofStub", VmIds::addStub(Runtime1::entry_for(Runtime1::slow_subtype_check_id)));