diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmem.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmem.java index 4023e75743f2f89ed59332251971523e2c43434d..802b049011e4aa701e472058bccfd5a4b60ffa30 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmem.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, 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 @@ -32,13 +32,9 @@ import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.PRIMITIVE; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.interop.TruffleObject; -import com.oracle.truffle.r.runtime.instrument.memprof.MemAllocProfilerInstrument; -import com.oracle.truffle.api.vm.PolyglotEngine; -import com.oracle.truffle.api.vm.PolyglotRuntime.Instrument; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; -import com.oracle.truffle.r.runtime.RError; +import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.builtins.RBuiltin; -import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.data.RNull; @RBuiltin(name = ".fastr.profmem", visibility = OFF, kind = PRIMITIVE, parameterNames = {"on"}, behavior = IO) @@ -62,33 +58,8 @@ public abstract class FastRprofmem extends RBuiltinNode.Arg1 { @Specialization @TruffleBoundary - public Object doProfMem(boolean on) { - PolyglotEngine vm = RContext.getInstance().getVM(); - if (vm != null) { - Instrument profilerInstr = vm.getRuntime().getInstruments().get(MemAllocProfilerInstrument.ID); - if (profilerInstr != null && profilerInstr.isEnabled() != on) { - profilerInstr.setEnabled(on); - } - } else { - throw error(RError.Message.GENERIC, "No context VM found"); - } - return RNull.instance; - } - - static MemAllocProfilerPrinter getProfilerPrinter() { - PolyglotEngine vm = RContext.getInstance().getVM(); - MemAllocProfilerPrinter profPrinter = null; - if (vm != null) { - Instrument profilerInstr = vm.getRuntime().getInstruments().get(MemAllocProfilerInstrument.ID); - if (profilerInstr != null && profilerInstr.isEnabled()) { - profPrinter = profilerInstr.lookup(MemAllocProfilerPrinter.class); - } - } - - if (profPrinter == null) { - profPrinter = new MemAllocProfilerPrinter(System.out); - } - - return profPrinter; + public Object doProfMem(@SuppressWarnings("unused") boolean on) { + // TODO: port to new instrumentation API, original code can be found in git history + throw error(Message.GENERIC, ".fastr.profmem is not available."); } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemShow.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemShow.java index b85dfe90a71c3f4139f114e8e635e2e814b22cbf..9179838da5c2224a0844e393344184772dbe981c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemShow.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemShow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, 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 @@ -35,6 +35,7 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; +import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RNull; @@ -59,27 +60,16 @@ public abstract class FastRprofmemShow extends RBuiltinNode.Arg6 { } @Specialization + @SuppressWarnings("unused") public Object doProfMem(int levels, boolean desc, @SuppressWarnings("unused") RNull n, boolean printParents, String view, TruffleObject snapshot) { - return show(levels, desc, null, printParents, view, snapshot); + // TODO: port to new instrumentation API, original code can be found in git history + throw error(Message.GENERIC, ".fastr.profmem.show is not available."); } @Specialization + @SuppressWarnings("unused") public Object doProfMem(int levels, boolean desc, int entryId, boolean printParents, String view, TruffleObject snapshot) { - return show(levels, desc, entryId, printParents, view, snapshot); - } - - @TruffleBoundary - private static Object show(int levels, boolean desc, Integer entryId, boolean printParents, String view, TruffleObject snapshotTO) { - MemAllocProfilerPaths snapshot = MemAllocProfilerPaths.fromTruffleObject(snapshotTO); - return show(levels, desc, entryId, printParents, view, snapshot); - } - - private static Object show(int levels, boolean desc, Integer entryId, boolean printParents, String view, MemAllocProfilerPaths snapshot) { - MemAllocProfilerPaths usedSnapshot = snapshot; - if (FastRprofmem.HOTSPOTS_VIEW.equals(view)) { - usedSnapshot = usedSnapshot.toHS(); - } - FastRprofmem.getProfilerPrinter().show(usedSnapshot, entryId, levels, desc, printParents); - return RNull.instance; + // TODO: port to new instrumentation API, original code can be found in git history + throw error(Message.GENERIC, ".fastr.profmem.show is not available."); } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemSource.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemSource.java index 3c008c7eec1fbbdd89b1461b122cc9b5779c4654..5e3eac7f322bee7d3c639aea2071363f519d7639 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemSource.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemSource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, 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 @@ -33,6 +33,7 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; +import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RNull; @@ -55,19 +56,9 @@ public abstract class FastRprofmemSource extends RBuiltinNode.Arg3 { @Specialization @TruffleBoundary + @SuppressWarnings("unused") public Object showSource(int entryId, String view, TruffleObject snapshotTO) { - MemAllocProfilerPaths paths = MemAllocProfilerPaths.fromTruffleObject(snapshotTO); - return showSource(entryId, view, paths); - } - - private static Object showSource(int entryId, String view, MemAllocProfilerPaths snap) { - MemAllocProfilerPaths snapshot = snap; - if (FastRprofmem.HOTSPOTS_VIEW.equals(view)) { - snapshot = snapshot.toHS(); - } - - FastRprofmem.getProfilerPrinter().source(snapshot, entryId); - - return RNull.instance; + // TODO: port to new instrumentation API, original code can be found in git history + throw error(Message.GENERIC, ".fastr.profmem.source is not available."); } }