Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/debug/ActiveLeaveDebugProbe.java @ 13918:22bf5a8ba9eb
Ruby: restore prototype debugger.
author | Chris Seaton <chris.seaton@oracle.com> |
---|---|
date | Mon, 10 Feb 2014 03:39:21 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
13917:f2345d7c52ef | 13918:22bf5a8ba9eb |
---|---|
1 /* | |
2 * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved. This | |
3 * code is released under a tri EPL/GPL/LGPL license. You can use it, | |
4 * redistribute it and/or modify it under the terms of the: | |
5 * | |
6 * Eclipse Public License version 1.0 | |
7 * GNU General Public License version 2 | |
8 * GNU Lesser General Public License version 2.1 | |
9 */ | |
10 package com.oracle.truffle.ruby.nodes.debug; | |
11 | |
12 import com.oracle.truffle.api.*; | |
13 import com.oracle.truffle.api.frame.*; | |
14 import com.oracle.truffle.api.nodes.*; | |
15 import com.oracle.truffle.ruby.nodes.*; | |
16 import com.oracle.truffle.ruby.runtime.*; | |
17 import com.oracle.truffle.ruby.runtime.core.*; | |
18 | |
19 public abstract class ActiveLeaveDebugProbe extends RubyProbe { | |
20 | |
21 private final Assumption activeAssumption; | |
22 | |
23 private final InlinableMethodImplementation inlinable; | |
24 private final RubyRootNode inlinedRoot; | |
25 | |
26 public ActiveLeaveDebugProbe(RubyContext context, Assumption activeAssumption, RubyProc proc) { | |
27 super(context, false); | |
28 this.activeAssumption = activeAssumption; | |
29 inlinable = ((InlinableMethodImplementation) proc.getMethod().getImplementation()); | |
30 inlinedRoot = inlinable.getCloneOfPristineRootNode(); | |
31 } | |
32 | |
33 @Override | |
34 public void leave(Node astNode, VirtualFrame frame, Object result) { | |
35 try { | |
36 activeAssumption.check(); | |
37 } catch (InvalidAssumptionException e) { | |
38 replace(createInactive()); | |
39 return; | |
40 } | |
41 | |
42 final RubyArguments arguments = new RubyArguments(inlinable.getDeclarationFrame(), NilPlaceholder.INSTANCE, null, result); | |
43 final VirtualFrame inlinedFrame = Truffle.getRuntime().createVirtualFrame(frame.pack(), arguments, inlinable.getFrameDescriptor()); | |
44 inlinedRoot.execute(inlinedFrame); | |
45 } | |
46 | |
47 protected abstract InactiveLeaveDebugProbe createInactive(); | |
48 | |
49 } |