Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/builtins/SLDefineFunctionBuiltin.java @ 13882:afd6fa5e8229
SL: Feedback from reviewers
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Wed, 05 Feb 2014 08:02:15 -0800 |
parents | b16ec83edc73 |
children | 89ac75425681 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/builtins/SLDefineFunctionBuiltin.java Wed Feb 05 15:50:36 2014 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/builtins/SLDefineFunctionBuiltin.java Wed Feb 05 08:02:15 2014 -0800 @@ -22,10 +22,12 @@ */ package com.oracle.truffle.sl.builtins; +import com.oracle.truffle.api.CompilerDirectives.SlowPath; import com.oracle.truffle.api.*; import com.oracle.truffle.api.dsl.*; import com.oracle.truffle.api.nodes.*; import com.oracle.truffle.sl.parser.*; +import com.oracle.truffle.sl.runtime.*; /** * Builtin function to define (or redefine) functions. The provided source code is parsed the same @@ -36,9 +38,14 @@ @Specialization public String defineFunction(String code) { - Source source = getContext().getSourceManager().get("[defineFunction]", code); + return doDefineFunction(getContext(), code); + } + + @SlowPath + private static String doDefineFunction(SLContext context, String code) { + Source source = context.getSourceManager().get("[defineFunction]", code); /* The same parsing code as for parsing the initial source. */ - Parser.parseSL(getContext(), source); + Parser.parseSL(context, source); return code; } }