mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 13:33:39 +00:00
compiler: decouple func lowering from interface type codes
There is no good reason for func values to refer to interface type codes. The only thing they need is a stable identifier for function signatures, which is easily created as a new kind of globals. Decoupling makes it easier to change interface related code.
This commit is contained in:
committed by
Ron Evans
parent
8383552552
commit
57271d7eaa
+3
-3
@@ -16,13 +16,13 @@ type funcValue struct {
|
||||
|
||||
// funcValueWithSignature is used before the func lowering pass.
|
||||
type funcValueWithSignature struct {
|
||||
funcPtr uintptr // ptrtoint of the actual function pointer
|
||||
signature *typecodeID // pointer to identify this signature (the value is undef)
|
||||
funcPtr uintptr // ptrtoint of the actual function pointer
|
||||
signature *uint8 // external *i8 with a name identifying the function signature
|
||||
}
|
||||
|
||||
// getFuncPtr is a dummy function that may be used if the func lowering pass is
|
||||
// not used. It is generally too slow but may be a useful fallback to debug the
|
||||
// func lowering pass.
|
||||
func getFuncPtr(val funcValue, signature *typecodeID) uintptr {
|
||||
func getFuncPtr(val funcValue, signature *uint8) uintptr {
|
||||
return (*funcValueWithSignature)(unsafe.Pointer(val.id)).funcPtr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user