1 /* |
1 /* |
2 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
60 JavaValue[] values = new JavaValue[slotKinds.length]; |
60 JavaValue[] values = new JavaValue[slotKinds.length]; |
61 test(asm -> { |
61 test(asm -> { |
62 /* |
62 /* |
63 * Ensure that any objects mentioned in the VirtualObjects are also in the OopMap. |
63 * Ensure that any objects mentioned in the VirtualObjects are also in the OopMap. |
64 */ |
64 */ |
65 List<Location> newLocations = new ArrayList<Location>(Arrays.asList(objects)); |
65 List<Location> newLocations = new ArrayList<>(Arrays.asList(objects)); |
66 List<Location> newDerived = new ArrayList<Location>(Arrays.asList(derivedBase)); |
66 List<Location> newDerived = new ArrayList<>(Arrays.asList(derivedBase)); |
67 int[] newSizeInBytes = sizeInBytes; |
67 int[] newSizeInBytes = sizeInBytes; |
68 VirtualObject[] vobjs = compiler.compile(asm, values); |
68 VirtualObject[] vobjs = compiler.compile(asm, values); |
69 if (vobjs != null) { |
69 if (vobjs != null) { |
70 for (VirtualObject obj : vobjs) { |
70 for (VirtualObject obj : vobjs) { |
71 JavaValue[] objValues = obj.getValues(); |
71 JavaValue[] objValues = obj.getValues(); |
72 for (int i = 0; i < objValues.length; i++) { |
72 for (int i = 0; i < objValues.length; i++) { |
73 if (obj.getSlotKind(i) == JavaKind.Object) { |
73 if (obj.getSlotKind(i) == JavaKind.Object) { |
74 Location oopLocation = null; |
74 Location oopLocation = null; |
75 int bytes = -1; |
75 int bytes = -1; |
76 if (objValues[i] instanceof RegisterValue) { |
76 if (objValues[i] instanceof RegisterValue) { |
77 RegisterValue reg = (RegisterValue) objValues[i]; |
77 RegisterValue reg = (RegisterValue) objValues[i]; |
78 oopLocation = Location.register(reg.getRegister()); |
78 oopLocation = Location.register(reg.getRegister()); |
79 bytes = reg.getValueKind().getPlatformKind().getSizeInBytes(); |
79 bytes = reg.getValueKind().getPlatformKind().getSizeInBytes(); |
80 } else if (objValues[i] instanceof StackSlot) { |
80 } else if (objValues[i] instanceof StackSlot) { |
81 StackSlot slot = (StackSlot) objValues[i]; |
81 StackSlot slot = (StackSlot) objValues[i]; |
82 oopLocation = Location.stack(asm.getOffset(slot)); |
82 oopLocation = Location.stack(asm.getOffset(slot)); |
83 bytes = slot.getValueKind().getPlatformKind().getSizeInBytes(); |
83 bytes = slot.getValueKind().getPlatformKind().getSizeInBytes(); |
84 } |
84 } |
85 if (oopLocation != null && !newLocations.contains(oopLocation)) { |
85 if (oopLocation != null && !newLocations.contains(oopLocation)) { |
86 newLocations.add(oopLocation); |
86 newLocations.add(oopLocation); |
87 newDerived.add(null); |
87 newDerived.add(null); |
88 newSizeInBytes = Arrays.copyOf(newSizeInBytes, newSizeInBytes.length + 1); |
88 newSizeInBytes = Arrays.copyOf(newSizeInBytes, newSizeInBytes.length + 1); |
89 newSizeInBytes[newSizeInBytes.length - 1] = bytes; |
89 newSizeInBytes[newSizeInBytes.length - 1] = bytes; |
90 } |
90 } |
91 } |
91 } |
92 } |
92 } |
93 } |
93 } |
94 } |
94 } |
95 |
95 |