bytecode: extend call args and cache call sites
This commit is contained in:
1 parent
144082733c
commit
2f4462858b
13 files changed
+400
-39
No files matched your search
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2026 Sergey S. Chernov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.sergeych.lyng.bytecode
|
||||
|
||||
import java.util.IdentityHashMap
|
||||
|
||||
internal actual object BytecodeCallSiteCache {
|
||||
private val cache = ThreadLocal.withInitial {
|
||||
IdentityHashMap<BytecodeFunction, MutableMap<Int, MethodCallSite>>()
|
||||
}
|
||||
|
||||
actual fun methodCallSites(fn: BytecodeFunction): MutableMap<Int, MethodCallSite> {
|
||||
val map = cache.get()
|
||||
return map.getOrPut(fn) { mutableMapOf() }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user