comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotXirGenerator.java @ 1437:9e5e83ca2259

Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Mon, 25 Oct 2010 16:47:52 +0200
parents 72cfb36c6bb2
children a7a0ef3c6858
comparison
equal deleted inserted replaced
1436:9dae1aae168a 1437:9e5e83ca2259
1 /* 1 /*
2 * Copyright (c) 2009-2010 Sun Microsystems, Inc. All rights reserved. 2 * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved.
3 * 3 *
4 * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is 4 * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product
5 * described in this document. In particular, and without limitation, these intellectual property rights may include one 5 * that is described in this document. In particular, and without limitation, these intellectual property
6 * or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent 6 * rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or
7 * applications in the U.S. and in other countries. 7 * more additional patents or pending patent applications in the U.S. and in other countries.
8 * 8 *
9 * U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard 9 * U.S. Government Rights - Commercial software. Government users are subject to the Sun
10 * license agreement and applicable provisions of the FAR and its supplements. 10 * Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its
11 * supplements.
11 * 12 *
12 * Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java and Solaris are trademarks or registered 13 * Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java and Solaris are trademarks or
13 * trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and 14 * registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks
14 * are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. 15 * are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the
16 * U.S. and other countries.
15 * 17 *
16 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. 18 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open
19 * Company, Ltd.
17 */ 20 */
18 package com.sun.hotspot.c1x; 21 package com.sun.hotspot.c1x;
19 22
20 import java.lang.reflect.*; 23 import java.lang.reflect.*;
21 import java.util.*; 24 import java.util.*;
86 unverifiedStub = asm.createOutOfLineLabel("unverified"); 89 unverifiedStub = asm.createOutOfLineLabel("unverified");
87 90
88 XirOperand temp = asm.createRegister("temp (r10)", CiKind.Word, AMD64.r10); 91 XirOperand temp = asm.createRegister("temp (r10)", CiKind.Word, AMD64.r10);
89 XirOperand cache = asm.createRegister("cache (rax)", CiKind.Word, AMD64.rax); 92 XirOperand cache = asm.createRegister("cache (rax)", CiKind.Word, AMD64.rax);
90 93
91 CiCallingConvention conventions = registerConfig.getJavaCallingConvention(new CiKind[] { CiKind.Object}, false, target); 94 CiCallingConvention conventions = registerConfig.getJavaCallingConvention(new CiKind[] {CiKind.Object}, false, target);
92 XirOperand receiver = asm.createRegister("cache (rax)", CiKind.Word, conventions.locations[0].asRegister()); 95 XirOperand receiver = asm.createRegister("cache (rax)", CiKind.Word, conventions.locations[0].asRegister());
93 96
94 asm.pload(CiKind.Word, temp, receiver, asm.i(config.hubOffset), false); 97 asm.pload(CiKind.Word, temp, receiver, asm.i(config.hubOffset), false);
95 asm.jneq(unverifiedStub, cache, temp); 98 asm.jneq(unverifiedStub, cache, temp);
96 } 99 }
252 255
253 // -- out of line ------------------------------------------------------- 256 // -- out of line -------------------------------------------------------
254 asm.bindOutOfLine(stub); 257 asm.bindOutOfLine(stub);
255 XirOperand method = asm.createRegister("method", CiKind.Word, AMD64.rbx); 258 XirOperand method = asm.createRegister("method", CiKind.Word, AMD64.rbx);
256 asm.mark(MARK_STATIC_CALL_STUB, XirMark.CALLSITE); 259 asm.mark(MARK_STATIC_CALL_STUB, XirMark.CALLSITE);
257 asm.mov(method, asm.w(0l)); 260 asm.mov(method, asm.w(0L));
258 XirLabel dummy = asm.createOutOfLineLabel("dummy"); 261 XirLabel dummy = asm.createOutOfLineLabel("dummy");
259 asm.jmp(dummy); 262 asm.jmp(dummy);
260 asm.bindOutOfLine(dummy); 263 asm.bindOutOfLine(dummy);
261 264
262 return asm.finishTemplate(addr, "invokespecial"); 265 return asm.finishTemplate(addr, "invokespecial");
275 278
276 // -- out of line ------------------------------------------------------- 279 // -- out of line -------------------------------------------------------
277 asm.bindOutOfLine(stub); 280 asm.bindOutOfLine(stub);
278 XirOperand method = asm.createRegister("method", CiKind.Word, AMD64.rbx); 281 XirOperand method = asm.createRegister("method", CiKind.Word, AMD64.rbx);
279 asm.mark(MARK_STATIC_CALL_STUB, XirMark.CALLSITE); 282 asm.mark(MARK_STATIC_CALL_STUB, XirMark.CALLSITE);
280 asm.mov(method, asm.w(0l)); 283 asm.mov(method, asm.w(0L));
281 XirLabel dummy = asm.createOutOfLineLabel("dummy"); 284 XirLabel dummy = asm.createOutOfLineLabel("dummy");
282 asm.jmp(dummy); 285 asm.jmp(dummy);
283 asm.bindOutOfLine(dummy); 286 asm.bindOutOfLine(dummy);
284 287
285 return asm.finishTemplate(addr, "invokestatic"); 288 return asm.finishTemplate(addr, "invokestatic");
554 } 557 }
555 558
556 XirOperand objHub = asm.createTemp("objHub", CiKind.Object); 559 XirOperand objHub = asm.createTemp("objHub", CiKind.Object);
557 560
558 XirLabel end = asm.createInlineLabel("end"); 561 XirLabel end = asm.createInlineLabel("end");
559 XirLabel slow_path = asm.createOutOfLineLabel("slow path"); 562 XirLabel slowPath = asm.createOutOfLineLabel("slow path");
560 563
561 if (is(NULL_CHECK, flags)) { 564 if (is(NULL_CHECK, flags)) {
562 // null can be cast to anything 565 // null can be cast to anything
563 asm.jeq(end, object, asm.o(null)); 566 asm.jeq(end, object, asm.o(null));
564 } 567 }
565 568
566 asm.pload(CiKind.Object, objHub, object, asm.i(config.hubOffset), false); 569 asm.pload(CiKind.Object, objHub, object, asm.i(config.hubOffset), false);
567 // if we get an exact match: succeed immediately 570 // if we get an exact match: succeed immediately
568 asm.jneq(slow_path, objHub, hub); 571 asm.jneq(slowPath, objHub, hub);
569 asm.bindInline(end); 572 asm.bindInline(end);
570 573
571 // -- out of line ------------------------------------------------------- 574 // -- out of line -------------------------------------------------------
572 asm.bindOutOfLine(slow_path); 575 asm.bindOutOfLine(slowPath);
573 checkSubtype(asm, objHub, objHub, hub); 576 checkSubtype(asm, objHub, objHub, hub);
574 asm.jneq(end, objHub, asm.o(null)); 577 asm.jneq(end, objHub, asm.o(null));
575 XirOperand scratch = asm.createRegister("scratch", CiKind.Object, AMD64.r10); 578 XirOperand scratch = asm.createRegister("scratch", CiKind.Object, AMD64.r10);
576 asm.mov(scratch, object); 579 asm.mov(scratch, object);
577 asm.callRuntime(config.throwClassCastException, null); 580 asm.callRuntime(config.throwClassCastException, null);
604 } 607 }
605 608
606 XirOperand objHub = asm.createTemp("objHub", CiKind.Object); 609 XirOperand objHub = asm.createTemp("objHub", CiKind.Object);
607 610
608 XirLabel end = asm.createInlineLabel("end"); 611 XirLabel end = asm.createInlineLabel("end");
609 XirLabel slow_path = asm.createOutOfLineLabel("slow path"); 612 XirLabel slowPath = asm.createOutOfLineLabel("slow path");
610 613
611 if (is(NULL_CHECK, flags)) { 614 if (is(NULL_CHECK, flags)) {
612 // null isn't "instanceof" anything 615 // null isn't "instanceof" anything
613 asm.mov(result, asm.b(false)); 616 asm.mov(result, asm.b(false));
614 asm.jeq(end, object, asm.o(null)); 617 asm.jeq(end, object, asm.o(null));
615 } 618 }
616 619
617 asm.pload(CiKind.Object, objHub, object, asm.i(config.hubOffset), false); 620 asm.pload(CiKind.Object, objHub, object, asm.i(config.hubOffset), false);
618 // if we get an exact match: succeed immediately 621 // if we get an exact match: succeed immediately
619 asm.mov(result, asm.b(true)); 622 asm.mov(result, asm.b(true));
620 asm.jneq(slow_path, objHub, hub); 623 asm.jneq(slowPath, objHub, hub);
621 asm.bindInline(end); 624 asm.bindInline(end);
622 625
623 // -- out of line ------------------------------------------------------- 626 // -- out of line -------------------------------------------------------
624 asm.bindOutOfLine(slow_path); 627 asm.bindOutOfLine(slowPath);
625 checkSubtype(asm, result, objHub, hub); 628 checkSubtype(asm, result, objHub, hub);
626 asm.jmp(end); 629 asm.jmp(end);
627 630
628 if (is(UNRESOLVED, flags)) { 631 if (is(UNRESOLVED, flags)) {
629 patching.emitOutOfLine(); 632 patching.emitOutOfLine();
988 asm.bindOutOfLine(replacement); 991 asm.bindOutOfLine(replacement);
989 XirMark begin = asm.mark(null); 992 XirMark begin = asm.mark(null);
990 asm.mov(arg, asm.createConstant(CiConstant.forObject(null))); 993 asm.mov(arg, asm.createConstant(CiConstant.forObject(null)));
991 XirMark end = asm.mark(null); 994 XirMark end = asm.mark(null);
992 // make this piece of data look like an instruction 995 // make this piece of data look like an instruction
993 asm.rawBytes(new byte[] { (byte) 0xb8, 0, 0, 0x05, 0}); 996 asm.rawBytes(new byte[] {(byte) 0xb8, 0, 0, 0x05, 0});
994 asm.mark(MARK_KLASS_PATCHING, begin, end); 997 asm.mark(MARK_KLASS_PATCHING, begin, end);
995 asm.bindOutOfLine(patchStub); 998 asm.bindOutOfLine(patchStub);
996 asm.callRuntime(config.loadKlassStub, null); 999 asm.callRuntime(config.loadKlassStub, null);
997 asm.jmp(patchSite); 1000 asm.jmp(patchSite);
998 1001
1060 } else { 1063 } else {
1061 asm.pload(value.kind, value, receiver, asm.i(Integer.MAX_VALUE), false); 1064 asm.pload(value.kind, value, receiver, asm.i(Integer.MAX_VALUE), false);
1062 } 1065 }
1063 XirMark end = asm.mark(null); 1066 XirMark end = asm.mark(null);
1064 // make this piece of data look like an instruction 1067 // make this piece of data look like an instruction
1065 asm.rawBytes(new byte[] { (byte) 0xb8, 0, 0, 0x05, 0}); 1068 asm.rawBytes(new byte[] {(byte) 0xb8, 0, 0, 0x05, 0});
1066 asm.mark(MARK_ACCESS_FIELD_PATCHING, begin, end); 1069 asm.mark(MARK_ACCESS_FIELD_PATCHING, begin, end);
1067 asm.bindOutOfLine(patchStub); 1070 asm.bindOutOfLine(patchStub);
1068 asm.callRuntime(config.accessFieldStub, null); 1071 asm.callRuntime(config.accessFieldStub, null);
1069 asm.jmp(patchSite); 1072 asm.jmp(patchSite);
1070 1073