Skip to content
Snippets Groups Projects
Commit 0b7a29e4 authored by Mick Jordan's avatar Mick Jordan
Browse files

fix debug(f) error when f is duplicated

parent 39b2ebb7
Branches
No related tags found
No related merge requests found
......@@ -91,7 +91,7 @@ public final class FunctionDefinitionNode extends RRootNode implements RSyntaxNo
* unknown.
*/
private String description;
private final FunctionUID uuid;
private FunctionUID uuid;
private boolean instrumented = false;
@Child private FrameSlotNode onExitSlot;
......@@ -163,9 +163,14 @@ public final class FunctionDefinitionNode extends RRootNode implements RSyntaxNo
@Override
public RRootNode duplicateWithNewFrameDescriptor() {
FrameDescriptor frameDesc = new FrameDescriptor();
FunctionUID thisUuid = uuid;
FrameSlotChangeMonitor.initializeFunctionFrameDescriptor(description != null && !description.isEmpty() ? description : "<function>", frameDesc);
return new FunctionDefinitionNode(getSourceSection(), frameDesc, (BodyNode) body.unwrap().deepCopy(), getFormalArguments(), description, substituteFrame, argPostProcess == null ? null
: argPostProcess.deepCopyUnconditional());
FunctionDefinitionNode result = new FunctionDefinitionNode(getSourceSection(), frameDesc, (BodyNode) body.unwrap().deepCopy(), getFormalArguments(), description, substituteFrame,
argPostProcess == null ? null
: argPostProcess.deepCopyUnconditional());
// Instrumentation depends on this copy having same uuid
result.uuid = thisUuid;
return result;
}
private static boolean containsAnyDispatch(BodyNode body) {
......
/*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -216,8 +216,10 @@ public class RInstrument {
public static void registerFunctionDefinition(FunctionDefinitionNode fdn) {
FunctionUID uid = fdn.getUID();
FunctionData fd = functionMap.get(uid);
assert fd == null;
functionMap.put(uid, new FunctionData(uid, fdn));
// Owing to FDN duplication, fdn may be registered multiple times
if (fd == null) {
functionMap.put(uid, new FunctionData(uid, fdn));
}
}
public static FunctionIdentification getFunctionIdentification(FunctionUID uid) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment