comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTargetMethod.java @ 1421:6223633ce7dd

changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
author Lukas Stadler <lukas.stadler@oracle.com>
date Fri, 23 Jul 2010 15:53:02 -0700
parents
children 3483ec571caf
comparison
equal deleted inserted replaced
1420:44efca8a02d6 1421:6223633ce7dd
1 package com.sun.hotspot.c1x;
2
3 import java.util.*;
4
5 import com.sun.cri.ci.*;
6 import com.sun.cri.ci.CiTargetMethod.*;
7 import com.sun.cri.ri.*;
8
9 public class HotSpotTargetMethod {
10
11 public final Object methodOop;
12 private byte[] code;
13 private int frameSize;
14
15 public int verifiedEntrypoint;
16 public int unverifiedEntrypoint;
17
18 public int relocationOffsets[];
19 public Object relocationData[];
20
21 private HotSpotTargetMethod(HotSpotVMConfig config, RiMethod method, CiTargetMethod targetMethod) {
22 methodOop = ((HotSpotMethod) method).methodOop;
23 code = targetMethod.targetCode();
24 frameSize = targetMethod.frameSize();
25 verifiedEntrypoint = targetMethod.entrypointCodeOffsets.get(HotSpotRuntime.Entrypoints.VERIFIED);
26 unverifiedEntrypoint = targetMethod.entrypointCodeOffsets.get(HotSpotRuntime.Entrypoints.UNVERIFIED);
27
28 Map<Integer, Object> relocations = new TreeMap<Integer, Object>();
29 if (!targetMethod.dataReferences.isEmpty()) {
30 for (DataPatch patch : targetMethod.dataReferences) {
31 if (patch.data.kind == CiKind.Object) {
32 if (patch.data.asObject() instanceof RiType) {
33 relocations.put(patch.pcOffset, patch.data.asObject());
34 } else {
35 throw new RuntimeException("unexpected data reference");
36 }
37 }
38 }
39 }
40
41 if (!targetMethod.directCalls.isEmpty()) {
42 for (CiTargetMethod.Call call : targetMethod.directCalls) {
43 if (call.globalStubID instanceof Long) {
44 relocations.put(call.pcOffset, (Long)call.globalStubID);
45 } else if (call.globalStubID instanceof CiRuntimeCall) {
46 switch ((CiRuntimeCall) call.globalStubID) {
47 case Debug:
48 // relocations.put(call.pcOffset, config.debugStub);
49 System.out.println("debug call");
50 break;
51 case UnwindException:
52 case RegisterFinalizer:
53 case HandleException:
54 case OSRMigrationEnd:
55 case JavaTimeMillis:
56 case JavaTimeNanos:
57 case ArithmethicLrem:
58 case ArithmeticLdiv:
59 case ArithmeticFrem:
60 case ArithmeticDrem:
61 case ArithmeticCos:
62 case ArithmeticTan:
63 case ArithmeticLog:
64 case ArithmeticLog10:
65 case ArithmeticSin:
66 default:
67 throw new RuntimeException("unexpected runtime call: " + call.globalStubID);
68 }
69 }
70 }
71 }
72 relocationOffsets = new int[relocations.size()];
73 relocationData = new Object[relocations.size()];
74 int i=0;
75 for( Map.Entry<Integer, Object> entry: relocations.entrySet()) {
76 relocationOffsets[i] = entry.getKey();
77 relocationData[i++] = entry.getValue();
78 }
79 }
80
81 public static void installCode(HotSpotVMConfig config, RiMethod method, CiTargetMethod targetMethod) {
82 Compiler.getVMEntries().installCode(new HotSpotTargetMethod(config, method, targetMethod));
83 }
84
85 }