changeset 2060:40bcc41390e4

Added getClass intrinsic implementation.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Wed, 19 Jan 2011 16:13:13 +0100
parents 9508a52cbd32
children c0b1d6a44a02
files c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotVMConfig.java c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotXirGenerator.java src/share/vm/c1x/c1x_VMEntries.cpp
diffstat 3 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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
--- 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)));