mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 02:44:47 +01:00
Detect also marked as needed methods if the method was previous add as replacement
This commit is contained in:
parent
52dd9a1665
commit
5a22c94b29
@ -45,6 +45,8 @@ class FunctionManager {
|
||||
|
||||
private final Set<String> usedClasses = new LinkedHashSet<>();
|
||||
|
||||
private int neededCount;
|
||||
|
||||
private boolean isFinish;
|
||||
|
||||
/**
|
||||
@ -71,12 +73,12 @@ class FunctionManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the count of known functions
|
||||
* Get the count of needed functions
|
||||
*
|
||||
* @return the count
|
||||
*/
|
||||
int size() {
|
||||
return states.size();
|
||||
int getNeededCount() {
|
||||
return neededCount;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -171,6 +173,7 @@ class FunctionManager {
|
||||
if( isFinish ) {
|
||||
throw new WasmException( "Prepare was already finish: " + name.signatureName, -1 );
|
||||
}
|
||||
neededCount++;
|
||||
state.state = State.Needed;
|
||||
state.needThisParameter = needThisParameter;
|
||||
JWebAssembly.LOGGER.fine( "\t\tcall: " + name.signatureName );
|
||||
|
@ -327,10 +327,10 @@ public class ModuleGenerator {
|
||||
int functCount;
|
||||
do {
|
||||
scanFunctions();
|
||||
functCount = functions.size(); // scan the functions can find new needed types or only new needed fields in the known types
|
||||
functCount = functions.getNeededCount(); // scan the functions can find new needed types or only new needed fields in the known types
|
||||
scanForClinit();
|
||||
types.scanTypeHierarchy(); // scan the type hierarchy can find new functions
|
||||
} while( functCount < functions.size() );
|
||||
} while( functCount < functions.getNeededCount() );
|
||||
|
||||
// write only the needed imports to the output
|
||||
for( Iterator<FunctionName> iterator = functions.getNeededImports(); iterator.hasNext(); ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user