mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +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 final Set<String> usedClasses = new LinkedHashSet<>();
|
||||||
|
|
||||||
|
private int neededCount;
|
||||||
|
|
||||||
private boolean isFinish;
|
private boolean isFinish;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,12 +73,12 @@ class FunctionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the count of known functions
|
* Get the count of needed functions
|
||||||
*
|
*
|
||||||
* @return the count
|
* @return the count
|
||||||
*/
|
*/
|
||||||
int size() {
|
int getNeededCount() {
|
||||||
return states.size();
|
return neededCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -171,6 +173,7 @@ class FunctionManager {
|
|||||||
if( isFinish ) {
|
if( isFinish ) {
|
||||||
throw new WasmException( "Prepare was already finish: " + name.signatureName, -1 );
|
throw new WasmException( "Prepare was already finish: " + name.signatureName, -1 );
|
||||||
}
|
}
|
||||||
|
neededCount++;
|
||||||
state.state = State.Needed;
|
state.state = State.Needed;
|
||||||
state.needThisParameter = needThisParameter;
|
state.needThisParameter = needThisParameter;
|
||||||
JWebAssembly.LOGGER.fine( "\t\tcall: " + name.signatureName );
|
JWebAssembly.LOGGER.fine( "\t\tcall: " + name.signatureName );
|
||||||
|
@ -327,10 +327,10 @@ public class ModuleGenerator {
|
|||||||
int functCount;
|
int functCount;
|
||||||
do {
|
do {
|
||||||
scanFunctions();
|
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();
|
scanForClinit();
|
||||||
types.scanTypeHierarchy(); // scan the type hierarchy can find new functions
|
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
|
// write only the needed imports to the output
|
||||||
for( Iterator<FunctionName> iterator = functions.getNeededImports(); iterator.hasNext(); ) {
|
for( Iterator<FunctionName> iterator = functions.getNeededImports(); iterator.hasNext(); ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user