< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLIRGenerator.java
Print this page
rev 56282 : [mq]: graal
*** 297,318 ****
* We exclude the argument registers from the zeroing LIR instruction since it violates
* the LIR semantics of @Temp that values must not be live. Note that the emitted
* machine instruction actually zeros _all_ XMM registers which is fine since we know
* that their upper half is not used.
*/
! append(new AMD64VZeroUpper(arguments));
}
super.emitForeignCallOp(linkage, result, arguments, temps, info);
}
/**
* @param savedRegisters the registers saved by this operation which may be subject to pruning
* @param savedRegisterLocations the slots to which the registers are saved
- * @param supportsRemove determines if registers can be pruned
*/
! protected AMD64SaveRegistersOp emitSaveRegisters(Register[] savedRegisters, AllocatableValue[] savedRegisterLocations, boolean supportsRemove) {
! AMD64SaveRegistersOp save = new AMD64SaveRegistersOp(savedRegisters, savedRegisterLocations, supportsRemove);
append(save);
return save;
}
/**
--- 297,317 ----
* We exclude the argument registers from the zeroing LIR instruction since it violates
* the LIR semantics of @Temp that values must not be live. Note that the emitted
* machine instruction actually zeros _all_ XMM registers which is fine since we know
* that their upper half is not used.
*/
! append(new AMD64VZeroUpper(arguments, getRegisterConfig()));
}
super.emitForeignCallOp(linkage, result, arguments, temps, info);
}
/**
* @param savedRegisters the registers saved by this operation which may be subject to pruning
* @param savedRegisterLocations the slots to which the registers are saved
*/
! protected AMD64SaveRegistersOp emitSaveRegisters(Register[] savedRegisters, AllocatableValue[] savedRegisterLocations) {
! AMD64SaveRegistersOp save = new AMD64SaveRegistersOp(savedRegisters, savedRegisterLocations);
append(save);
return save;
}
/**
*** 328,346 ****
}
/**
* Adds a node to the graph that saves all allocatable registers to the stack.
*
- * @param supportsRemove determines if registers can be pruned
* @return the register save node
*/
! private AMD64SaveRegistersOp emitSaveAllRegisters(Register[] savedRegisters, boolean supportsRemove) {
AllocatableValue[] savedRegisterLocations = new AllocatableValue[savedRegisters.length];
for (int i = 0; i < savedRegisters.length; i++) {
savedRegisterLocations[i] = allocateSaveRegisterLocation(savedRegisters[i]);
}
! return emitSaveRegisters(savedRegisters, savedRegisterLocations, supportsRemove);
}
protected void emitRestoreRegisters(AMD64SaveRegistersOp save) {
append(new AMD64RestoreRegistersOp(save.getSlots().clone(), save));
}
--- 327,349 ----
}
/**
* Adds a node to the graph that saves all allocatable registers to the stack.
*
* @return the register save node
*/
! private AMD64SaveRegistersOp emitSaveAllRegisters() {
! Register[] savedRegisters = getSaveableRegisters();
AllocatableValue[] savedRegisterLocations = new AllocatableValue[savedRegisters.length];
for (int i = 0; i < savedRegisters.length; i++) {
savedRegisterLocations[i] = allocateSaveRegisterLocation(savedRegisters[i]);
}
! return emitSaveRegisters(savedRegisters, savedRegisterLocations);
! }
!
! protected Register[] getSaveableRegisters() {
! return getResult().getRegisterAllocationConfig().getAllocatableRegisters().toArray();
}
protected void emitRestoreRegisters(AMD64SaveRegistersOp save) {
append(new AMD64RestoreRegistersOp(save.getSlots().clone(), save));
}
*** 367,381 ****
HotSpotForeignCallLinkage hotspotLinkage = (HotSpotForeignCallLinkage) linkage;
boolean destroysRegisters = hotspotLinkage.destroysRegisters();
AMD64SaveRegistersOp save = null;
Stub stub = getStub();
! if (destroysRegisters) {
! if (stub != null && stub.preservesRegisters()) {
! Register[] savedRegisters = getRegisterConfig().getAllocatableRegisters().toArray();
! save = emitSaveAllRegisters(savedRegisters, true);
! }
}
Variable result;
LIRFrameState debugInfo = null;
if (hotspotLinkage.needsDebugInfo()) {
--- 370,381 ----
HotSpotForeignCallLinkage hotspotLinkage = (HotSpotForeignCallLinkage) linkage;
boolean destroysRegisters = hotspotLinkage.destroysRegisters();
AMD64SaveRegistersOp save = null;
Stub stub = getStub();
! if (destroysRegisters && stub != null && stub.shouldSaveRegistersAroundCalls()) {
! save = emitSaveAllRegisters();
}
Variable result;
LIRFrameState debugInfo = null;
if (hotspotLinkage.needsDebugInfo()) {
*** 390,413 ****
append(new AMD64HotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaFpOffset(), config.threadLastJavaPcOffset(), thread));
} else {
result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
}
! if (destroysRegisters) {
! if (stub != null) {
! if (stub.preservesRegisters()) {
HotSpotLIRGenerationResult generationResult = getResult();
LIRFrameState key = currentRuntimeCallInfo;
if (key == null) {
key = LIRFrameState.NO_STATE;
}
assert !generationResult.getCalleeSaveInfo().containsKey(key);
generationResult.getCalleeSaveInfo().put(key, save);
emitRestoreRegisters(save);
}
- }
- }
return result;
}
@Override
--- 390,409 ----
append(new AMD64HotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaFpOffset(), config.threadLastJavaPcOffset(), thread));
} else {
result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
}
! if (save != null) {
HotSpotLIRGenerationResult generationResult = getResult();
LIRFrameState key = currentRuntimeCallInfo;
if (key == null) {
key = LIRFrameState.NO_STATE;
}
assert !generationResult.getCalleeSaveInfo().containsKey(key);
generationResult.getCalleeSaveInfo().put(key, save);
emitRestoreRegisters(save);
}
return result;
}
@Override
< prev index next >