Made Platform methods inlineable and allow the optimiser to load code for methods that have the @inline attribute

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@19189 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
dragos 2009-10-21 13:19:33 +00:00
parent d927529a38
commit eb68afef6b
2 changed files with 9 additions and 1 deletions

View File

@ -390,7 +390,8 @@ abstract class Inliners extends SubComponent {
if (settings.debug.value) log("shouldLoad: " + receiver + "." + method)
((method.isFinal && isMonadMethod(method) && isHigherOrderMethod(method))
|| (receiver.enclosingPackage == definitions.ScalaRunTimeModule.enclosingPackage)
|| (receiver == definitions.PredefModule.moduleClass))
|| (receiver == definitions.PredefModule.moduleClass)
|| (method.hasAnnotation(ScalaInlineAttr)))
}
/** Cache whether a method calls private members. */

View File

@ -26,6 +26,7 @@ object Platform {
* @param destPos ..
* @param length ..
*/
@inline
def arraycopy(src: AnyRef, srcPos: Int, dest: AnyRef, destPos: Int, length: Int) {
System.arraycopy(src, srcPos, dest, destPos, length)
}
@ -37,19 +38,25 @@ object Platform {
* @param length ..
* @return ..
*/
@inline
def createArray(elemClass: Class[_], length: Int): AnyRef =
java.lang.reflect.Array.newInstance(elemClass, length)
@inline
def arrayclear(arr: Array[Int]) { java.util.Arrays.fill(arr, 0) }
@inline
def getClassForName(name: String): Class[_] = java.lang.Class.forName(name)
val EOL = System.getProperty("line.separator", "\n")
@inline
def currentTime: Long = System.currentTimeMillis()
@inline
def collectGarbage: Unit = System.gc()
/** The name of the default character set encoding as a string */
@inline
def defaultCharsetName: String = java.nio.charset.Charset.defaultCharset.name
}